From 0df3f77462a419ac7d4eb2158ab180799f5b534b Mon Sep 17 00:00:00 2001 From: Daniel-CA Date: Thu, 28 May 2015 18:15:05 +0200 Subject: [PATCH] [IMP] mrp_operations_extension: Added material ready for operations + editable operations from production order --- mrp_operations_extension/models/mrp_production.py | 14 ++++++++++++++ .../views/mrp_production_view.xml | 13 ++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/mrp_operations_extension/models/mrp_production.py b/mrp_operations_extension/models/mrp_production.py index b8925bf7a..81667d8b7 100644 --- a/mrp_operations_extension/models/mrp_production.py +++ b/mrp_operations_extension/models/mrp_production.py @@ -22,6 +22,8 @@ from openerp import models, fields, api, exceptions, _ class MrpProduction(models.Model): _inherit = 'mrp.production' + workcenter_lines = fields.One2many(readonly=False) + def _get_minor_sequence_operation(self, operations): return min(operations, key=lambda x: x.sequence) @@ -94,6 +96,16 @@ class MrpProductionProductLine(models.Model): class MrpProductionWorkcenterLine(models.Model): _inherit = 'mrp.production.workcenter.line' + @api.one + def _ready_materials(self): + self.is_material_ready = True + if self.product_line: + moves = self.env['stock.move'].search([('work_order', '=', + self.id)]) + self.is_material_ready = not any( + x not in ('assigned', 'cancel', 'done') for x in + moves.mapped('state')) + product_line = fields.One2many('mrp.production.product.line', 'work_order', string='Product Lines') routing_wc_line = fields.Many2one('mrp.routing.workcenter', @@ -103,6 +115,8 @@ class MrpProductionWorkcenterLine(models.Model): time_stop = fields.Float(string="Time Stop") move_lines = fields.One2many('stock.move', 'work_order', string='Moves') + is_material_ready = fields.Boolean('Materials Ready', + compute="_ready_materials") @api.one def action_assign(self): diff --git a/mrp_operations_extension/views/mrp_production_view.xml b/mrp_operations_extension/views/mrp_production_view.xml index 2fe53b0b9..a8d7a1b72 100644 --- a/mrp_operations_extension/views/mrp_production_view.xml +++ b/mrp_operations_extension/views/mrp_production_view.xml @@ -68,6 +68,7 @@ + @@ -210,9 +211,19 @@ + + + + + + Workcenter line op ext + mrp.production.workcenter.line + + + + -