fix: update picked qty on cancellation

This commit is contained in:
Ankush Menat 2022-03-28 10:35:32 +05:30 committed by Ankush Menat
parent e401ad3f90
commit 69ae2661d2

View File

@ -54,9 +54,9 @@ class PickList(Document):
def before_cancel(self): def before_cancel(self):
#update picked_qty in SO Item on cancel of PL #update picked_qty in SO Item on cancel of PL
for location in self.get('locations'): for item in self.get('locations'):
if location.sales_order_item: if item.sales_order_item:
self.update_so(location.sales_order_item,0,location.item_code) self.update_so(item.sales_order_item, -1 * item.picked_qty, item.item_code)
def update_so(self,so_item,picked_qty,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")) so_doc = frappe.get_doc("Sales Order",frappe.db.get_value("Sales Order Item",so_item,"parent"))
@ -637,4 +637,4 @@ def update_common_item_properties(item, location):
item.material_request = location.material_request item.material_request = location.material_request
item.serial_no = location.serial_no item.serial_no = location.serial_no
item.batch_no = location.batch_no item.batch_no = location.batch_no
item.material_request_item = location.material_request_item item.material_request_item = location.material_request_item