fix: update picked qty on cancellation
diff --git a/erpnext/stock/doctype/pick_list/pick_list.py b/erpnext/stock/doctype/pick_list/pick_list.py
index 3a49686..35cbc2f 100644
--- a/erpnext/stock/doctype/pick_list/pick_list.py
+++ b/erpnext/stock/doctype/pick_list/pick_list.py
@@ -54,9 +54,9 @@
def before_cancel(self):
#update picked_qty in SO Item on cancel of PL
- for location in self.get('locations'):
- if location.sales_order_item:
- self.update_so(location.sales_order_item,0,location.item_code)
+ for item in self.get('locations'):
+ if item.sales_order_item:
+ self.update_so(item.sales_order_item, -1 * item.picked_qty, item.item_code)
def update_so(self,so_item,picked_qty,item_code):
so_doc = frappe.get_doc("Sales Order",frappe.db.get_value("Sales Order Item",so_item,"parent"))
@@ -637,4 +637,4 @@
item.material_request = location.material_request
item.serial_no = location.serial_no
item.batch_no = location.batch_no
- item.material_request_item = location.material_request_item
\ No newline at end of file
+ item.material_request_item = location.material_request_item