Skip to content

Commit

Permalink
fix: Pick List Status
Browse files Browse the repository at this point in the history
(cherry picked from commit 9fb8b18)
  • Loading branch information
s-aga-r authored and mergify[bot] committed May 17, 2023
1 parent 15c1af3 commit 4888436
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions erpnext/stock/doctype/pick_list/pick_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def validate(self):
self.validate_for_qty()

def before_save(self):
self.update_status()
self.set_item_locations()

# set percentage picked in SO
Expand Down Expand Up @@ -89,20 +90,20 @@ def on_cancel(self):
self.update_reference_qty()
self.update_sales_order_picking_status()

def update_status(self, status=None, update_modified=True):
def update_status(self, status=None):
if not status:
if self.docstatus == 0:
status = "Draft"
elif self.docstatus == 1:
if self.status == "Draft":
status = "Open"
elif target_document_exists(self.name, self.purpose):
if target_document_exists(self.name, self.purpose):
status = "Completed"
else:
status = "Open"
elif self.docstatus == 2:
status = "Cancelled"

if status:
frappe.db.set_value("Pick List", self.name, "status", status, update_modified=update_modified)
self.db_set("status", status)

def update_reference_qty(self):
packed_items = []
Expand Down

0 comments on commit 4888436

Please sign in to comment.