Merge pull request #52507 from ruthra-kumar/toggle_for_utm_parameters

refactor: toggle for UTM parameters
This commit is contained in:
ruthra kumar
2026-02-12 10:55:45 +05:30
committed by GitHub
10 changed files with 151 additions and 89 deletions

View File

@@ -159,15 +159,16 @@
"language",
"column_break_84",
"select_print_heading",
"utm_analytics_section",
"utm_source",
"utm_medium",
"column_break_bhao",
"utm_campaign",
"more_information",
"inter_company_invoice_reference",
"customer_group",
"is_discounted",
"col_break23",
"utm_source",
"utm_campaign",
"utm_medium",
"column_break_gpiw",
"status",
"more_info",
"debit_to",
@@ -1541,10 +1542,6 @@
"fieldtype": "Check",
"label": "Update Billed Amount in Delivery Note"
},
{
"fieldname": "column_break_gpiw",
"fieldtype": "Column Break"
},
{
"fieldname": "utm_medium",
"fieldtype": "Link",
@@ -1612,12 +1609,22 @@
"no_copy": 1,
"options": "Item Wise Tax Detail",
"print_hide": 1
},
{
"collapsible": 1,
"fieldname": "utm_analytics_section",
"fieldtype": "Section Break",
"label": "UTM Analytics"
},
{
"fieldname": "column_break_bhao",
"fieldtype": "Column Break"
}
],
"icon": "fa fa-file-text",
"is_submittable": 1,
"links": [],
"modified": "2026-01-29 21:20:51.376875",
"modified": "2026-02-10 14:23:07.181782",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Invoice",

View File

@@ -78,7 +78,7 @@
"column_break0",
"tc_name",
"select_print_heading",
"campaign_section_break",
"utm_analytics_section",
"utm_source",
"column_break_tvls",
"utm_campaign",
@@ -462,12 +462,6 @@
"fieldname": "column_break_xygw",
"fieldtype": "Column Break"
},
{
"collapsible": 1,
"fieldname": "campaign_section_break",
"fieldtype": "Section Break",
"label": "Campaign"
},
{
"fieldname": "accounting_tab",
"fieldtype": "Tab Break",
@@ -554,6 +548,12 @@
"fieldname": "allow_warehouse_change",
"fieldtype": "Check",
"label": "Allow User to Edit Warehouse"
},
{
"collapsible": 1,
"fieldname": "utm_analytics_section",
"fieldtype": "Section Break",
"label": "Campaign"
}
],
"grid_page_length": 50,
@@ -582,7 +582,7 @@
"link_fieldname": "pos_profile"
}
],
"modified": "2026-02-05 18:17:26.807353",
"modified": "2026-02-10 14:24:48.597412",
"modified_by": "Administrator",
"module": "Accounts",
"name": "POS Profile",

View File

@@ -217,16 +217,17 @@
"column_break_140",
"to_date",
"update_auto_repeat_reference",
"utm_analytics_section",
"utm_source",
"utm_medium",
"column_break_ixxw",
"utm_campaign",
"utm_content",
"more_information",
"status",
"remarks",
"customer_group",
"column_break_imbx",
"utm_source",
"utm_campaign",
"utm_medium",
"utm_content",
"col_break23",
"is_internal_customer",
"represents_company",
"inter_company_invoice_reference",
@@ -1630,13 +1631,6 @@
"no_copy": 1,
"read_only": 1
},
{
"fieldname": "col_break23",
"fieldtype": "Column Break",
"hide_days": 1,
"hide_seconds": 1,
"width": "50%"
},
{
"default": "Draft",
"fieldname": "status",
@@ -2303,6 +2297,16 @@
"oldfieldtype": "Section Break",
"options": "fa fa-group",
"print_hide": 1
},
{
"fieldname": "column_break_ixxw",
"fieldtype": "Column Break"
},
{
"collapsible": 1,
"fieldname": "utm_analytics_section",
"fieldtype": "Section Break",
"label": "UTM Analytics"
}
],
"grid_page_length": 50,
@@ -2316,7 +2320,7 @@
"link_fieldname": "consolidated_invoice"
}
],
"modified": "2026-02-06 20:43:44.732805",
"modified": "2026-02-10 11:59:07.819903",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",

View File

@@ -52,13 +52,12 @@
"country",
"column_break2",
"contact_html",
"section_break_analytics",
"utm_analytics_section",
"utm_source",
"utm_content",
"utm_medium",
"column_break_gkxo",
"utm_campaign",
"column_break_gqka",
"utm_medium",
"utm_content",
"qualification_tab",
"qualification_status",
"column_break_64",
@@ -504,10 +503,6 @@
"fieldname": "column_break_gkxo",
"fieldtype": "Column Break"
},
{
"fieldname": "column_break_gqka",
"fieldtype": "Column Break"
},
{
"fieldname": "utm_content",
"fieldtype": "Data",
@@ -537,7 +532,8 @@
"options": "UTM Campaign"
},
{
"fieldname": "section_break_analytics",
"collapsible": 1,
"fieldname": "utm_analytics_section",
"fieldtype": "Section Break",
"label": "Analytics"
}
@@ -547,7 +543,7 @@
"idx": 5,
"image_field": "image",
"links": [],
"modified": "2025-06-26 11:02:01.158901",
"modified": "2026-02-10 14:36:37.157961",
"modified_by": "Administrator",
"module": "CRM",
"name": "Lead",

