diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json index c77750cf9f0..fc3845baf01 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json @@ -20,6 +20,10 @@ "enable_common_party_accounting", "allow_multi_currency_invoices_against_single_party_account", "confirm_before_resetting_posting_date", + "analytics_section", + "enable_accounting_dimensions", + "column_break_vtnr", + "enable_discounts_and_margin", "journals_section", "merge_similar_account_heads", "deferred_accounting_settings_section", @@ -51,12 +55,16 @@ "allow_pegged_currencies_exchange_rates", "column_break_yuug", "stale_days", + "payments_tab", "section_break_jpd0", "auto_reconcile_payments", "auto_reconciliation_job_trigger", "reconciliation_queue_size", "column_break_resa", "exchange_gain_loss_posting_date", + "payment_options_section", + "enable_loyalty_point_program", + "column_break_ctam", "invoicing_settings_tab", "accounts_transactions_settings_section", "over_billing_allowance", @@ -281,7 +289,7 @@ }, { "default": "0", - "description": "Learn about Common Party", + "description": "Learn about Common Party", "fieldname": "enable_common_party_accounting", "fieldtype": "Check", "label": "Enable Common Party Accounting" @@ -637,6 +645,49 @@ "fieldname": "budget_section", "fieldtype": "Section Break", "label": "Budget" + }, + { + "fieldname": "analytics_section", + "fieldtype": "Section Break", + "label": "Analytical Accounting" + }, + { + "fieldname": "column_break_vtnr", + "fieldtype": "Column Break" + }, + { + "default": "0", + "description": "Apply discounts and margins on products", + "fieldname": "enable_discounts_and_margin", + "fieldtype": "Check", + "label": "Enable Discounts and Margin" + }, + { + "fieldname": "payments_tab", + "fieldtype": "Tab Break", + "label": "Payments" + }, + { + "fieldname": "payment_options_section", + "fieldtype": "Section Break", + "label": "Payment Options" + }, + { + "default": "0", + "fieldname": "enable_loyalty_point_program", + "fieldtype": "Check", + "label": "Enable Loyalty Point Program" + }, + { + "fieldname": "column_break_ctam", + "fieldtype": "Column Break" + }, + { + "default": "0", + "description": "Enable cost center, projects and other custom accounting dimensions", + "fieldname": "enable_accounting_dimensions", + "fieldtype": "Check", + "label": "Enable Accounting Dimensions" } ], "grid_page_length": 50, @@ -646,7 +697,7 @@ "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2026-01-11 18:30:45.968531", + "modified": "2026-02-04 17:15:38.609327", "modified_by": "Administrator", "module": "Accounts", "name": "Accounts Settings", diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py index dbe86f6d7b2..e75b8ad1710 100644 --- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py +++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py @@ -12,6 +12,28 @@ from frappe.utils import cint from erpnext.accounts.utils import sync_auto_reconcile_config +SELLING_DOCTYPES = [ + "Sales Invoice", + "Sales Order", + "Delivery Note", + "Quotation", + "Sales Invoice Item", + "Sales Order Item", + "Delivery Note Item", + "Quotation Item", + "POS Invoice", + "POS Invoice Item", +] + +BUYING_DOCTYPES = [ + "Purchase Invoice", + "Purchase Order", + "Purchase Receipt", + "Purchase Invoice Item", + "Purchase Order Item", + "Purchase Receipt Item", +] + class AccountsSettings(Document): # begin: auto-generated types @@ -43,9 +65,12 @@ class AccountsSettings(Document): default_ageing_range: DF.Data | None delete_linked_ledger_entries: DF.Check determine_address_tax_category_from: DF.Literal["Billing Address", "Shipping Address"] + enable_accounting_dimensions: DF.Check enable_common_party_accounting: DF.Check + enable_discounts_and_margin: DF.Check enable_fuzzy_matching: DF.Check enable_immutable_ledger: DF.Check + enable_loyalty_point_program: DF.Check enable_party_matching: DF.Check exchange_gain_loss_posting_date: DF.Literal["Invoice", "Payment", "Reconciliation Date"] fetch_valuation_rate_for_internal_transaction: DF.Check @@ -98,6 +123,18 @@ class AccountsSettings(Document): if old_doc.show_payment_schedule_in_print != self.show_payment_schedule_in_print: self.enable_payment_schedule_in_print() + if old_doc.enable_accounting_dimensions != self.enable_accounting_dimensions: + toggle_accounting_dimension_sections(not self.enable_accounting_dimensions) + clear_cache = True + + if old_doc.enable_discounts_and_margin != self.enable_discounts_and_margin: + toggle_sales_discount_section(not self.enable_discounts_and_margin) + clear_cache = True + + if old_doc.enable_loyalty_point_program != self.enable_loyalty_point_program: + toggle_loyalty_point_program_section(not self.enable_loyalty_point_program) + clear_cache = True + if clear_cache: frappe.clear_cache() @@ -154,3 +191,36 @@ class AccountsSettings(Document): frappe.db.sql(f"drop procedure if exists {InitSQLProceduresForAR.init_procedure_name}") frappe.db.sql(f"drop procedure if exists {InitSQLProceduresForAR.allocate_procedure_name}") + + +def toggle_accounting_dimension_sections(hide): + accounting_dimension_doctypes = frappe.get_hooks("accounting_dimension_doctypes") + for doctype in accounting_dimension_doctypes: + create_property_setter_for_hiding_field(doctype, "accounting_dimensions_section", hide) + + +def toggle_sales_discount_section(hide): + for doctype in SELLING_DOCTYPES + BUYING_DOCTYPES: + meta = frappe.get_meta(doctype) + if meta.has_field("additional_discount_section"): + create_property_setter_for_hiding_field(doctype, "additional_discount_section", hide) + if meta.has_field("discount_and_margin"): + create_property_setter_for_hiding_field(doctype, "discount_and_margin", hide) + + +def toggle_loyalty_point_program_section(hide): + for doctype in SELLING_DOCTYPES: + meta = frappe.get_meta(doctype) + if meta.has_field("loyalty_points_redemption"): + create_property_setter_for_hiding_field(doctype, "loyalty_points_redemption", hide) + + +def create_property_setter_for_hiding_field(doctype, field_name, hide): + make_property_setter( + doctype, + field_name, + "hidden", + hide, + "Check", + validate_fields_for_doctype=False, + ) diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json index 93e4dd1598f..fabb2d75f49 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json @@ -78,34 +78,36 @@ "base_total_taxes_and_charges", "column_break_47", "total_taxes_and_charges", - "totals", - "base_grand_total", - "base_rounding_adjustment", - "base_rounded_total", - "base_in_words", - "column_break5", + "totals_section", "grand_total", "rounding_adjustment", - "use_company_roundoff_cost_center", - "rounded_total", "in_words", + "column_break5", + "rounded_total", + "disable_rounded_total", "total_advance", "outstanding_amount", - "disable_rounded_total", + "use_company_roundoff_cost_center", + "base_totals_section", + "base_grand_total", + "base_rounding_adjustment", + "base_in_words", + "column_break_xjag", + "base_rounded_total", "section_tax_withholding_entry", "tax_withholding_group", "ignore_tax_withholding_threshold", "override_tax_withholding_entries", "tax_withholding_entries", - "section_break_49", + "additional_discount_section", "apply_discount_on", "base_discount_amount", "coupon_code", - "is_cash_or_non_trade_discount", - "additional_discount_account", "column_break_51", "additional_discount_percentage", "discount_amount", + "is_cash_or_non_trade_discount", + "additional_discount_account", "sec_tax_breakup", "other_charges_calculation", "item_wise_tax_details", @@ -195,13 +197,13 @@ "column_break8", "unrealized_profit_loss_account", "against_income_account", - "sales_team_section_break", + "commission_section", "sales_partner", "amount_eligible_for_commission", "column_break10", "commission_rate", "total_commission", - "section_break2", + "sales_team_section", "sales_team", "edit_printing_settings", "letter_head", @@ -218,8 +220,7 @@ "update_auto_repeat_reference", "more_information", "status", - "inter_company_invoice_reference", - "represents_company", + "remarks", "customer_group", "column_break_imbx", "utm_source", @@ -228,8 +229,9 @@ "utm_content", "col_break23", "is_internal_customer", + "represents_company", + "inter_company_invoice_reference", "is_discounted", - "remarks", "connections_tab" ], "fields": [ @@ -794,7 +796,8 @@ "hide_seconds": 1, "label": "Time Sheets", "options": "Sales Invoice Timesheet", - "print_hide": 1 + "print_hide": 1, + "read_only": 1 }, { "default": "0", @@ -1073,14 +1076,6 @@ "no_copy": 1, "options": "Cost Center" }, - { - "collapsible": 1, - "fieldname": "section_break_49", - "fieldtype": "Section Break", - "hide_days": 1, - "hide_seconds": 1, - "label": "Additional Discount" - }, { "default": "Grand Total", "fieldname": "apply_discount_on", @@ -1125,22 +1120,12 @@ "options": "currency", "print_hide": 1 }, - { - "fieldname": "totals", - "fieldtype": "Section Break", - "hide_days": 1, - "hide_seconds": 1, - "label": "Totals", - "oldfieldtype": "Section Break", - "options": "fa fa-money", - "print_hide": 1 - }, { "fieldname": "base_grand_total", "fieldtype": "Currency", "hide_days": 1, "hide_seconds": 1, - "label": "Grand Total (Company Currency)", + "label": "Grand Total (Company Currency", "oldfieldname": "grand_total", "oldfieldtype": "Currency", "options": "Company:company:default_currency", @@ -1154,9 +1139,8 @@ "fieldtype": "Currency", "hide_days": 1, "hide_seconds": 1, - "label": "Rounding Adjustment (Company Currency)", + "label": "Rounding Adjustment", "no_copy": 1, - "options": "Company:company:default_currency", "print_hide": 1, "read_only": 1 }, @@ -1166,10 +1150,9 @@ "fieldtype": "Currency", "hide_days": 1, "hide_seconds": 1, - "label": "Rounded Total (Company Currency)", + "label": "Rounded Total", "oldfieldname": "rounded_total", "oldfieldtype": "Currency", - "options": "Company:company:default_currency", "print_hide": 1, "read_only": 1 }, @@ -1179,7 +1162,7 @@ "fieldtype": "Small Text", "hide_days": 1, "hide_seconds": 1, - "label": "In Words (Company Currency)", + "label": "In Words", "length": 240, "oldfieldname": "in_words", "oldfieldtype": "Data", @@ -1272,7 +1255,6 @@ "read_only": 1 }, { - "collapsible": 1, "collapsible_depends_on": "advances", "fieldname": "advances_section", "fieldtype": "Section Break", @@ -1706,10 +1688,10 @@ "read_only": 1 }, { - "allow_on_submit": 1, "default": "No", "fieldname": "is_opening", "fieldtype": "Select", + "hidden": 1, "hide_days": 1, "hide_seconds": 1, "label": "Is Opening Entry", @@ -1738,18 +1720,6 @@ "oldfieldtype": "Text", "print_hide": 1 }, - { - "collapsible": 1, - "collapsible_depends_on": "sales_partner", - "fieldname": "sales_team_section_break", - "fieldtype": "Section Break", - "hide_days": 1, - "hide_seconds": 1, - "label": "Commission", - "oldfieldtype": "Section Break", - "options": "fa fa-group", - "print_hide": 1 - }, { "fieldname": "sales_partner", "fieldtype": "Link", @@ -1793,16 +1763,6 @@ "options": "Company:company:default_currency", "print_hide": 1 }, - { - "collapsible": 1, - "collapsible_depends_on": "sales_team", - "fieldname": "section_break2", - "fieldtype": "Section Break", - "hide_days": 1, - "hide_seconds": 1, - "label": "Sales Team", - "print_hide": 1 - }, { "allow_on_submit": 1, "fieldname": "sales_team", @@ -2293,6 +2253,56 @@ "fieldname": "override_tax_withholding_entries", "fieldtype": "Check", "label": "Edit Tax Withholding Entries" + }, + { + "fieldname": "totals_section", + "fieldtype": "Section Break", + "hide_days": 1, + "hide_seconds": 1, + "label": "Totals", + "oldfieldtype": "Section Break", + "options": "fa fa-money", + "print_hide": 1 + }, + { + "fieldname": "base_totals_section", + "fieldtype": "Section Break", + "label": "Totals (Company Currency)", + "options": "Company:company:default_currency" + }, + { + "fieldname": "column_break_xjag", + "fieldtype": "Column Break" + }, + { + "collapsible": 1, + "fieldname": "additional_discount_section", + "fieldtype": "Section Break", + "hide_days": 1, + "hide_seconds": 1, + "label": "Additional Discount" + }, + { + "collapsible": 1, + "collapsible_depends_on": "sales_team", + "fieldname": "sales_team_section", + "fieldtype": "Section Break", + "hide_days": 1, + "hide_seconds": 1, + "label": "Sales Team", + "print_hide": 1 + }, + { + "collapsible": 1, + "collapsible_depends_on": "sales_partner", + "fieldname": "commission_section", + "fieldtype": "Section Break", + "hide_days": 1, + "hide_seconds": 1, + "label": "Commission", + "oldfieldtype": "Section Break", + "options": "fa fa-group", + "print_hide": 1 } ], "grid_page_length": 50, @@ -2306,7 +2316,7 @@ "link_fieldname": "consolidated_invoice" } ], - "modified": "2026-02-03 14:09:44.347133", + "modified": "2026-02-04 17:34:42.040540", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice", diff --git a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json index 7608ea87de8..dda046172f2 100644 --- a/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json +++ b/erpnext/accounts/doctype/sales_invoice_item/sales_invoice_item.json @@ -1009,7 +1009,7 @@ "idx": 1, "istable": 1, "links": [], - "modified": "2025-09-04 11:08:25.583561", + "modified": "2026-02-02 16:46:12.597972", "modified_by": "Administrator", "module": "Accounts", "name": "Sales Invoice Item", diff --git a/erpnext/buying/doctype/supplier/supplier.json b/erpnext/buying/doctype/supplier/supplier.json index a801a2a601d..a75fc84b3fb 100644 --- a/erpnext/buying/doctype/supplier/supplier.json +++ b/erpnext/buying/doctype/supplier/supplier.json @@ -12,10 +12,11 @@ "field_order": [ "naming_series", "supplier_name", - "country", + "supplier_type", + "gender", "column_break0", "supplier_group", - "supplier_type", + "country", "is_transporter", "image", "defaults_section", @@ -62,8 +63,8 @@ "allow_purchase_invoice_creation_without_purchase_order", "allow_purchase_invoice_creation_without_purchase_receipt", "column_break_54", - "is_frozen", "disabled", + "is_frozen", "warn_rfqs", "warn_pos", "prevent_rfqs", @@ -74,8 +75,7 @@ "column_break_59", "release_date", "portal_users_tab", - "portal_users", - "column_break_1mqv" + "portal_users" ], "fields": [ { @@ -468,10 +468,6 @@ "label": "Supplier Portal Users", "options": "Portal User" }, - { - "fieldname": "column_break_1mqv", - "fieldtype": "Column Break" - }, { "fieldname": "column_break_mglr", "fieldtype": "Column Break" @@ -487,6 +483,13 @@ "fieldtype": "Link", "label": "Tax Withholding Group", "options": "Tax Withholding Group" + }, + { + "depends_on": "eval:doc.supplier_type == 'Individual'", + "fieldname": "gender", + "fieldtype": "Link", + "label": "Gender", + "options": "Gender" } ], "grid_page_length": 50, @@ -500,7 +503,7 @@ "link_fieldname": "party" } ], - "modified": "2026-01-16 15:56:31.139206", + "modified": "2026-02-02 12:36:51.566439", "modified_by": "Administrator", "module": "Buying", "name": "Supplier", diff --git a/erpnext/buying/doctype/supplier/supplier.py b/erpnext/buying/doctype/supplier/supplier.py index 543b3726089..3146246fc1c 100644 --- a/erpnext/buying/doctype/supplier/supplier.py +++ b/erpnext/buying/doctype/supplier/supplier.py @@ -49,6 +49,7 @@ class Supplier(TransactionBase): default_price_list: DF.Link | None disabled: DF.Check email_id: DF.ReadOnly | None + gender: DF.Link | None hold_type: DF.Literal["", "All", "Invoices", "Payments"] image: DF.AttachImage | None is_frozen: DF.Check diff --git a/erpnext/public/js/controllers/transaction.js b/erpnext/public/js/controllers/transaction.js index f7a53709f79..7bcacf8a81a 100644 --- a/erpnext/public/js/controllers/transaction.js +++ b/erpnext/public/js/controllers/transaction.js @@ -1748,6 +1748,7 @@ erpnext.TransactionController = class TransactionController extends erpnext.taxe "base_raw_material_cost", "base_total_cost", "base_scrap_material_cost", + "base_rounding_adjustment", "base_totals_section", ], company_currency diff --git a/erpnext/selling/doctype/customer/customer.json b/erpnext/selling/doctype/customer/customer.json index babd09a5591..360f5861d7b 100644 --- a/erpnext/selling/doctype/customer/customer.json +++ b/erpnext/selling/doctype/customer/customer.json @@ -12,38 +12,18 @@ "field_order": [ "basic_info", "naming_series", - "salutation", - "customer_name", "customer_type", - "customer_group", - "column_break0", - "territory", + "customer_name", "gender", - "lead_name", - "opportunity_name", - "prospect_name", - "account_manager", + "column_break0", + "customer_group", + "territory", "image", "defaults_tab", "default_currency", "default_bank_account", "column_break_14", "default_price_list", - "internal_customer_section", - "is_internal_customer", - "represents_company", - "column_break_70", - "companies", - "more_info", - "market_segment", - "industry", - "customer_pos_id", - "website", - "language", - "column_break_45", - "customer_details", - "supplier_numbers", - "dashboard_tab", "contact_and_address_tab", "address_contacts", "address_html", @@ -67,16 +47,22 @@ "tax_withholding_category", "tax_withholding_group", "accounting_tab", + "default_receivable_accounts", + "accounts", "credit_limit_section", "payment_terms", "credit_limits", - "default_receivable_accounts", - "accounts", + "internal_customer_section", + "is_internal_customer", + "represents_company", + "column_break_70", + "companies", "loyalty_points_tab", "loyalty_program", "column_break_54", "loyalty_program_tier", "sales_team_tab", + "account_manager", "sales_team", "sales_team_section", "default_sales_partner", @@ -86,10 +72,27 @@ "so_required", "dn_required", "column_break_53", - "is_frozen", "disabled", + "is_frozen", "portal_users_tab", - "portal_users" + "portal_users", + "more_info_tab", + "references_section", + "lead_name", + "opportunity_name", + "column_break_wlbg", + "prospect_name", + "section_break_objq", + "market_segment", + "industry", + "website", + "language", + "customer_pos_id", + "column_break_hdmn", + "customer_details", + "supplier_numbers_section", + "supplier_numbers", + "connections_tab" ], "fields": [ { @@ -106,13 +109,6 @@ "options": "CUST-.YYYY.-", "set_only_once": 1 }, - { - "depends_on": "eval:doc.customer_type!='Company'", - "fieldname": "salutation", - "fieldtype": "Link", - "label": "Salutation", - "options": "Salutation" - }, { "bold": 1, "fieldname": "customer_name", @@ -126,7 +122,7 @@ "search_index": 1 }, { - "depends_on": "eval:doc.customer_type != 'Company'", + "depends_on": "eval:doc.customer_type == 'Individual'", "fieldname": "gender", "fieldtype": "Link", "label": "Gender", @@ -151,12 +147,13 @@ { "fieldname": "lead_name", "fieldtype": "Link", - "label": "From Lead", + "label": "Lead", "no_copy": 1, "oldfieldname": "lead_name", "oldfieldtype": "Link", "options": "Lead", "print_hide": 1, + "read_only": 1, "report_hide": 1 }, { @@ -363,15 +360,6 @@ "label": "Default Payment Terms Template", "options": "Payment Terms Template" }, - { - "collapsible": 1, - "collapsible_depends_on": "customer_details", - "fieldname": "more_info", - "fieldtype": "Section Break", - "label": "More Information", - "oldfieldtype": "Section Break", - "options": "fa fa-file-text" - }, { "description": "Additional information regarding the customer.", "fieldname": "customer_details", @@ -380,10 +368,6 @@ "oldfieldname": "customer_details", "oldfieldtype": "Code" }, - { - "fieldname": "column_break_45", - "fieldtype": "Column Break" - }, { "fieldname": "market_segment", "fieldtype": "Link", @@ -449,7 +433,7 @@ { "fieldname": "customer_pos_id", "fieldtype": "Data", - "label": "Customer POS id", + "label": "Customer POS ID", "no_copy": 1, "print_hide": 1, "read_only": 1, @@ -482,10 +466,11 @@ { "fieldname": "opportunity_name", "fieldtype": "Link", - "label": "From Opportunity", + "label": "Opportunity", "no_copy": 1, "options": "Opportunity", - "print_hide": 1 + "print_hide": 1, + "read_only": 1 }, { "fieldname": "contact_and_address_tab", @@ -519,12 +504,6 @@ "fieldname": "column_break_21", "fieldtype": "Column Break" }, - { - "fieldname": "dashboard_tab", - "fieldtype": "Tab Break", - "label": "Dashboard", - "show_dashboard": 1 - }, { "fieldname": "column_break_53", "fieldtype": "Column Break" @@ -554,7 +533,7 @@ "collapsible_depends_on": "is_internal_customer", "fieldname": "internal_customer_section", "fieldtype": "Section Break", - "label": "Internal Customer" + "label": "Internal Customer Accounting" }, { "fieldname": "column_break_70", @@ -582,10 +561,11 @@ { "fieldname": "prospect_name", "fieldtype": "Link", - "label": "From Prospect", + "label": "Prospect", "no_copy": 1, "options": "Prospect", - "print_hide": 1 + "print_hide": 1, + "read_only": 1 }, { "fetch_from": "customer_primary_contact.first_name", @@ -613,6 +593,39 @@ "fieldtype": "Link", "label": "Tax Withholding Group", "options": "Tax Withholding Group" + }, + { + "fieldname": "more_info_tab", + "fieldtype": "Tab Break", + "label": "More Info" + }, + { + "fieldname": "references_section", + "fieldtype": "Section Break", + "label": "References" + }, + { + "fieldname": "column_break_wlbg", + "fieldtype": "Column Break" + }, + { + "fieldname": "section_break_objq", + "fieldtype": "Section Break" + }, + { + "fieldname": "column_break_hdmn", + "fieldtype": "Column Break" + }, + { + "fieldname": "connections_tab", + "fieldtype": "Tab Break", + "label": "Connections", + "show_dashboard": 1 + }, + { + "fieldname": "supplier_numbers_section", + "fieldtype": "Section Break", + "label": "Supplier Numbers" } ], "icon": "fa fa-user", @@ -626,7 +639,7 @@ "link_fieldname": "party" } ], - "modified": "2026-01-21 17:23:42.151114", + "modified": "2026-02-02 15:39:55.920831", "modified_by": "Administrator", "module": "Selling", "name": "Customer", diff --git a/erpnext/selling/doctype/customer/customer.py b/erpnext/selling/doctype/customer/customer.py index b1bacee663b..d5e44e41a7f 100644 --- a/erpnext/selling/doctype/customer/customer.py +++ b/erpnext/selling/doctype/customer/customer.py @@ -87,7 +87,6 @@ class Customer(TransactionBase): prospect_name: DF.Link | None represents_company: DF.Link | None sales_team: DF.Table[SalesTeam] - salutation: DF.Link | None so_required: DF.Check supplier_numbers: DF.Table[SupplierNumberAtCustomer] tax_category: DF.Link | None diff --git a/erpnext/selling/doctype/selling_settings/selling_settings.json b/erpnext/selling/doctype/selling_settings/selling_settings.json index c98bba45b6d..9fe14ae2a98 100644 --- a/erpnext/selling/doctype/selling_settings/selling_settings.json +++ b/erpnext/selling/doctype/selling_settings/selling_settings.json @@ -29,6 +29,7 @@ "dn_required", "sales_update_frequency", "blanket_order_allowance", + "enable_tracking_sales_commissions", "column_break_5", "allow_multiple_items", "allow_against_multiple_purchase_orders", @@ -297,6 +298,13 @@ "fieldname": "set_zero_rate_for_expired_batch", "fieldtype": "Check", "label": "Set Incoming Rate as Zero for Expired Batch" + }, + { + "default": "0", + "description": "Manage sales partner's and sales team's commissions", + "fieldname": "enable_tracking_sales_commissions", + "fieldtype": "Check", + "label": "Enable tracking sales commissions" } ], "grid_page_length": 50, @@ -306,7 +314,7 @@ "index_web_pages_for_search": 1, "issingle": 1, "links": [], - "modified": "2026-01-23 00:04:33.105916", + "modified": "2026-02-04 16:16:57.618127", "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 239230de895..775b5844c3e 100644 --- a/erpnext/selling/doctype/selling_settings/selling_settings.py +++ b/erpnext/selling/doctype/selling_settings/selling_settings.py @@ -37,6 +37,7 @@ class SellingSettings(Document): editable_price_list_rate: DF.Check enable_cutoff_date_on_bulk_delivery_note_creation: DF.Check enable_discount_accounting: DF.Check + enable_tracking_sales_commissions: DF.Check fallback_to_default_price_list: DF.Check hide_tax_id: DF.Check maintain_same_rate_action: DF.Literal["Stop", "Warn"] @@ -57,6 +58,8 @@ class SellingSettings(Document): self.toggle_discount_accounting_fields() def validate(self): + old_doc = self.get_doc_before_save() + for key in [ "cust_master_name", "customer_group", @@ -78,6 +81,9 @@ class SellingSettings(Document): self.validate_fallback_to_default_price_list() + if old_doc.enable_tracking_sales_commissions != self.enable_tracking_sales_commissions: + toggle_tracking_sales_commissions_section(not self.enable_tracking_sales_commissions) + def validate_fallback_to_default_price_list(self): if ( self.fallback_to_default_price_list @@ -175,3 +181,17 @@ class SellingSettings(Document): "Code", validate_fields_for_doctype=False, ) + + +def toggle_tracking_sales_commissions_section(hide): + from erpnext.accounts.doctype.accounts_settings.accounts_settings import ( + SELLING_DOCTYPES, + create_property_setter_for_hiding_field, + ) + + for doctype in SELLING_DOCTYPES: + meta = frappe.get_meta(doctype) + if meta.has_field("commission_section"): + 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)