mirror of
https://github.com/frappe/erpnext.git
synced 2026-08-31 23:33:43 +00:00
Merge pull request #55995 from frappe/mergify/bp/version-15-hotfix/pr-55986
chore: removed redundant validation in SCR (backport #55986)
This commit is contained in:
@@ -161,7 +161,6 @@ class SubcontractingReceipt(SubcontractingController):
|
|||||||
|
|
||||||
def on_submit(self):
|
def on_submit(self):
|
||||||
self.validate_closed_subcontracting_order()
|
self.validate_closed_subcontracting_order()
|
||||||
self.validate_available_qty_for_consumption()
|
|
||||||
self.validate_bom_required_qty()
|
self.validate_bom_required_qty()
|
||||||
self.update_status_updater_args()
|
self.update_status_updater_args()
|
||||||
self.update_prevdoc_status()
|
self.update_prevdoc_status()
|
||||||
@@ -506,32 +505,6 @@ class SubcontractingReceipt(SubcontractingController):
|
|||||||
_("Row #{0}: Accepted Warehouse and Rejected Warehouse cannot be same").format(item.idx)
|
_("Row #{0}: Accepted Warehouse and Rejected Warehouse cannot be same").format(item.idx)
|
||||||
)
|
)
|
||||||
|
|
||||||
def validate_available_qty_for_consumption(self):
|
|
||||||
if (
|
|
||||||
frappe.db.get_single_value("Buying Settings", "backflush_raw_materials_of_subcontract_based_on")
|
|
||||||
== "BOM"
|
|
||||||
):
|
|
||||||
return
|
|
||||||
|
|
||||||
for item in self.get("supplied_items"):
|
|
||||||
precision = item.precision("consumed_qty")
|
|
||||||
if (
|
|
||||||
item.available_qty_for_consumption
|
|
||||||
and flt(item.available_qty_for_consumption, precision) - flt(item.consumed_qty, precision) < 0
|
|
||||||
):
|
|
||||||
msg = _(
|
|
||||||
"""Row {0}: Consumed Qty {1} {2} must be less than or equal to Available Qty For Consumption
|
|
||||||
{3} {4} in Consumed Items Table."""
|
|
||||||
).format(
|
|
||||||
item.idx,
|
|
||||||
flt(item.consumed_qty, precision),
|
|
||||||
item.stock_uom,
|
|
||||||
flt(item.available_qty_for_consumption, precision),
|
|
||||||
item.stock_uom,
|
|
||||||
)
|
|
||||||
|
|
||||||
frappe.throw(msg)
|
|
||||||
|
|
||||||
def validate_bom_required_qty(self):
|
def validate_bom_required_qty(self):
|
||||||
if (
|
if (
|
||||||
frappe.db.get_single_value("Buying Settings", "backflush_raw_materials_of_subcontract_based_on")
|
frappe.db.get_single_value("Buying Settings", "backflush_raw_materials_of_subcontract_based_on")
|
||||||
|
|||||||
Reference in New Issue
Block a user