feat: add selling setting for cutoff date
diff --git a/erpnext/selling/doctype/sales_order/sales_order_list.js b/erpnext/selling/doctype/sales_order/sales_order_list.js
index 822c6cb..53de329 100644
--- a/erpnext/selling/doctype/sales_order/sales_order_list.js
+++ b/erpnext/selling/doctype/sales_order/sales_order_list.js
@@ -55,18 +55,24 @@
});
listview.page.add_action_item(__("Delivery Note"), ()=>{
- var dialog = new frappe.ui.Dialog({
- title: __("Select Items up to Delivery Date"),
- fields: [{fieldtype: "Date", fieldname: "delivery_date", default: frappe.datetime.add_days(frappe.datetime.nowdate(), 1)}]
- });
- dialog.set_primary_action(__("Select"), function(values) {
- var until_delivery_date = values.delivery_date;
- erpnext.bulk_transaction_processing.create(listview, "Sales Order", "Delivery Note", {
- until_delivery_date
- });
- dialog.hide();
- });
- dialog.show();
+ frappe.db.get_single_value("Selling Settings", "enable_cutoff_date_on_bulk_delivery_note_creation").then((value) => {
+ if (value) {
+ var dialog = new frappe.ui.Dialog({
+ title: __("Select Items up to Delivery Date"),
+ fields: [{fieldtype: "Date", fieldname: "delivery_date", default: frappe.datetime.add_days(frappe.datetime.nowdate(), 1)}]
+ });
+ dialog.set_primary_action(__("Select"), function(values) {
+ var until_delivery_date = values.delivery_date;
+ erpnext.bulk_transaction_processing.create(listview, "Sales Order", "Delivery Note", {
+ until_delivery_date
+ });
+ dialog.hide();
+ });
+ dialog.show();
+ } else {
+ erpnext.bulk_transaction_processing.create(listview, "Sales Order", "Delivery Note");
+ }
+ })
});
listview.page.add_action_item(__("Advance Payment"), ()=>{
diff --git a/erpnext/selling/doctype/selling_settings/selling_settings.json b/erpnext/selling/doctype/selling_settings/selling_settings.json
index d6829ce..ee3d2bf 100644
--- a/erpnext/selling/doctype/selling_settings/selling_settings.json
+++ b/erpnext/selling/doctype/selling_settings/selling_settings.json
@@ -32,7 +32,8 @@
"allow_sales_order_creation_for_expired_quotation",
"dont_reserve_sales_order_qty_on_sales_return",
"hide_tax_id",
- "enable_discount_accounting"
+ "enable_discount_accounting",
+ "enable_cutoff_date_on_bulk_delivery_note_creation"
],
"fields": [
{
@@ -200,6 +201,12 @@
"fieldname": "blanket_order_allowance",
"fieldtype": "Float",
"label": "Blanket Order Allowance (%)"
+ },
+ {
+ "default": "0",
+ "fieldname": "enable_cutoff_date_on_bulk_delivery_note_creation",
+ "fieldtype": "Check",
+ "label": "Enable Cut-Off Date on Bulk Delivery Note Creation"
}
],
"icon": "fa fa-cog",
@@ -207,7 +214,7 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
- "modified": "2023-10-25 14:03:03.966701",
+ "modified": "2024-03-01 12:07:39.994520",
"modified_by": "Administrator",
"module": "Selling",
"name": "Selling Settings",
diff --git a/erpnext/selling/doctype/selling_settings/selling_settings.py b/erpnext/selling/doctype/selling_settings/selling_settings.py
index 24fe909..a488177 100644
--- a/erpnext/selling/doctype/selling_settings/selling_settings.py
+++ b/erpnext/selling/doctype/selling_settings/selling_settings.py
@@ -30,6 +30,7 @@
dont_reserve_sales_order_qty_on_sales_return: DF.Check
editable_bundle_item_rates: DF.Check
editable_price_list_rate: DF.Check
+ enable_cutoff_date_on_bulk_delivery_note_creation: DF.Check
enable_discount_accounting: DF.Check
hide_tax_id: DF.Check
maintain_same_rate_action: DF.Literal["Stop", "Warn"]