[fix] fifo in stock ledger
This commit is contained in:
parent
ed3a6cf748
commit
8142cd2865
@ -133,11 +133,12 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
|||||||
var me = this;
|
var me = this;
|
||||||
this.toggle_enable_bom();
|
this.toggle_enable_bom();
|
||||||
|
|
||||||
return this.frm.call({
|
return frappe.call({
|
||||||
method: "get_production_order_details",
|
method: "erpnext.stock.doctype.stock_entry.stock_entry.get_production_order_details",
|
||||||
args: {production_order: this.frm.doc.production_order},
|
args: {production_order: this.frm.doc.production_order},
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
if (!r.exc) {
|
if (!r.exc) {
|
||||||
|
me.frm.set_value(r.message);
|
||||||
if (me.frm.doc.purpose == "Material Transfer for Manufacture" && !me.frm.doc.to_warehouse)
|
if (me.frm.doc.purpose == "Material Transfer for Manufacture" && !me.frm.doc.to_warehouse)
|
||||||
me.frm.set_value("to_warehouse", r.message["wip_warehouse"]);
|
me.frm.set_value("to_warehouse", r.message["wip_warehouse"]);
|
||||||
me.frm.set_value("from_bom", 1);
|
me.frm.set_value("from_bom", 1);
|
||||||
|
@ -300,7 +300,6 @@ 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,7 +133,6 @@ 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