diff --git a/erpnext/accounts/doctype/pos_profile/pos_profile.py b/erpnext/accounts/doctype/pos_profile/pos_profile.py index 343ddb82e2d484a2e6c790fd3de37226270a014d..47dd42e5fd514293f96e99ad37bce25a564163f9 100644 --- a/erpnext/accounts/doctype/pos_profile/pos_profile.py +++ b/erpnext/accounts/doctype/pos_profile/pos_profile.py @@ -7,6 +7,10 @@ from frappe import _, msgprint, scrub, unscrub from frappe.model.document import Document from frappe.utils import get_link_to_form, now +from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import ( + get_checks_for_pl_and_bs_accounts, +) + class POSProfile(Document): # begin: auto-generated types @@ -72,9 +76,13 @@ class POSProfile(Document): self.validate_accounting_dimensions() def validate_accounting_dimensions(self): - acc_dim_names = required_accounting_dimensions() - for acc_dim in acc_dim_names: - if not self.get(acc_dim): + acc_dims = get_checks_for_pl_and_bs_accounts() + for acc_dim in acc_dims: + if ( + self.company == acc_dim.company + and not self.get(acc_dim.fieldname) + and (acc_dim.mandatory_for_pl or acc_dim.mandatory_for_bs) + ): frappe.throw( _( "{0} is a mandatory Accounting Dimension.
"