mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-31 02:40:43 +02:00
@@ -722,19 +722,19 @@ class SerialandBatchBundle(Document):
|
|||||||
|
|
||||||
def reset_qty(self, row, qty_field=None):
|
def reset_qty(self, row, qty_field=None):
|
||||||
qty_field = self.get_qty_field(row, qty_field=qty_field)
|
qty_field = self.get_qty_field(row, qty_field=qty_field)
|
||||||
qty = abs(row.get(qty_field))
|
qty = abs(flt(row.get(qty_field), self.precision("total_qty")))
|
||||||
|
|
||||||
idx = None
|
idx = None
|
||||||
while qty > 0:
|
while qty > 0:
|
||||||
for d in self.entries:
|
for d in self.entries:
|
||||||
row_qty = abs(d.qty)
|
row_qty = abs(flt(d.qty, d.precision("qty")))
|
||||||
if row_qty >= qty:
|
if row_qty >= qty:
|
||||||
d.db_set("qty", qty if self.type_of_transaction == "Inward" else qty * -1)
|
d.db_set("qty", qty if self.type_of_transaction == "Inward" else qty * -1)
|
||||||
qty = 0
|
qty = 0
|
||||||
idx = d.idx
|
idx = d.idx
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
qty -= row_qty
|
qty = flt(qty - row_qty, d.precision("qty"))
|
||||||
idx = d.idx
|
idx = d.idx
|
||||||
|
|
||||||
if idx and len(self.entries) > idx:
|
if idx and len(self.entries) > idx:
|
||||||
|
|||||||
Reference in New Issue
Block a user