From f028bd6e69a571d0053f124334a0021904a7f365 Mon Sep 17 00:00:00 2001 From: s-aga-r Date: Thu, 12 Jan 2023 12:23:40 +0530 Subject: [PATCH] fix: validate accepted and rejected qty in SCR Item --- .../subcontracting_receipt/subcontracting_receipt.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py index 4436c1f1e1e..dd4ae04c165 100644 --- a/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py +++ b/erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.py @@ -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() @@ -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( + _(f"Row {item.idx}: Accepted Qty and Rejected Qty can't be zero at the same time.") + ) + def set_items_bom(self): if self.is_return: for item in self.items: