Merge pull request #16083 from Anurag810/new-fix-branch
[fix] delivery note with quantity equal 0 #14211
This commit is contained in:
commit
72fc1b57be
@ -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:
|
||||
|
@ -32,7 +32,6 @@ class SalesOrder(SellingController):
|
||||
|
||||
def validate(self):
|
||||
super(SalesOrder, self).validate()
|
||||
|
||||
self.validate_order_type()
|
||||
self.validate_delivery_date()
|
||||
self.validate_proj_cust()
|
||||
@ -342,9 +341,11 @@ class SalesOrder(SellingController):
|
||||
|
||||
delivered_qty += item.delivered_qty
|
||||
tot_qty += item.qty
|
||||
|
||||
self.db_set("per_delivered", flt(delivered_qty/tot_qty) * 100,
|
||||
update_modified=False)
|
||||
|
||||
if tot_qty != 0:
|
||||
self.db_set("per_delivered", flt(delivered_qty/tot_qty) * 100,
|
||||
update_modified=False)
|
||||
|
||||
|
||||
def set_indicator(self):
|
||||
"""Set indicator for portal"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user