diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index 576921a530..cd40d61956 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -21,6 +21,10 @@ from webnotes.utils import flt from utilities.transaction_base import TransactionBase class AccountsController(TransactionBase): + def validate(self): + if self.meta.get_field("grand_total"): + self.validate_value("grand_total", ">=", 0) + def get_gl_dict(self, args, cancel=None): """this method populates the common properties of a gl entry record""" if cancel is None: diff --git a/controllers/buying_controller.py b/controllers/buying_controller.py index 2f3128c98c..0509de0074 100644 --- a/controllers/buying_controller.py +++ b/controllers/buying_controller.py @@ -27,7 +27,8 @@ from webnotes.model.utils import round_floats_in_doc from controllers.accounts_controller import AccountsController class BuyingController(AccountsController): - def validate(self): + def validate(self): + super(BuyingController, self).validate() if self.meta.get_field("currency"): self.company_currency = get_company_currency(self.doc.company) self.validate_conversion_rate("currency", "conversion_rate") @@ -37,7 +38,7 @@ class BuyingController(AccountsController): # IMPORTANT: enable this only when client side code is similar to this one # self.calculate_taxes_and_totals() - + # set total in words self.set_total_in_words() diff --git a/controllers/selling_controller.py b/controllers/selling_controller.py index 40606c3198..9db8f4acad 100644 --- a/controllers/selling_controller.py +++ b/controllers/selling_controller.py @@ -23,6 +23,7 @@ from controllers.accounts_controller import AccountsController class SellingController(AccountsController): def validate(self): + super(SellingController, self).validate() self.set_total_in_words() def set_total_in_words(self):