diff --git a/erpnext/manufacturing/doctype/production_order/production_order.py b/erpnext/manufacturing/doctype/production_order/production_order.py index f6af357c37..fbca0d5909 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.py +++ b/erpnext/manufacturing/doctype/production_order/production_order.py @@ -179,5 +179,5 @@ def make_stock_entry(production_order_id, purpose, qty=None): stock_entry.from_warehouse = production_order.wip_warehouse stock_entry.to_warehouse = production_order.fg_warehouse - stock_entry.run_method("get_items") + stock_entry.get_items() return stock_entry.as_dict() diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index bf7b2ebd77..d06a761075 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -243,14 +243,13 @@ class StockEntry(StockController): self.posting_date, self.posting_time, d.actual_qty, d.transfer_qty)) # get incoming rate + if not flt(d.incoming_rate) or d.s_warehouse or self.purpose == "Sales Return" or force: + incoming_rate = flt(self.get_incoming_rate(args), self.precision("incoming_rate", d)) + if incoming_rate > 0: + d.incoming_rate = incoming_rate + d.amount = flt(d.transfer_qty) * flt(d.incoming_rate) if not d.t_warehouse: - if not flt(d.incoming_rate) or d.s_warehouse or self.purpose == "Sales Return" or force: - incoming_rate = flt(self.get_incoming_rate(args), self.precision("incoming_rate", d)) - if incoming_rate > 0: - d.incoming_rate = incoming_rate - d.amount = flt(d.transfer_qty) * flt(d.incoming_rate) - if not d.t_warehouse: - raw_material_cost += flt(d.amount) + raw_material_cost += flt(d.amount) # set incoming rate for fg item if self.purpose in ("Manufacture", "Repack"):