diff --git a/erpnext/accounts/doctype/accounts_settings/accounts_settings.json b/erpnext/accounts/doctype/accounts_settings/accounts_settings.json
index c77750cf9f0..d0807f0f551 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_analytical_accounting",
+ "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": "Enable cost center, projects and other custom accounting dimensions",
+ "fieldname": "enable_analytical_accounting",
+ "fieldtype": "Check",
+ "label": "Enable Analytical Accounting"
+ },
+ {
+ "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"
}
],
"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 15:20:03.309843",
"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..8d846119e8d 100644
--- a/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
+++ b/erpnext/accounts/doctype/accounts_settings/accounts_settings.py
@@ -12,6 +12,29 @@ 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 +66,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_analytical_accounting: 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 +124,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_analytical_accounting != self.enable_analytical_accounting:
+ toggle_accounting_dimension_sections(not self.enable_analytical_accounting)
+ 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 +192,32 @@ 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,
+ )
\ No newline at end of file
diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
index 56f043c13ed..66a59a5c0e6 100644
--- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
+++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.json
@@ -99,7 +99,7 @@
"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",
@@ -197,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",
@@ -1076,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",
@@ -1265,7 +1257,6 @@
"read_only": 1
},
{
- "collapsible": 1,
"collapsible_depends_on": "advances",
"fieldname": "advances_section",
"fieldtype": "Section Break",
@@ -1699,10 +1690,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",
@@ -1731,18 +1722,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",
@@ -1786,16 +1765,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",
@@ -2306,6 +2275,36 @@
{
"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,
@@ -2319,7 +2318,7 @@
"link_fieldname": "consolidated_invoice"
}
],
- "modified": "2026-02-04 12:14:56.149710",
+ "modified": "2026-02-04 16:21:54.112633",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice",
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..d7322a48256 100644
--- a/erpnext/selling/doctype/selling_settings/selling_settings.py
+++ b/erpnext/selling/doctype/selling_settings/selling_settings.py
@@ -10,7 +10,6 @@ from frappe.custom.doctype.property_setter.property_setter import make_property_
from frappe.model.document import Document
from frappe.utils import cint
-
class SellingSettings(Document):
# begin: auto-generated types
# This code is auto-generated. Do not modify anything in this block.
@@ -37,6 +36,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 +57,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 +80,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 +180,13 @@ 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 create_property_setter_for_hiding_field, SELLING_DOCTYPES
+
+ 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)
\ No newline at end of file