Skip to content

Commit

Permalink
Merge pull request #32920 from frappe/mergify/bp/version-13-hotfix/pr…
Browse files Browse the repository at this point in the history
…-32918

fix: WO Skip Material Transfer to WIP Warehouse (backport #32918)
  • Loading branch information
s-aga-r authored Nov 10, 2022
2 parents 972893d + f09e427 commit fcb6ee2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions erpnext/manufacturing/doctype/job_card/job_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ def onload(self):
self.set_onload("job_card_excess_transfer", excess_transfer)
self.set_onload("work_order_stopped", self.is_work_order_stopped())

def before_validate(self):
self.set_wip_warehouse()

def validate(self):
self.validate_time_logs()
self.set_status()
Expand Down Expand Up @@ -639,6 +642,12 @@ def set_status(self, update_status=False):
if update_status:
self.db_set("status", self.status)

def set_wip_warehouse(self):
if not self.wip_warehouse:
self.wip_warehouse = frappe.db.get_single_value(
"Manufacturing Settings", "default_wip_warehouse"
)

def validate_operation_id(self):
if (
self.get("operation_id")
Expand Down
2 changes: 1 addition & 1 deletion erpnext/manufacturing/doctype/work_order/work_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def check_sales_order_on_hold_or_close(self):
frappe.throw(_("Sales Order {0} is {1}").format(self.sales_order, status))

def set_default_warehouse(self):
if not self.wip_warehouse:
if not self.wip_warehouse and not self.skip_transfer:
self.wip_warehouse = frappe.db.get_single_value(
"Manufacturing Settings", "default_wip_warehouse"
)
Expand Down

0 comments on commit fcb6ee2

Please sign in to comment.