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)
|
_('{0} is blocked so this transaction cannot proceed'.format(supplier_name)), raise_exception=1)
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
|
|
||||||
|
self.validate_qty_is_not_zero()
|
||||||
if self.get("_action") and self._action != "update_after_submit":
|
if self.get("_action") and self._action != "update_after_submit":
|
||||||
self.set_missing_values(for_validate=True)
|
self.set_missing_values(for_validate=True)
|
||||||
|
|
||||||
@ -359,6 +361,11 @@ class AccountsController(TransactionBase):
|
|||||||
|
|
||||||
return gl_dict
|
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):
|
def validate_account_currency(self, account, account_currency=None):
|
||||||
valid_currency = [self.company_currency]
|
valid_currency = [self.company_currency]
|
||||||
if self.get("currency") and self.currency != self.company_currency:
|
if self.get("currency") and self.currency != self.company_currency:
|
||||||
|
@ -32,7 +32,6 @@ class SalesOrder(SellingController):
|
|||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
super(SalesOrder, self).validate()
|
super(SalesOrder, self).validate()
|
||||||
|
|
||||||
self.validate_order_type()
|
self.validate_order_type()
|
||||||
self.validate_delivery_date()
|
self.validate_delivery_date()
|
||||||
self.validate_proj_cust()
|
self.validate_proj_cust()
|
||||||
@ -343,9 +342,11 @@ class SalesOrder(SellingController):
|
|||||||
delivered_qty += item.delivered_qty
|
delivered_qty += item.delivered_qty
|
||||||
tot_qty += item.qty
|
tot_qty += item.qty
|
||||||
|
|
||||||
|
if tot_qty != 0:
|
||||||
self.db_set("per_delivered", flt(delivered_qty/tot_qty) * 100,
|
self.db_set("per_delivered", flt(delivered_qty/tot_qty) * 100,
|
||||||
update_modified=False)
|
update_modified=False)
|
||||||
|
|
||||||
|
|
||||||
def set_indicator(self):
|
def set_indicator(self):
|
||||||
"""Set indicator for portal"""
|
"""Set indicator for portal"""
|
||||||
if self.status == 'Closed':
|
if self.status == 'Closed':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user