diff --git a/erpnext/selling/doctype/quotation/quotation.json b/erpnext/selling/doctype/quotation/quotation.json index 041ec44b7e9..b9fb7d97a01 100644 --- a/erpnext/selling/doctype/quotation/quotation.json +++ b/erpnext/selling/doctype/quotation/quotation.json @@ -125,19 +125,20 @@ "competitors", "column_break_117", "order_lost_reason", + "utm_analytics_section", + "utm_source", + "utm_medium", + "column_break_fozg", + "utm_campaign", + "utm_content", "additional_info_section", "status", "customer_group", "territory", "column_break_108", - "utm_source", - "utm_campaign", - "utm_medium", - "utm_content", - "column_break4", "opportunity", - "supplier_quotation", "enq_det", + "supplier_quotation", "connections_tab" ], "fields": [ @@ -843,13 +844,6 @@ "oldfieldtype": "Small Text", "print_hide": 1 }, - { - "fieldname": "column_break4", - "fieldtype": "Column Break", - "oldfieldtype": "Column Break", - "print_hide": 1, - "width": "50%" - }, { "default": "Draft", "fieldname": "status", @@ -1125,13 +1119,23 @@ { "fieldname": "column_break_bffp", "fieldtype": "Column Break" + }, + { + "fieldname": "column_break_fozg", + "fieldtype": "Column Break" + }, + { + "collapsible": 1, + "fieldname": "utm_analytics_section", + "fieldtype": "Section Break", + "label": "UTM Analytics" } ], "icon": "fa fa-shopping-cart", "idx": 82, "is_submittable": 1, "links": [], - "modified": "2026-02-06 16:44:02.134974", + "modified": "2026-02-06 17:34:22.170032", "modified_by": "Administrator", "module": "Selling", "name": "Quotation", diff --git a/erpnext/selling/doctype/selling_settings/selling_settings.json b/erpnext/selling/doctype/selling_settings/selling_settings.json index 9fe14ae2a98..b7e4fce817d 100644 --- a/erpnext/selling/doctype/selling_settings/selling_settings.json +++ b/erpnext/selling/doctype/selling_settings/selling_settings.json @@ -41,6 +41,8 @@ "allow_zero_qty_in_quotation", "allow_zero_qty_in_sales_order", "set_zero_rate_for_expired_batch", + "section_break_avhb", + "enable_utm", "experimental_section", "use_legacy_js_reactivity", "subcontracting_inward_tab", @@ -305,6 +307,19 @@ "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 UTM parameters", + "documentation_url": "https://en.wikipedia.org/wiki/UTM_parameters", + "fieldname": "enable_utm", + "fieldtype": "Check", + "label": "Enable UTM" } ], "grid_page_length": 50, @@ -314,7 +329,7 @@ "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2026-02-04 16:16:57.618127", + "modified": "2026-02-06 16:11:13.538490", "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 775b5844c3e..8621f5f066d 100644 --- a/erpnext/selling/doctype/selling_settings/selling_settings.py +++ b/erpnext/selling/doctype/selling_settings/selling_settings.py @@ -10,6 +10,17 @@ from frappe.custom.doctype.property_setter.property_setter import make_property_ from frappe.model.document import Document from frappe.utils import cint +UTM_DOCTYPES = [ + "Lead", + "Quotation", + "POS Invoice", + "POS Profile", + "Opportunity", + "Sales Order", + "Sales Invoice", + "Delivery Note", +] + class SellingSettings(Document): # begin: auto-generated types @@ -38,6 +49,7 @@ class SellingSettings(Document): enable_cutoff_date_on_bulk_delivery_note_creation: DF.Check enable_discount_accounting: DF.Check enable_tracking_sales_commissions: DF.Check + enable_utm: DF.Check fallback_to_default_price_list: DF.Check hide_tax_id: DF.Check maintain_same_rate_action: DF.Literal["Stop", "Warn"] @@ -84,6 +96,9 @@ class SellingSettings(Document): if old_doc.enable_tracking_sales_commissions != self.enable_tracking_sales_commissions: toggle_tracking_sales_commissions_section(not self.enable_tracking_sales_commissions) + if old_doc.enable_utm != self.enable_utm: + toggle_utm_analytics_section(not self.enable_utm) + def validate_fallback_to_default_price_list(self): if ( self.fallback_to_default_price_list @@ -195,3 +210,14 @@ def toggle_tracking_sales_commissions_section(hide): create_property_setter_for_hiding_field(doctype, "commission_section", hide) if meta.has_field("sales_team_section"): create_property_setter_for_hiding_field(doctype, "sales_team_section", hide) + + +def toggle_utm_analytics_section(hide): + from erpnext.accounts.doctype.accounts_settings.accounts_settings import ( + create_property_setter_for_hiding_field, + ) + + for doctype in UTM_DOCTYPES: + meta = frappe.get_meta(doctype) + if meta.has_field("utm_analytics_section"): + create_property_setter_for_hiding_field(doctype, "utm_analytics_section", hide)