Merge pull request #6324 from RobertSchouten/patch-24
stock entries from production_order dont fetch serial number of project
This commit is contained in:
commit
cd23530d24
@ -478,10 +478,12 @@ def make_stock_entry(production_order_id, purpose, qty=None):
|
||||
if production_order.source_warehouse:
|
||||
stock_entry.from_warehouse = production_order.source_warehouse
|
||||
stock_entry.to_warehouse = production_order.wip_warehouse
|
||||
stock_entry.project = production_order.project
|
||||
else:
|
||||
stock_entry.from_warehouse = production_order.wip_warehouse
|
||||
stock_entry.to_warehouse = production_order.fg_warehouse
|
||||
additional_costs = get_additional_costs(production_order, fg_qty=stock_entry.fg_completed_qty)
|
||||
stock_entry.project = frappe.db.get_value("Stock Entry",{"production_order": production_order_id,"purpose": "Material Transfer for Manufacture"}, "project")
|
||||
stock_entry.set("additional_costs", additional_costs)
|
||||
|
||||
stock_entry.get_items()
|
||||
|
@ -249,6 +249,7 @@ class ProductionPlanningTool(Document):
|
||||
"wip_warehouse" : "",
|
||||
"fg_warehouse" : d.warehouse,
|
||||
"status" : "Draft",
|
||||
"project" : frappe.db.get_value("Sales Order", d.sales_order, "project")
|
||||
}
|
||||
|
||||
""" Club similar BOM and item for processing in case of Sales Orders """
|
||||
|
@ -232,6 +232,17 @@ class StockEntry(StockController):
|
||||
frappe.bold(d.transfer_qty)),
|
||||
NegativeStockError, title=_('Insufficient Stock'))
|
||||
|
||||
def set_serial_nos(self, production_order):
|
||||
previous_se = frappe.db.get_value("Stock Entry", {"production_order": production_order,
|
||||
"purpose": "Material Transfer for Manufacture"}, "name")
|
||||
|
||||
for d in self.get('items'):
|
||||
transferred_serial_no = frappe.db.get_value("Stock Entry Detail",{"parent": previous_se,
|
||||
"item_code": d.item_code}, "serial_no")
|
||||
|
||||
if transferred_serial_no:
|
||||
d.serial_no = transferred_serial_no
|
||||
|
||||
def get_stock_and_rate(self):
|
||||
self.set_transfer_qty()
|
||||
self.set_actual_qty()
|
||||
@ -551,6 +562,9 @@ class StockEntry(StockController):
|
||||
|
||||
item["to_warehouse"] = self.to_warehouse if self.purpose=="Subcontract" else ""
|
||||
self.add_to_stock_entry_detail(item_dict)
|
||||
# fetch the serial_no of the first stock entry for the second stock entry
|
||||
if self.production_order and self.purpose == "Manufacture":
|
||||
self.set_serial_nos(self.production_order)
|
||||
|
||||
# add finished goods item
|
||||
if self.purpose in ("Manufacture", "Repack"):
|
||||
|
Loading…
Reference in New Issue
Block a user