mirror of
https://github.com/frappe/erpnext.git
synced 2026-09-01 23:53:21 +00:00
fix: accepted warehouse and rejected warehouse can't be same
This commit is contained in:
@@ -251,6 +251,7 @@
|
||||
"description": "Sets 'Rejected Warehouse' in each row of the Items table.",
|
||||
"fieldname": "rejected_warehouse",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"label": "Rejected Warehouse",
|
||||
"no_copy": 1,
|
||||
"options": "Warehouse",
|
||||
@@ -630,7 +631,7 @@
|
||||
"in_create": 1,
|
||||
"is_submittable": 1,
|
||||
"links": [],
|
||||
"modified": "2023-06-03 16:18:39.088518",
|
||||
"modified": "2023-07-06 18:43:16.171842",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Subcontracting",
|
||||
"name": "Subcontracting Receipt",
|
||||
|
||||
@@ -192,13 +192,23 @@ class SubcontractingReceipt(SubcontractingController):
|
||||
self.total = total_amount
|
||||
|
||||
def validate_rejected_warehouse(self):
|
||||
if not self.rejected_warehouse:
|
||||
for item in self.items:
|
||||
if item.rejected_qty:
|
||||
for item in self.items:
|
||||
if flt(item.rejected_qty) and not item.rejected_warehouse:
|
||||
if self.rejected_warehouse:
|
||||
item.rejected_warehouse = self.rejected_warehouse
|
||||
|
||||
if not item.rejected_warehouse:
|
||||
frappe.throw(
|
||||
_("Rejected Warehouse is mandatory against rejected Item {0}").format(item.item_code)
|
||||
_("Row #{0}: Rejected Warehouse is mandatory for the rejected Item {1}").format(
|
||||
item.idx, item.item_code
|
||||
)
|
||||
)
|
||||
|
||||
if item.get("rejected_warehouse") and (item.get("rejected_warehouse") == item.get("warehouse")):
|
||||
frappe.throw(
|
||||
_("Row #{0}: Accepted Warehouse and Rejected Warehouse cannot be same").format(item.idx)
|
||||
)
|
||||
|
||||
def validate_available_qty_for_consumption(self):
|
||||
for item in self.get("supplied_items"):
|
||||
precision = item.precision("consumed_qty")
|
||||
|
||||
@@ -254,6 +254,7 @@
|
||||
"depends_on": "eval: !parent.is_return",
|
||||
"fieldname": "rejected_warehouse",
|
||||
"fieldtype": "Link",
|
||||
"ignore_user_permissions": 1,
|
||||
"label": "Rejected Warehouse",
|
||||
"no_copy": 1,
|
||||
"options": "Warehouse",
|
||||
@@ -494,7 +495,7 @@
|
||||
"idx": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2023-03-12 14:00:41.418681",
|
||||
"modified": "2023-07-06 18:43:45.599761",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Subcontracting",
|
||||
"name": "Subcontracting Receipt Item",
|
||||
|
||||
Reference in New Issue
Block a user