commit
f638c1acd5
@ -27,7 +27,7 @@ def get_bin_qty(item, warehouse):
|
|||||||
where item_code = %s and warehouse = %s""", (item, warehouse), as_dict = 1)
|
where item_code = %s and warehouse = %s""", (item, warehouse), as_dict = 1)
|
||||||
return det and det[0] or ''
|
return det and det[0] or ''
|
||||||
|
|
||||||
def update_packing_list_item(obj, packing_item_code, qty, warehouse, line, packing_list_idx):
|
def update_packing_list_item(obj, packing_item_code, qty, warehouse, line):
|
||||||
bin = get_bin_qty(packing_item_code, warehouse)
|
bin = get_bin_qty(packing_item_code, warehouse)
|
||||||
item = get_packing_item_details(packing_item_code)
|
item = get_packing_item_details(packing_item_code)
|
||||||
|
|
||||||
@ -54,9 +54,7 @@ def update_packing_list_item(obj, packing_item_code, qty, warehouse, line, packi
|
|||||||
pi.warehouse = warehouse
|
pi.warehouse = warehouse
|
||||||
if not pi.batch_no:
|
if not pi.batch_no:
|
||||||
pi.batch_no = cstr(line.get("batch_no"))
|
pi.batch_no = cstr(line.get("batch_no"))
|
||||||
pi.idx = packing_list_idx
|
|
||||||
|
|
||||||
packing_list_idx += 1
|
|
||||||
|
|
||||||
|
|
||||||
def make_packing_list(obj, item_table_fieldname):
|
def make_packing_list(obj, item_table_fieldname):
|
||||||
@ -64,13 +62,11 @@ def make_packing_list(obj, item_table_fieldname):
|
|||||||
|
|
||||||
if obj.get("_action") and obj._action == "update_after_submit": return
|
if obj.get("_action") and obj._action == "update_after_submit": return
|
||||||
|
|
||||||
packing_list_idx = 0
|
|
||||||
parent_items = []
|
parent_items = []
|
||||||
for d in obj.get(item_table_fieldname):
|
for d in obj.get(item_table_fieldname):
|
||||||
if frappe.db.get_value("Sales BOM", {"new_item_code": d.item_code}):
|
if frappe.db.get_value("Sales BOM", {"new_item_code": d.item_code}):
|
||||||
for i in get_sales_bom_items(d.item_code):
|
for i in get_sales_bom_items(d.item_code):
|
||||||
update_packing_list_item(obj, i['item_code'], flt(i['qty'])*flt(d.qty),
|
update_packing_list_item(obj, i['item_code'], flt(i['qty'])*flt(d.qty), d.warehouse, d)
|
||||||
d.warehouse, d, packing_list_idx)
|
|
||||||
|
|
||||||
if [d.item_code, d.name] not in parent_items:
|
if [d.item_code, d.name] not in parent_items:
|
||||||
parent_items.append([d.item_code, d.name])
|
parent_items.append([d.item_code, d.name])
|
||||||
|
Loading…
Reference in New Issue
Block a user