fix: precision for certain calculations in buying controller (#18008)

* fix: precision for certain numbers

* fix: check precision of the received_qty

* Update buying_controller.py
This commit is contained in:
Mangesh-Khairnar 2019-06-26 11:10:17 +05:30 committed by Nabin Hait
parent ea0574679f
commit 8c621ab90c

View File

@ -428,8 +428,9 @@ class BuyingController(StockController):
elif not flt(d.rejected_qty):
d.rejected_qty = flt(d.received_qty) - flt(d.qty)
val = flt(d.qty) + flt(d.rejected_qty)
# Check Received Qty = Accepted Qty + Rejected Qty
if ((flt(d.qty) + flt(d.rejected_qty)) != flt(d.received_qty)):
if (flt(val, d.precision("received_qty")) != flt(d.received_qty, d.precision("received_qty"))):
frappe.throw(_("Accepted + Rejected Qty must be equal to Received quantity for Item {0}").format(d.item_code))
def validate_negative_quantity(self, item_row, field_list):