fix: accepted warehouse and rejected warehouse can't be same

(cherry picked from commit d618aaef32)

# Conflicts:
#	erpnext/accounts/doctype/purchase_invoice/purchase_invoice.json
#	erpnext/stock/doctype/purchase_receipt/purchase_receipt.json
#	erpnext/subcontracting/doctype/subcontracting_receipt/subcontracting_receipt.json
#	erpnext/subcontracting/doctype/subcontracting_receipt_item/subcontracting_receipt_item.json
This commit is contained in:
Rohit Waghchaure
2023-07-04 17:26:48 +05:30
committed by Mergify
parent 0f9a6ee70a
commit 5d77e3ce05
9 changed files with 58 additions and 12 deletions

View File

@@ -250,6 +250,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",
@@ -629,7 +630,11 @@
"in_create": 1,
"is_submittable": 1,
"links": [],
<<<<<<< HEAD
"modified": "2022-11-16 14:18:57.001239",
=======
"modified": "2023-07-06 18:43:16.171842",
>>>>>>> d618aaef32 (fix: accepted warehouse and rejected warehouse can't be same)
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Receipt",

View File

@@ -190,13 +190,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")

View File

@@ -252,6 +252,7 @@
"depends_on": "eval: !parent.is_return",
"fieldname": "rejected_warehouse",
"fieldtype": "Link",
"ignore_user_permissions": 1,
"label": "Rejected Warehouse",
"no_copy": 1,
"options": "Warehouse",
@@ -476,7 +477,11 @@
"idx": 1,
"istable": 1,
"links": [],
<<<<<<< HEAD
"modified": "2022-11-16 14:21:26.125815",
=======
"modified": "2023-07-06 18:43:45.599761",
>>>>>>> d618aaef32 (fix: accepted warehouse and rejected warehouse can't be same)
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Receipt Item",