mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-04 12:49:10 +00:00
* fix: `ZeroDivisionError: float division by zero` in SCR (cherry picked from commit434aa594d5) * chore: add row-index in error msgs (cherry picked from commit6878f40d1d) * chore: update error msgs for Subcontracted PO (cherry picked from commita0e2a93f3f) * fix: validate accepted and rejected qty in SCR Item (cherry picked from commitf028bd6e69) * chore: linter (cherry picked from commitb26e96cdf4) Co-authored-by: s-aga-r <sagarsharma.s312@gmail.com>
This commit is contained in:
@@ -57,6 +57,7 @@ class SubcontractingReceipt(SubcontractingController):
|
||||
|
||||
def before_validate(self):
|
||||
super(SubcontractingReceipt, self).before_validate()
|
||||
self.validate_items_qty()
|
||||
self.set_items_bom()
|
||||
self.set_items_cost_center()
|
||||
self.set_items_expense_account()
|
||||
@@ -157,7 +158,7 @@ class SubcontractingReceipt(SubcontractingController):
|
||||
|
||||
total_qty = total_amount = 0
|
||||
for item in self.items:
|
||||
if item.name in rm_supp_cost:
|
||||
if item.qty and item.name in rm_supp_cost:
|
||||
item.rm_supp_cost = rm_supp_cost[item.name]
|
||||
item.rm_cost_per_qty = item.rm_supp_cost / item.qty
|
||||
rm_supp_cost.pop(item.name)
|
||||
@@ -194,6 +195,13 @@ class SubcontractingReceipt(SubcontractingController):
|
||||
).format(item.idx)
|
||||
)
|
||||
|
||||
def validate_items_qty(self):
|
||||
for item in self.items:
|
||||
if not (item.qty or item.rejected_qty):
|
||||
frappe.throw(
|
||||
_("Row {0}: Accepted Qty and Rejected Qty can't be zero at the same time.").format(item.idx)
|
||||
)
|
||||
|
||||
def set_items_bom(self):
|
||||
if self.is_return:
|
||||
for item in self.items:
|
||||
|
||||
Reference in New Issue
Block a user