making validation generic for sales order,sales invoice,purchase order etc.
This commit is contained in:
@@ -57,6 +57,8 @@ class AccountsController(TransactionBase):
|
||||
_('{0} is blocked so this transaction cannot proceed'.format(supplier_name)), raise_exception=1)
|
||||
|
||||
def validate(self):
|
||||
|
||||
self.validate_qty_is_not_zero()
|
||||
if self.get("_action") and self._action != "update_after_submit":
|
||||
self.set_missing_values(for_validate=True)
|
||||
|
||||
@@ -359,6 +361,11 @@ class AccountsController(TransactionBase):
|
||||
|
||||
return gl_dict
|
||||
|
||||
def validate_qty_is_not_zero(self):
|
||||
for item in self.items:
|
||||
if not item.qty:
|
||||
frappe.throw("Item quantity can not be zero")
|
||||
|
||||
def validate_account_currency(self, account, account_currency=None):
|
||||
valid_currency = [self.company_currency]
|
||||
if self.get("currency") and self.currency != self.company_currency:
|
||||
|
||||
Reference in New Issue
Block a user