Skip to content

Commit

Permalink
fix: consumed qty validation for subcontracting receipt
Browse files Browse the repository at this point in the history
(cherry picked from commit b38fe24)
(cherry picked from commit 7eccf43)
  • Loading branch information
rohitwaghchaure authored and mergify[bot] committed Mar 1, 2023
1 parent cc4448b commit 6ba9750
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,14 +191,17 @@ def validate_rejected_warehouse(self):

def validate_available_qty_for_consumption(self):
for item in self.get("supplied_items"):
precision = item.precision("consumed_qty")
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(
_(
"Row {0}: Consumed Qty must be less than or equal to Available Qty For Consumption in Consumed Items Table."
).format(item.idx)
)
msg = f"""Row {item.idx}: Consumed Qty {flt(item.consumed_qty, precision)}
must be less than or equal to Available Qty For Consumption
{flt(item.available_qty_for_consumption, precision)}
in Consumed Items Table."""

frappe.throw(_(msg))

def validate_items_qty(self):
for item in self.items:
Expand Down

0 comments on commit 6ba9750

Please sign in to comment.