View File

@@ -44,13 +44,12 @@
"column_break_17",
"opportunity_amount",
"base_opportunity_amount",
"section_break_analytics",
"utm_analytics_section",
"utm_source",
"utm_content",
"utm_medium",
"column_break_emai",
"utm_campaign",
"column_break_whcu",
"utm_medium",
"utm_content",
"more_info",
"company",
"transaction_date",
@@ -629,15 +628,6 @@
"options": "UTM Campaign",
"print_hide": 1
},
{
"fieldname": "section_break_analytics",
"fieldtype": "Section Break",
"label": "Analytics"
},
{
"fieldname": "column_break_whcu",
"fieldtype": "Column Break"
},
{
"fieldname": "utm_medium",
"fieldtype": "Link",
@@ -650,13 +640,19 @@
"fieldtype": "Data",
"label": "Content",
"print_hide": 1
},
{
"collapsible": 1,
"fieldname": "utm_analytics_section",
"fieldtype": "Section Break",
"label": "Analytics"
}
],
"grid_page_length": 50,
"icon": "fa fa-info-sign",
"idx": 195,
"links": [],
"modified": "2025-08-11 13:35:39.476016",
"modified": "2026-02-10 14:36:01.387984",
"modified_by": "Administrator",
"module": "CRM",
"name": "Opportunity",

View File

@@ -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",

View File

@@ -161,17 +161,18 @@
"column_break4",
"select_print_heading",
"language",
"utm_analytics_section",
"utm_source",
"utm_medium",
"column_break_ijxt",
"utm_campaign",
"utm_content",
"additional_info_section",
"is_internal_customer",
"po_no",
"po_date",
"represents_company",
"column_break_yvzv",
"utm_source",
"utm_campaign",
"utm_medium",
"utm_content",
"column_break_152",
"inter_company_order_reference",
"party_account_currency",
"connections_tab"
@@ -1567,10 +1568,6 @@
"fieldtype": "Section Break",
"label": "Additional Info"
},
{
"fieldname": "column_break_152",
"fieldtype": "Column Break"
},
{
"fieldname": "incoterm",
"fieldtype": "Link",
@@ -1717,6 +1714,16 @@
"hide_days": 1,
"hide_seconds": 1,
"label": "Additional Discount"
},
{
"fieldname": "column_break_ijxt",
"fieldtype": "Column Break"
},
{
"collapsible": 1,
"fieldname": "utm_analytics_section",
"fieldtype": "Section Break",
"label": "UTM Analytics"
}
],
"grid_page_length": 50,
@@ -1724,7 +1731,7 @@
"idx": 105,
"is_submittable": 1,
"links": [],
"modified": "2026-02-06 15:35:47.502692",
"modified": "2026-02-10 11:55:52.796522",
"modified_by": "Administrator",
"module": "Selling",
"name": "Sales Order",

View File

@@ -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 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"
}
],
"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-12 10:38:34.605126",
"modified_by": "Administrator",
"module": "Selling",
"name": "Selling Settings",

View File

@@ -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)

View File

@@ -154,17 +154,18 @@
"column_break_88",
"select_print_heading",
"language",
"utm_analytics_section",
"utm_source",
"utm_medium",
"column_break_neoj",
"utm_campaign",
"utm_content",
"more_info",
"is_internal_customer",
"represents_company",
"inter_company_reference",
"customer_group",
"territory",
"column_break_pxls",
"utm_source",
"utm_campaign",
"utm_medium",
"utm_content",
"column_break5",
"excise_page",
"instructions",
@@ -1371,10 +1372,6 @@
"options": "Delivery Trip",
"print_hide": 1
},
{
"fieldname": "column_break_pxls",
"fieldtype": "Column Break"
},
{
"fieldname": "utm_medium",
"fieldtype": "Link",
@@ -1428,13 +1425,23 @@
"no_copy": 1,
"options": "Item Wise Tax Detail",
"print_hide": 1
},
{
"collapsible": 1,
"fieldname": "utm_analytics_section",
"fieldtype": "Section Break",
"label": "UTM Analytics"
},
{
"fieldname": "column_break_neoj",
"fieldtype": "Column Break"
}
],
"icon": "fa fa-truck",
"idx": 146,
"is_submittable": 1,
"links": [],
"modified": "2026-02-03 12:27:19.055918",
"modified": "2026-02-10 14:35:08.523130",
"modified_by": "Administrator",
"module": "Stock",
"name": "Delivery Note",