fix: Handle multiple item transfer in separate SEs against WO

- Check for pending qty in child items to show/hide "Start" button
- If no qty needed to transfer (FG qty is fulfilled), but RM qty pending: map pending in SE with For Quantity = 0
This commit is contained in:
marination 2022-04-11 14:10:57 +05:30
parent 03c631d723
commit dfff4beaf4
2 changed files with 7 additions and 3 deletions

View File

@ -540,8 +540,10 @@ erpnext.work_order = {
|| frm.doc.transfer_material_against == 'Job Card') ? 0 : 1;
if (show_start_btn) {
if ((flt(doc.material_transferred_for_manufacturing) < flt(doc.qty))
&& frm.doc.status != 'Stopped') {
let pending_to_transfer = frm.doc.required_items.some(
item => flt(item.transferred_qty) < flt(item.required_qty)
)
if (pending_to_transfer && frm.doc.status != 'Stopped') {
frm.has_start_btn = true;
frm.add_custom_button(__('Create Pick List'), function() {
erpnext.work_order.create_pick_list(frm);

View File

@ -1803,7 +1803,9 @@ class StockEntry(StockController):
or (desire_to_transfer > 0 and backflush_based_on == "Material Transferred for Manufacture")
or allow_overproduction
):
item_dict[item]["qty"] = desire_to_transfer
# "No need for transfer but qty still pending to transfer" case can occur
# when transferring multiple RM in different Stock Entries
item_dict[item]["qty"] = desire_to_transfer if (desire_to_transfer > 0) else pending_to_issue
elif pending_to_issue > 0:
item_dict[item]["qty"] = pending_to_issue
else: