Skip to content

Commit

Permalink
fix: Packing Slip Item Qty
Browse files Browse the repository at this point in the history
(cherry picked from commit 372bce4)
  • Loading branch information
s-aga-r authored and mergify[bot] committed May 25, 2023
1 parent 19713f9 commit 5345ebe
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions erpnext/stock/doctype/delivery_note/delivery_note.py
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,9 @@ def make_packing_slip(source_name, target_doc=None):
def set_missing_values(source, target):
target.run_method("set_missing_values")

def update_item(obj, target, source_parent):
target.qty = flt(obj.qty) - flt(obj.packed_qty)

doclist = get_mapped_doc(
"Delivery Note",
source_name,
Expand All @@ -704,8 +707,10 @@ def set_missing_values(source, target):
"stock_uom": "stock_uom",
"name": "dn_detail",
},
"condition": lambda doc: not frappe.db.exists(
"Product Bundle", {"new_item_code": doc.item_code}
"postprocess": update_item,
"condition": lambda doc: (
not frappe.db.exists("Product Bundle", {"new_item_code": doc.item_code})
and (doc.qty - doc.packed_qty) > 0
),
},
"Packed Item": {
Expand All @@ -718,6 +723,8 @@ def set_missing_values(source, target):
"qty": "qty",
"name": "pi_detail",
},
"postprocess": update_item,
"condition": lambda doc: ((doc.qty - doc.packed_qty) > 0),
},
},
target_doc,
Expand Down

0 comments on commit 5345ebe

Please sign in to comment.