diff --git a/addons/mrp/models/mrp_bom.py b/addons/mrp/models/mrp_bom.py index f0d19c7f7b8..397803a7bb5 100644 --- a/addons/mrp/models/mrp_bom.py +++ b/addons/mrp/models/mrp_bom.py @@ -407,6 +407,8 @@ class MrpBomLine(models.Model): 'Manual Consumption', default=False, compute='_compute_manual_consumption', store=True, copy=True, help="When activated, then the registration of consumption for that component is recorded manually exclusively.\n" "If not activated, and any of the components consumption is edited manually on the manufacturing order, Odoo assumes manual consumption also.") + manual_consumption_readonly = fields.Boolean( + 'Manual Consumption Readonly', compute='_compute_manual_consumption_readonly') _sql_constraints = [ ('bom_qty_zero', 'CHECK (product_qty>=0)', 'All product quantities must be greater or equal to 0.\n' @@ -418,6 +420,11 @@ class MrpBomLine(models.Model): def _compute_manual_consumption(self): self.filtered(lambda m: m.tracking != 'none' or m.operation_id).manual_consumption = True + @api.depends('tracking', 'operation_id') + def _compute_manual_consumption_readonly(self): + for line in self: + line.manual_consumption_readonly = (line.tracking != 'none' or line.operation_id) + @api.depends('product_id', 'bom_id') def _compute_child_bom_id(self): products = self.product_id diff --git a/addons/mrp/views/mrp_bom_views.xml b/addons/mrp/views/mrp_bom_views.xml index 972efe8a048..0b60938a0d1 100644 --- a/addons/mrp/views/mrp_bom_views.xml +++ b/addons/mrp/views/mrp_bom_views.xml @@ -98,8 +98,8 @@ - - + +