fix: Item mapping of stock entry with no reference
This commit is contained in:
parent
55a2699f4c
commit
66f2bc69a6
@ -37,10 +37,8 @@ class PickList(Document):
|
|||||||
self.item_location_map[item_code] = get_available_items(item_code, from_warehouses)
|
self.item_location_map[item_code] = get_available_items(item_code, from_warehouses)
|
||||||
locations = get_items_with_warehouse_and_quantity(item_doc, from_warehouses, self.item_location_map)
|
locations = get_items_with_warehouse_and_quantity(item_doc, from_warehouses, self.item_location_map)
|
||||||
|
|
||||||
# hack
|
item_doc.idx = None
|
||||||
del item_doc.idx
|
item_doc.name = None
|
||||||
if len(locations) > 1:
|
|
||||||
del item_doc.name
|
|
||||||
|
|
||||||
for row in locations:
|
for row in locations:
|
||||||
stock_qty = row.get('qty', 0) * item_doc.conversion_factor
|
stock_qty = row.get('qty', 0) * item_doc.conversion_factor
|
||||||
@ -49,7 +47,7 @@ class PickList(Document):
|
|||||||
'picked_qty': stock_qty
|
'picked_qty': stock_qty
|
||||||
})
|
})
|
||||||
|
|
||||||
location = item_doc
|
location = item_doc.as_dict()
|
||||||
location.update(row)
|
location.update(row)
|
||||||
self.append('locations', location)
|
self.append('locations', location)
|
||||||
|
|
||||||
@ -236,6 +234,8 @@ def create_stock_entry(pick_list):
|
|||||||
stock_entry = update_stock_entry_based_on_work_order(pick_list, stock_entry)
|
stock_entry = update_stock_entry_based_on_work_order(pick_list, stock_entry)
|
||||||
elif pick_list.get('material_request'):
|
elif pick_list.get('material_request'):
|
||||||
stock_entry = update_stock_entry_based_on_material_request(pick_list, stock_entry)
|
stock_entry = update_stock_entry_based_on_material_request(pick_list, stock_entry)
|
||||||
|
else:
|
||||||
|
stock_entry = update_stock_entry_items_with_no_reference(pick_list, stock_entry)
|
||||||
|
|
||||||
stock_entry.set_incoming_rate()
|
stock_entry.set_incoming_rate()
|
||||||
stock_entry.set_actual_qty()
|
stock_entry.set_actual_qty()
|
||||||
@ -376,3 +376,20 @@ def update_stock_entry_based_on_material_request(pick_list, stock_entry):
|
|||||||
stock_entry.append('items', item)
|
stock_entry.append('items', item)
|
||||||
|
|
||||||
return stock_entry
|
return stock_entry
|
||||||
|
|
||||||
|
def update_stock_entry_items_with_no_reference(pick_list, stock_entry):
|
||||||
|
for location in pick_list.locations:
|
||||||
|
item = frappe._dict()
|
||||||
|
item.item_code = location.item_code
|
||||||
|
item.s_warehouse = location.warehouse
|
||||||
|
item.qty = location.picked_qty * location.conversion_factor
|
||||||
|
item.transfer_qty = location.picked_qty
|
||||||
|
item.uom = location.uom
|
||||||
|
item.conversion_factor = location.conversion_factor
|
||||||
|
item.stock_uom = location.stock_uom
|
||||||
|
item.material_request = location.material_request
|
||||||
|
item.material_request_item = location.material_request_item
|
||||||
|
|
||||||
|
stock_entry.append('items', item)
|
||||||
|
|
||||||
|
return stock_entry
|
||||||
Loading…
x
Reference in New Issue
Block a user