Fixed exploded BOM construction
This commit is contained in:
parent
2c45899a02
commit
c5e057f676
@ -7,8 +7,9 @@ data = [
|
|||||||
"items": [
|
"items": [
|
||||||
{
|
{
|
||||||
"type": "doctype",
|
"type": "doctype",
|
||||||
"name": "Bill of Materials",
|
"name": "BOM",
|
||||||
"description": _("Bill of Materials (BOM)"),
|
"description": _("Bill of Materials (BOM)"),
|
||||||
|
"label": _("Bill of Material")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "doctype",
|
"type": "doctype",
|
||||||
|
@ -138,16 +138,15 @@ class BOM(Document):
|
|||||||
as on costing date
|
as on costing date
|
||||||
"""
|
"""
|
||||||
from erpnext.stock.utils import get_incoming_rate
|
from erpnext.stock.utils import get_incoming_rate
|
||||||
dt = self.costing_date or nowdate()
|
posting_date, posting_time = nowdate(), now().split()[1]
|
||||||
time = self.costing_date == nowdate() and now().split()[1] or '23:59'
|
|
||||||
warehouse = frappe.db.sql("select warehouse from `tabBin` where item_code = %s", args['item_code'])
|
warehouse = frappe.db.sql("select warehouse from `tabBin` where item_code = %s", args['item_code'])
|
||||||
rate = []
|
rate = []
|
||||||
for wh in warehouse:
|
for wh in warehouse:
|
||||||
r = get_incoming_rate({
|
r = get_incoming_rate({
|
||||||
"item_code": args.get("item_code"),
|
"item_code": args.get("item_code"),
|
||||||
"warehouse": wh[0],
|
"warehouse": wh[0],
|
||||||
"posting_date": dt,
|
"posting_date": posting_date,
|
||||||
"posting_time": time,
|
"posting_time": posting_time,
|
||||||
"qty": args.get("qty") or 0
|
"qty": args.get("qty") or 0
|
||||||
})
|
})
|
||||||
if r:
|
if r:
|
||||||
@ -352,6 +351,7 @@ class BOM(Document):
|
|||||||
def add_exploded_items(self):
|
def add_exploded_items(self):
|
||||||
"Add items to Flat BOM table"
|
"Add items to Flat BOM table"
|
||||||
frappe.db.sql("""delete from `tabBOM Explosion Item` where parent=%s""", self.name)
|
frappe.db.sql("""delete from `tabBOM Explosion Item` where parent=%s""", self.name)
|
||||||
|
self.set('flat_bom_details', [])
|
||||||
for d in self.cur_exploded_items:
|
for d in self.cur_exploded_items:
|
||||||
ch = self.append('flat_bom_details', {})
|
ch = self.append('flat_bom_details', {})
|
||||||
for i in self.cur_exploded_items[d].keys():
|
for i in self.cur_exploded_items[d].keys():
|
||||||
|
Loading…
Reference in New Issue
Block a user