diff --git a/erpnext/accounts/doctype/gl_entry/gl_entry.py b/erpnext/accounts/doctype/gl_entry/gl_entry.py index c52c86528fd..3abfa176622 100644 --- a/erpnext/accounts/doctype/gl_entry/gl_entry.py +++ b/erpnext/accounts/doctype/gl_entry/gl_entry.py @@ -193,7 +193,6 @@ class GLEntry(Document): account_type == "Profit and Loss" and self.company == dimension.company and dimension.mandatory_for_pl - and not dimension.disabled and not self.is_cancelled ): if not self.get(dimension.fieldname): @@ -207,7 +206,6 @@ class GLEntry(Document): account_type == "Balance Sheet" and self.company == dimension.company and dimension.mandatory_for_bs - and not dimension.disabled and not self.is_cancelled ): if not self.get(dimension.fieldname): diff --git a/erpnext/accounts/doctype/payment_ledger_entry/payment_ledger_entry.py b/erpnext/accounts/doctype/payment_ledger_entry/payment_ledger_entry.py index c1a28d12350..bdc1f929ec8 100644 --- a/erpnext/accounts/doctype/payment_ledger_entry/payment_ledger_entry.py +++ b/erpnext/accounts/doctype/payment_ledger_entry/payment_ledger_entry.py @@ -131,7 +131,6 @@ class PaymentLedgerEntry(Document): account_type == "Profit and Loss" and self.company == dimension.company and dimension.mandatory_for_pl - and not dimension.disabled ): if not self.get(dimension.fieldname): frappe.throw( @@ -144,7 +143,6 @@ class PaymentLedgerEntry(Document): account_type == "Balance Sheet" and self.company == dimension.company and dimension.mandatory_for_bs - and not dimension.disabled ): if not self.get(dimension.fieldname): frappe.throw( diff --git a/erpnext/accounts/general_ledger.py b/erpnext/accounts/general_ledger.py index f3ad258baeb..7c5dcedaf74 100644 --- a/erpnext/accounts/general_ledger.py +++ b/erpnext/accounts/general_ledger.py @@ -14,6 +14,7 @@ from frappe.utils.dashboard import cache_source import erpnext from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import ( get_accounting_dimensions, + get_checks_for_pl_and_bs_accounts, ) from erpnext.accounts.doctype.accounting_dimension_filter.accounting_dimension_filter import ( get_dimension_filter_map, @@ -628,6 +629,18 @@ def update_accounting_dimensions(round_off_gle): for dimension in dimensions: round_off_gle[dimension] = dimension_values.get(dimension) + else: + report_type = frappe.get_cached_value("Account", round_off_gle.account, "report_type") + for dimension in get_checks_for_pl_and_bs_accounts(): + if ( + round_off_gle.company == dimension.company + and ( + (report_type == "Profit and Loss" and dimension.mandatory_for_pl) + or (report_type == "Balance Sheet" and dimension.mandatory_for_bs) + ) + and dimension.default_dimension + ): + round_off_gle[dimension.fieldname] = dimension.default_dimension def get_round_off_account_and_cost_center(company, voucher_type, voucher_no, use_company_default=False):