fix: consumed qty validation for subcontracting receipt
This commit is contained in:
parent
d88fe27be6
commit
b38fe24090
@ -191,14 +191,17 @@ class SubcontractingReceipt(SubcontractingController):
|
|||||||
|
|
||||||
def validate_available_qty_for_consumption(self):
|
def validate_available_qty_for_consumption(self):
|
||||||
for item in self.get("supplied_items"):
|
for item in self.get("supplied_items"):
|
||||||
|
precision = item.precision("consumed_qty")
|
||||||
if (
|
if (
|
||||||
item.available_qty_for_consumption and item.available_qty_for_consumption < item.consumed_qty
|
item.available_qty_for_consumption
|
||||||
|
and flt(item.available_qty_for_consumption, precision) - flt(item.consumed_qty, precision) < 0
|
||||||
):
|
):
|
||||||
frappe.throw(
|
msg = f"""Row {item.idx}: Consumed Qty {flt(item.consumed_qty, precision)}
|
||||||
_(
|
must be less than or equal to Available Qty For Consumption
|
||||||
"Row {0}: Consumed Qty must be less than or equal to Available Qty For Consumption in Consumed Items Table."
|
{flt(item.available_qty_for_consumption, precision)}
|
||||||
).format(item.idx)
|
in Consumed Items Table."""
|
||||||
)
|
|
||||||
|
frappe.throw(_(msg))
|
||||||
|
|
||||||
def validate_items_qty(self):
|
def validate_items_qty(self):
|
||||||
for item in self.items:
|
for item in self.items:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user