From e1116bbbbb6987e37d940f1f00e3e334ed0101d0 Mon Sep 17 00:00:00 2001 From: Nikhil Kothari Date: Wed, 7 Jun 2023 14:20:42 +0530 Subject: [PATCH] fix: added server side check for allow/restrict --- .../accounting_dimension_filter.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.py b/erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.py index c0573a703c..2a6c76dd4a 100644 --- a/erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.py +++ b/erpnext/accounts/doctype/accounting_dimension_filter/accounting_dimension_filter.py @@ -8,6 +8,13 @@ from frappe.model.document import Document class AccountingDimensionFilter(Document): + + def before_save(self): + # If restriction is not applied on values, then remove all the dimensions and set allow_or_restrict to Restrict + if not self.apply_restriction_on_values: + self.allow_or_restrict = "Restrict" + self.set('dimensions', []) + def validate(self): self.validate_applicable_accounts()