mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-12 19:35:09 +00:00
Merge pull request #52950 from frappe/mergify/bp/version-16-hotfix/pr-52507
refactor: toggle for UTM parameters (backport #52507)
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
"disabled",
|
||||
"column_break_9",
|
||||
"warehouse",
|
||||
"utm_source",
|
||||
"utm_campaign",
|
||||
"utm_medium",
|
||||
"company_address",
|
||||
"section_break_15",
|
||||
"applicable_for_users",
|
||||
@@ -61,7 +58,13 @@
|
||||
"accounting_dimensions_section",
|
||||
"cost_center",
|
||||
"dimension_col_break",
|
||||
"project"
|
||||
"project",
|
||||
"utm_analytics_section",
|
||||
"utm_source",
|
||||
"column_break_tvls",
|
||||
"utm_campaign",
|
||||
"column_break_xygw",
|
||||
"utm_medium"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@@ -430,6 +433,20 @@
|
||||
"fieldname": "allow_partial_payment",
|
||||
"fieldtype": "Check",
|
||||
"label": "Allow Partial Payment"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_tvls",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_xygw",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"collapsible": 1,
|
||||
"fieldname": "utm_analytics_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Campaign"
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
@@ -458,7 +475,7 @@
|
||||
"link_fieldname": "pos_profile"
|
||||
}
|
||||
],
|
||||
"modified": "2025-06-24 11:19:19.834905",
|
||||
"modified": "2026-02-10 14:24:48.597412",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "POS Profile",
|
||||
|
||||
@@ -219,16 +219,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",
|
||||
@@ -1632,13 +1633,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",
|
||||
@@ -2313,6 +2307,16 @@
|
||||
{
|
||||
"fieldname": "column_break_rdks",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_ixxw",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"collapsible": 1,
|
||||
"fieldname": "utm_analytics_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "UTM Analytics"
|
||||
}
|
||||
],
|
||||
"grid_page_length": 50,
|
||||
@@ -2326,7 +2330,7 @@
|
||||
"link_fieldname": "consolidated_invoice"
|
||||
}
|
||||
],
|
||||
"modified": "2026-02-23 14:29:00.301842",
|
||||
"modified": "2026-02-10 11:59:07.819903",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -123,19 +123,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": [
|
||||
@@ -862,13 +863,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",
|
||||
@@ -1117,13 +1111,23 @@
|
||||
"no_copy": 1,
|
||||
"options": "Item Wise Tax Detail",
|
||||
"print_hide": 1
|
||||
},
|
||||
{
|
||||
"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-01-29 21:18:48.836168",
|
||||
"modified": "2026-02-06 17:34:22.170032",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Quotation",
|
||||
|
||||
@@ -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-23 14:25:56.665392",
|
||||
"modified": "2026-02-10 11:55:52.796522",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Sales Order",
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -156,17 +156,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",
|
||||
@@ -1366,10 +1367,6 @@
|
||||
"options": "Delivery Trip",
|
||||
"print_hide": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_pxls",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "utm_medium",
|
||||
"fieldtype": "Link",
|
||||
@@ -1438,7 +1435,13 @@
|
||||
"options": "Company:company:default_currency"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_ydwe",
|
||||
"collapsible": 1,
|
||||
"fieldname": "utm_analytics_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "UTM Analytics"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_neoj",
|
||||
"fieldtype": "Column Break"
|
||||
}
|
||||
],
|
||||
@@ -1446,7 +1449,7 @@
|
||||
"idx": 146,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2026-02-23 23:05:39.097097",
|
||||
"modified": "2026-02-10 14:35:08.523130",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Delivery Note",
|
||||
|
||||
Reference in New Issue
Block a user