[bom] [stock entry] Bug Fix for direct BOM entries
This commit is contained in:
parent
e67d1fbcdf
commit
0dae9f316a
@ -438,6 +438,7 @@ class DocType(StockController):
|
||||
def get_items(self):
|
||||
self.doclist = self.doc.clear_table(self.doclist, 'mtn_details', 1)
|
||||
|
||||
pro_obj = None
|
||||
if self.doc.production_order:
|
||||
# common validations
|
||||
pro_obj = get_obj('Production Order', self.doc.production_order)
|
||||
@ -456,7 +457,8 @@ class DocType(StockController):
|
||||
else:
|
||||
item_dict = self.get_bom_raw_materials(self.doc.fg_completed_qty)
|
||||
for item in item_dict.values():
|
||||
item["from_warehouse"] = pro_obj.doc.wip_warehouse
|
||||
if pro_obj:
|
||||
item["from_warehouse"] = pro_obj.doc.wip_warehouse
|
||||
item["to_warehouse"] = ""
|
||||
|
||||
# add raw materials to Stock Entry Detail table
|
||||
@ -481,8 +483,12 @@ class DocType(StockController):
|
||||
item = webnotes.conn.sql("""select item, description, uom from `tabBOM`
|
||||
where name=%s""", (self.doc.bom_no,), as_dict=1)
|
||||
self.add_to_stock_entry_detail({
|
||||
item[0]["item"] :
|
||||
[self.doc.fg_completed_qty, item[0]["description"], item[0]["uom"]]
|
||||
item[0]["item"] : {
|
||||
"qty": self.doc.fg_completed_qty,
|
||||
"description": item[0]["description"],
|
||||
"stock_uom": item[0]["uom"],
|
||||
"from_warehouse": ""
|
||||
}
|
||||
}, bom_no=self.doc.bom_no)
|
||||
|
||||
self.get_stock_and_rate()
|
||||
@ -604,7 +610,7 @@ class DocType(StockController):
|
||||
for d in item_dict:
|
||||
se_child = addchild(self.doc, 'mtn_details', 'Stock Entry Detail',
|
||||
self.doclist)
|
||||
se_child.s_warehouse = item_dict[d].get("from_warehouse", self.doc.from_warehouse)
|
||||
se_child.s_warehouse = item_dict[d].get("from_warehouse", self.doc.from_warehouse)
|
||||
se_child.t_warehouse = item_dict[d].get("to_warehouse", self.doc.to_warehouse)
|
||||
se_child.item_code = cstr(d)
|
||||
se_child.description = item_dict[d]["description"]
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-04-09 11:43:55",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-05 14:56:06",
|
||||
"modified": "2013-08-05 15:28:09",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -298,11 +298,11 @@
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:(doc.purpose!==\"Sales Return\" || doc.purpose!==\"Purchase Return\")",
|
||||
"depends_on": "eval:(doc.purpose!==\"Sales Return\" && doc.purpose!==\"Purchase Return\")",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "sb1",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Reference",
|
||||
"label": "From Bill of Materials",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user