fix(manufacturing): allow to edit batch size while creating a work order (#55332)

This commit is contained in:
Pandiyan P
2026-05-27 18:39:59 +05:30
committed by GitHub
parent a6d4bc5c86
commit 41bf2f32fd
4 changed files with 19 additions and 11 deletions

View File

@@ -126,11 +126,13 @@
"label": "Image" "label": "Image"
}, },
{ {
"default": "1",
"fetch_from": "operation.batch_size", "fetch_from": "operation.batch_size",
"fetch_if_empty": 1, "fetch_if_empty": 1,
"fieldname": "batch_size", "fieldname": "batch_size",
"fieldtype": "Int", "fieldtype": "Float",
"label": "Batch Size" "label": "Batch Size",
"non_negative": 1
}, },
{ {
"depends_on": "eval:doc.parenttype == \"Routing\" || !parent.routing", "depends_on": "eval:doc.parenttype == \"Routing\" || !parent.routing",
@@ -196,13 +198,14 @@
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2026-02-17 15:33:28.495850", "modified": "2026-05-27 12:09:44.797434",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "BOM Operation", "name": "BOM Operation",
"owner": "Administrator", "owner": "Administrator",
"permissions": [], "permissions": [],
"row_format": "Dynamic",
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"states": [] "states": []
} }

View File

@@ -17,7 +17,7 @@ class BOMOperation(Document):
base_cost_per_unit: DF.Float base_cost_per_unit: DF.Float
base_hour_rate: DF.Currency base_hour_rate: DF.Currency
base_operating_cost: DF.Currency base_operating_cost: DF.Currency
batch_size: DF.Int batch_size: DF.Float
cost_per_unit: DF.Float cost_per_unit: DF.Float
description: DF.TextEditor | None description: DF.TextEditor | None
fixed_time: DF.Check fixed_time: DF.Check

View File

@@ -158,7 +158,7 @@ class WorkOrder(Document):
self.calculate_operating_cost() self.calculate_operating_cost()
self.validate_qty() self.validate_qty()
self.validate_transfer_against() self.validate_transfer_against()
self.validate_operation_time() self.validate_operations()
self.status = self.get_status() self.status = self.get_status()
self.validate_workstation_type() self.validate_workstation_type()
self.reset_use_multi_level_bom() self.reset_use_multi_level_bom()
@@ -1120,9 +1120,12 @@ class WorkOrder(Document):
title=_("Missing value"), title=_("Missing value"),
) )
def validate_operation_time(self): def validate_operations(self):
for d in self.operations: for d in self.operations:
if not d.time_in_mins > 0: if not d.batch_size or d.batch_size <= 0:
d.batch_size = 1
if d.time_in_mins <= 0:
frappe.throw(_("Operation Time must be greater than 0 for Operation {0}").format(d.operation)) frappe.throw(_("Operation Time must be greater than 0 for Operation {0}").format(d.operation))
def update_required_items(self): def update_required_items(self):

View File

@@ -185,10 +185,11 @@
"read_only": 1 "read_only": 1
}, },
{ {
"default": "1",
"fieldname": "batch_size", "fieldname": "batch_size",
"fieldtype": "Float", "fieldtype": "Float",
"label": "Batch Size", "label": "Batch Size",
"read_only": 1 "non_negative": 1
}, },
{ {
"fieldname": "sequence_id", "fieldname": "sequence_id",
@@ -225,14 +226,15 @@
"index_web_pages_for_search": 1, "index_web_pages_for_search": 1,
"istable": 1, "istable": 1,
"links": [], "links": [],
"modified": "2025-05-15 15:10:06.885440", "modified": "2026-05-27 12:56:37.240431",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Work Order Operation", "name": "Work Order Operation",
"owner": "Administrator", "owner": "Administrator",
"permissions": [], "permissions": [],
"row_format": "Dynamic",
"sort_field": "modified", "sort_field": "modified",
"sort_order": "DESC", "sort_order": "DESC",
"states": [], "states": [],
"track_changes": 1 "track_changes": 1
} }