Merge pull request #3779 from nabinhait/fifo_stack
[fix] Get fifo rate only qty exists in batch
This commit is contained in:
commit
4a0edd04c4
@ -187,3 +187,4 @@ execute:frappe.db.sql("update `tabLeave Type` set include_holiday=0")
|
|||||||
erpnext.patches.v5_4.set_root_and_report_type
|
erpnext.patches.v5_4.set_root_and_report_type
|
||||||
erpnext.patches.v5_4.notify_system_managers_regarding_wrong_tax_calculation
|
erpnext.patches.v5_4.notify_system_managers_regarding_wrong_tax_calculation
|
||||||
erpnext.patches.v5_4.fix_invoice_outstanding
|
erpnext.patches.v5_4.fix_invoice_outstanding
|
||||||
|
execute:frappe.db.sql("update `tabStock Ledger Entry` set stock_queue = '[]' where voucher_type = 'Stock Reconciliation' and ifnull(qty_after_transaction, 0) = 0")
|
||||||
@ -300,7 +300,7 @@ class update_entries_after(object):
|
|||||||
|
|
||||||
# select first batch or the batch with same rate
|
# select first batch or the batch with same rate
|
||||||
batch = self.stock_queue[index]
|
batch = self.stock_queue[index]
|
||||||
|
if batch[0]:
|
||||||
if qty_to_pop >= batch[0]:
|
if qty_to_pop >= batch[0]:
|
||||||
# consume current batch
|
# consume current batch
|
||||||
qty_to_pop = qty_to_pop - batch[0]
|
qty_to_pop = qty_to_pop - batch[0]
|
||||||
|
|||||||
@ -133,6 +133,7 @@ def get_fifo_rate(previous_stock_queue, qty):
|
|||||||
qty_to_pop = abs(qty)
|
qty_to_pop = abs(qty)
|
||||||
while qty_to_pop and previous_stock_queue:
|
while qty_to_pop and previous_stock_queue:
|
||||||
batch = previous_stock_queue[0]
|
batch = previous_stock_queue[0]
|
||||||
|
if batch[0]:
|
||||||
if 0 < batch[0] <= qty_to_pop:
|
if 0 < batch[0] <= qty_to_pop:
|
||||||
# if batch qty > 0
|
# if batch qty > 0
|
||||||
# not enough or exactly same qty in current batch, clear batch
|
# not enough or exactly same qty in current batch, clear batch
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user