From 6f47c93f2aceb866b33f18211873b2e3588ab665 Mon Sep 17 00:00:00 2001 From: SowmyaArunachalam Date: Wed, 28 Jan 2026 15:38:17 +0530 Subject: [PATCH] feat(selling-settings): add checkbox to recalculate payment date (cherry picked from commit 70b401e610c51adbb221bbe83b89cca664c3c755) # Conflicts: # erpnext/selling/doctype/selling_settings/selling_settings.json --- .../selling/doctype/quotation/quotation.py | 10 ++++- .../selling_settings/selling_settings.json | 43 +++++++++++++++++++ .../selling_settings/selling_settings.py | 1 + 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/erpnext/selling/doctype/quotation/quotation.py b/erpnext/selling/doctype/quotation/quotation.py index 7a31854d259..7df81acb4f3 100644 --- a/erpnext/selling/doctype/quotation/quotation.py +++ b/erpnext/selling/doctype/quotation/quotation.py @@ -7,7 +7,7 @@ import json import frappe from frappe import _ from frappe.model.mapper import get_mapped_doc -from frappe.utils import flt, getdate, nowdate +from frappe.utils import cint, flt, getdate, nowdate from erpnext.controllers.selling_controller import SellingController @@ -458,13 +458,19 @@ def _make_sales_order(source_name, target_doc=None, ignore_permissions=False, ar }, "Sales Taxes and Charges": {"doctype": "Sales Taxes and Charges", "reset_value": True}, "Sales Team": {"doctype": "Sales Team", "add_if_empty": True}, - "Payment Schedule": {"doctype": "Payment Schedule", "add_if_empty": True}, }, target_doc, set_missing_values, ignore_permissions=ignore_permissions, ) + automatically_fetch_payment_terms = cint( + frappe.get_single_value("Selling Settings", "automatically_fetch_payment_terms_from_quotation") + ) + + if automatically_fetch_payment_terms: + doclist.set_payment_schedule() + return doclist diff --git a/erpnext/selling/doctype/selling_settings/selling_settings.json b/erpnext/selling/doctype/selling_settings/selling_settings.json index 5bef5bc55a2..09ac9a3dec7 100644 --- a/erpnext/selling/doctype/selling_settings/selling_settings.json +++ b/erpnext/selling/doctype/selling_settings/selling_settings.json @@ -36,7 +36,21 @@ "enable_discount_accounting", "allow_zero_qty_in_quotation", "allow_zero_qty_in_sales_order", +<<<<<<< HEAD "set_zero_rate_for_expired_batch" +======= + "set_zero_rate_for_expired_batch", + "automatically_fetch_payment_terms_from_quotation", + "section_break_avhb", + "enable_utm", + "experimental_section", + "use_legacy_js_reactivity", + "subcontracting_inward_tab", + "section_break_zwh6", + "allow_delivery_of_overproduced_qty", + "column_break_mla9", + "deliver_scrap_items" +>>>>>>> 70b401e610 (feat(selling-settings): add checkbox to recalculate payment date) ], "fields": [ { @@ -232,6 +246,35 @@ "fieldname": "set_zero_rate_for_expired_batch", "fieldtype": "Check", "label": "Set Incoming Rate as Zero for Expired Batch" +<<<<<<< HEAD +======= + }, + { + "default": "0", + "description": "Manage sales partner's and sales team's commissions", + "fieldname": "enable_tracking_sales_commissions", + "fieldtype": "Check", + "label": "Enable tracking sales commissions" + }, + { + "fieldname": "section_break_avhb", + "fieldtype": "Section Break", + "label": "Analytics" + }, + { + "default": "0", + "description": "Enable Urchin Tracking Module parameters in Quotation, Sales Order, Sales Invoice, POS Invoice, Lead, and Delivery Note.", + "documentation_url": "https://en.wikipedia.org/wiki/UTM_parameters", + "fieldname": "enable_utm", + "fieldtype": "Check", + "label": "Enable UTM" + }, + { + "default": "0", + "fieldname": "automatically_fetch_payment_terms_from_quotation", + "fieldtype": "Check", + "label": "Automatically Fetch Payment Terms from Quotation" +>>>>>>> 70b401e610 (feat(selling-settings): add checkbox to recalculate payment date) } ], "grid_page_length": 50, diff --git a/erpnext/selling/doctype/selling_settings/selling_settings.py b/erpnext/selling/doctype/selling_settings/selling_settings.py index cad8385ab73..68b27cfda21 100644 --- a/erpnext/selling/doctype/selling_settings/selling_settings.py +++ b/erpnext/selling/doctype/selling_settings/selling_settings.py @@ -26,6 +26,7 @@ class SellingSettings(Document): allow_sales_order_creation_for_expired_quotation: DF.Check allow_zero_qty_in_quotation: DF.Check allow_zero_qty_in_sales_order: DF.Check + automatically_fetch_payment_terms_from_quotation: DF.Check blanket_order_allowance: DF.Float cust_master_name: DF.Literal["Customer Name", "Naming Series", "Auto Name"] customer_group: DF.Link | None