diff --git a/mrp_operations_extension/README.rst b/mrp_operations_extension/README.rst new file mode 100644 index 000000000..b12ce8d5c --- /dev/null +++ b/mrp_operations_extension/README.rst @@ -0,0 +1,9 @@ +MRP operations extension module +=============================== + +This module adds: + +- New table to store operations to avoid typing them again. +- Adds a relation from WorkcenterLines to BOM Lists. +- Adds a relation from WorkcenterLines to Manufacturing Orders in Scheduled/Consumed/Finished Products. +- Adds a relation between Routing Work Center Lines and Work Center extra Info. diff --git a/mrp_operations_extension/__openerp__.py b/mrp_operations_extension/__openerp__.py index 23e882640..d34f3a86c 100644 --- a/mrp_operations_extension/__openerp__.py +++ b/mrp_operations_extension/__openerp__.py @@ -20,32 +20,24 @@ { "name": "MRP Operations Extension", "version": "1.0", - "description": """ -This module adds: - - - New table to store operations to avoid typing them again. - - Adds a relation from WorkcenterLines to BOM Lists. - - Adds a relation from WorkcenterLines to Manufacturing Orders in - Scheduled/Consumed/Finished Products. - - Adds a relation between Routing Work Center Lines and Work Center extra - Info. - - """, "category": "Manufacturing", - "data": ['wizard/mrp_workorder_produce_view.xml', - 'views/mrp_workcenter_view.xml', - 'views/mrp_routing_operation_view.xml', - 'views/mrp_production_view.xml', - 'views/mrp_bom_view.xml', - 'views/mrp_routing_workcenter_view.xml', - 'security/ir.model.access.csv' - ], + "data": [ + "wizard/mrp_workorder_produce_view.xml", + "views/mrp_workcenter_view.xml", + "views/mrp_routing_operation_view.xml", + "views/mrp_production_view.xml", + "views/mrp_bom_view.xml", + "views/mrp_routing_workcenter_view.xml", + "security/ir.model.access.csv" + ], "author": "OdooMRP team", "website": "http://www.odoomrp.com", "contributors": [ "Daniel Campos ", "Mikel Arregi ", "Oihane Crucelaegui ", + "Pedro M. Baeza ", + "Ana Juaristi ", ], "depends": [ "mrp_operations", diff --git a/mrp_operations_extension/models/mrp_bom.py b/mrp_operations_extension/models/mrp_bom.py index 3a1674878..e9d78a3e4 100644 --- a/mrp_operations_extension/models/mrp_bom.py +++ b/mrp_operations_extension/models/mrp_bom.py @@ -16,7 +16,7 @@ # ############################################################################## -from openerp import models, fields, tools, api +from openerp import models, fields, api class MrpBom(models.Model): @@ -46,11 +46,12 @@ class MrpBom(models.Model): routing_line_id = routing_lines[0].id elif len(routing_lines) > 1: for routing_line in routing_lines: - name_val = tools.ustr(routing_line.name) + ' - ' + name_val = '%s - ' % (routing_line.name) if name_val in work_order['name']: routing_line_id = routing_line.id break - work_order['routing_wc_line'] = routing_line_id + if 'routing_wc_line' not in work_order: + work_order['routing_wc_line'] = routing_line_id return result2 diff --git a/mrp_operations_extension/models/mrp_production.py b/mrp_operations_extension/models/mrp_production.py index 1fd8b98cb..1d13604e2 100644 --- a/mrp_operations_extension/models/mrp_production.py +++ b/mrp_operations_extension/models/mrp_production.py @@ -27,10 +27,12 @@ class MrpProduction(models.Model): res = super(MrpProduction, self)._action_compute_lines(properties=properties) self._get_workorder_in_product_lines(self.workcenter_lines, - self.product_lines) + self.product_lines, + properties=properties) return res - def _get_workorder_in_product_lines(self, workcenter_lines, product_lines): + def _get_workorder_in_product_lines(self, workcenter_lines, product_lines, + properties=None): for p_line in product_lines: for bom_line in self.bom_id.bom_line_ids: if bom_line.product_id.id == p_line.product_id.id: @@ -38,6 +40,18 @@ class MrpProduction(models.Model): if wc_line.routing_wc_line.id == bom_line.operation.id: p_line.work_order = wc_line.id break + elif bom_line.type == 'phantom': + bom_obj = self.env['mrp.bom'] + bom_id = bom_obj._bom_find( + product_id=bom_line.product_id.id, + properties=properties) + for bom_line2 in bom_obj.browse(bom_id).bom_line_ids: + if bom_line2.product_id.id == p_line.product_id.id: + for wc_line in workcenter_lines: + if (wc_line.routing_wc_line.id == + bom_line2.operation.id): + p_line.work_order = wc_line.id + break def _get_workorder_in_move_lines(self, product_lines, move_lines): for move_line in move_lines: diff --git a/mrp_operations_extension/views/mrp_bom_view.xml b/mrp_operations_extension/views/mrp_bom_view.xml index ba4bde865..e4250fb97 100644 --- a/mrp_operations_extension/views/mrp_bom_view.xml +++ b/mrp_operations_extension/views/mrp_bom_view.xml @@ -2,13 +2,16 @@ - + mrp.bom.form.inh mrp.bom - - + + diff --git a/mrp_operations_extension/views/mrp_production_view.xml b/mrp_operations_extension/views/mrp_production_view.xml index 75821e6d3..427c21a7e 100644 --- a/mrp_operations_extension/views/mrp_production_view.xml +++ b/mrp_operations_extension/views/mrp_production_view.xml @@ -8,7 +8,8 @@ - + @@ -19,7 +20,9 @@ - + + @@ -32,22 +35,22 @@ - + - + - + - +