mirror of
https://github.com/frappe/erpnext.git
synced 2026-10-29 22:57:42 +00:00
fix(stock): clear source warehouse on non-transfer material requests
Switching a Material Request from Material Transfer to another purpose
left the hidden row Source Warehouse set, so saving failed when it
matched the target warehouse.
(cherry picked from commit 372155864e)
This commit is contained in:
@@ -150,6 +150,7 @@ class MaterialRequest(BuyingController):
|
||||
)
|
||||
|
||||
def validate(self):
|
||||
self.clear_source_warehouse()
|
||||
super().validate()
|
||||
|
||||
self.validate_schedule_date()
|
||||
@@ -240,6 +241,14 @@ class MaterialRequest(BuyingController):
|
||||
def before_update_after_submit(self):
|
||||
self.validate_schedule_date()
|
||||
|
||||
def clear_source_warehouse(self):
|
||||
"""Source Warehouse is only used by Material Transfer, so it stays hidden and stale otherwise."""
|
||||
if self.material_request_type == "Material Transfer":
|
||||
return
|
||||
|
||||
for item in self.items:
|
||||
item.from_warehouse = None
|
||||
|
||||
def validate_material_request_type(self):
|
||||
"""Validate fields in accordance with selected type"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user