mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-26 22:52:10 +01:00
fix: validation trigger (#43926)
(cherry picked from commit ba9fb4effc)
Co-authored-by: rohitwaghchaure <rohitw1991@gmail.com>
This commit is contained in:
@@ -968,6 +968,13 @@ class BOM(WebsiteGenerator):
|
|||||||
if not d.batch_size or d.batch_size <= 0:
|
if not d.batch_size or d.batch_size <= 0:
|
||||||
d.batch_size = 1
|
d.batch_size = 1
|
||||||
|
|
||||||
|
if not d.workstation and not d.workstation_type:
|
||||||
|
frappe.throw(
|
||||||
|
_(
|
||||||
|
"Row {0}: Workstation or Workstation Type is mandatory for an operation {1}"
|
||||||
|
).format(d.idx, d.operation)
|
||||||
|
)
|
||||||
|
|
||||||
def get_tree_representation(self) -> BOMTree:
|
def get_tree_representation(self) -> BOMTree:
|
||||||
"""Get a complete tree representation preserving order of child items."""
|
"""Get a complete tree representation preserving order of child items."""
|
||||||
return BOMTree(self.name)
|
return BOMTree(self.name)
|
||||||
|
|||||||
@@ -173,10 +173,16 @@ class WorkOrder(Document):
|
|||||||
self.get_items_and_operations_from_bom()
|
self.get_items_and_operations_from_bom()
|
||||||
|
|
||||||
def validate_workstation_type(self):
|
def validate_workstation_type(self):
|
||||||
|
if not self.docstatus.is_submitted():
|
||||||
|
return
|
||||||
|
|
||||||
for row in self.operations:
|
for row in self.operations:
|
||||||
if not row.workstation and not row.workstation_type:
|
if not row.workstation and not row.workstation_type:
|
||||||
msg = f"Row {row.idx}: Workstation or Workstation Type is mandatory for an operation {row.operation}"
|
frappe.throw(
|
||||||
frappe.throw(_(msg))
|
_("Row {0}: Workstation or Workstation Type is mandatory for an operation {1}").format(
|
||||||
|
row.idx, row.operation
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
def validate_sales_order(self):
|
def validate_sales_order(self):
|
||||||
if self.sales_order:
|
if self.sales_order:
|
||||||
|
|||||||
Reference in New Issue
Block a user