diff --git a/mrp_operations_extension/__init__.py b/mrp_operations_extension/__init__.py
new file mode 100644
index 000000000..3543e95f4
--- /dev/null
+++ b/mrp_operations_extension/__init__.py
@@ -0,0 +1,24 @@
+
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2008-2014 AvanzOSC (Daniel). All Rights Reserved
+# Date: 10/07/2014
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/.
+#
+##############################################################################
+
+from . import models
diff --git a/mrp_operations_extension/__openerp__.py b/mrp_operations_extension/__openerp__.py
new file mode 100644
index 000000000..bbcb1d3ea
--- /dev/null
+++ b/mrp_operations_extension/__openerp__.py
@@ -0,0 +1,51 @@
+
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2008-2014 AvanzOSC (Daniel). All Rights Reserved
+# Date: 10/07/2014
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/.
+#
+##############################################################################
+
+{
+ "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.
+
+ - Add a relation between Routing Work Center Lines and Work Center extra
+ Info.
+
+ """,
+ 'author': 'OdooMRP team',
+ 'website': "http://www.odoomrp.com",
+ "depends": ['mrp_operations', 'mrp'],
+ "category": "Manufacturing",
+ "data": ['views/mrp_workcenter_view.xml',
+ 'views/mrp_routing_operation_view.xml',
+ 'views/mrp_production_view.xml',
+ 'views/mrp_bom_view.xml',
+ 'views/mrp_workcenter_view.xml',
+ 'views/mrp_routing_workcenter_view.xml',
+ ],
+ "installable": True
+}
diff --git a/mrp_operations_extension/models/__init__.py b/mrp_operations_extension/models/__init__.py
new file mode 100644
index 000000000..b83c5acde
--- /dev/null
+++ b/mrp_operations_extension/models/__init__.py
@@ -0,0 +1,25 @@
+
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/.
+#
+##############################################################################
+
+from . import mrp_routing_operation
+from . import stock_move
+from . import mrp_routing_workcenter
+from . import mrp_production
+from . import mrp_bom
+from . import mrp_workcenter
diff --git a/mrp_operations_extension/models/mrp_bom.py b/mrp_operations_extension/models/mrp_bom.py
new file mode 100644
index 000000000..db5ba33fa
--- /dev/null
+++ b/mrp_operations_extension/models/mrp_bom.py
@@ -0,0 +1,62 @@
+
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2008-2014 AvanzOSC (Daniel). All Rights Reserved
+# Date: 10/07/2014
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/.
+#
+##############################################################################
+
+from openerp import models, fields, tools
+
+
+class MrpBom(models.Model):
+ _inherit = 'mrp.bom'
+
+ def _bom_explode(self, cr, uid, bom, product, factor, properties=None,
+ level=0, routing_id=False, previous_products=None,
+ master_bom=None, context=None):
+ routing_line_obj = self.pool['mrp.routing.workcenter']
+ res = super(MrpBom, self)._bom_explode(cr, uid, bom, product, factor,
+ properties=None, level=0,
+ routing_id=False,
+ previous_products=None,
+ master_bom=None,
+ context=context)
+ result, result2 = res
+ for work_order in result2:
+ seq = work_order['sequence'] - level
+ routing_lines = routing_line_obj.search(cr, uid, [
+ ('routing_id', '=', routing_id), ('sequence', '=', seq)])
+ routing_line_id = False
+ if len(routing_lines) == 1:
+ routing_line_id = routing_lines[0]
+ elif len(routing_lines) > 1:
+ for routing_line in routing_line_obj.browse(cr, uid,
+ routing_lines):
+ name_val = tools.ustr(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
+ return result, result2
+
+
+class MrpBomLine(models.Model):
+ _inherit = 'mrp.bom.line'
+
+ operation = fields.Many2one('mrp.routing.workcenter', 'Consumed')
diff --git a/mrp_operations_extension/models/mrp_production.py b/mrp_operations_extension/models/mrp_production.py
new file mode 100644
index 000000000..5428a345c
--- /dev/null
+++ b/mrp_operations_extension/models/mrp_production.py
@@ -0,0 +1,69 @@
+
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Daniel Campos (danielcampos@avanzosc.es) Date: 28/08/2014
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/.
+#
+##############################################################################
+
+from openerp import models, fields, api
+
+
+class MrpProduction(models.Model):
+ _inherit = 'mrp.production'
+
+ @api.multi
+ def _action_compute_lines(self, properties=None):
+ res = super(MrpProduction,
+ self)._action_compute_lines(properties=properties)
+ workcenter_lines = self.workcenter_lines
+ product_lines = self.product_lines
+ for p_line in product_lines:
+ mrp_bom = self.env['mrp.bom'].search([
+ ('routing_id', '=', self.routing_id.id),
+ ('product_tmpl_id', '=', self.product_id.product_tmpl_id.id)])
+ for bom_line in mrp_bom[0].bom_line_ids:
+ if bom_line.product_id.id == p_line.product_id.id:
+ for wc_line in workcenter_lines:
+ if wc_line.routing_wc_line.id == bom_line.operation.id:
+ p_line.work_order = wc_line.id
+ break
+ return res
+
+ @api.multi
+ def action_confirm(self):
+ res = super(MrpProduction, self).action_confirm()
+ for move_line in self.move_lines:
+ for product_line in self.product_lines:
+ if product_line.product_id.id == move_line.product_id.id:
+ move_line.work_order = product_line.work_order.id
+ return res
+
+
+class MrpProductionProductLine(models.Model):
+ _inherit = 'mrp.production.product.line'
+
+ work_order = fields.Many2one('mrp.production.workcenter.line',
+ 'Work Order')
+
+
+class mrp_production_workcenter_line(models.Model):
+ _inherit = 'mrp.production.workcenter.line'
+
+ product_line = fields.One2many('mrp.production.product.line',
+ 'work_order', string='Product Lines')
+ routing_wc_line = fields.Many2one('mrp.routing.workcenter',
+ string='Routing WC Line')
diff --git a/mrp_operations_extension/models/mrp_routing_operation.py b/mrp_operations_extension/models/mrp_routing_operation.py
new file mode 100644
index 000000000..a695989b7
--- /dev/null
+++ b/mrp_operations_extension/models/mrp_routing_operation.py
@@ -0,0 +1,66 @@
+
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Daniel Campos (danielcampos@avanzosc.es) Date: 12/09/2014
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/.
+#
+##############################################################################
+
+from openerp import models, fields, api, exceptions
+
+
+class MrpOperationWorkcenter(models.Model):
+ _name = 'mrp.operation.workcenter'
+ _description = 'MRP Operation Workcenter'
+
+ workcenter = fields.Many2one('mrp.workcenter', string='Work Center')
+ routing_workcenter = fields.Many2one('mrp.routing.workcenter',
+ 'Routing Workcenter')
+ time_efficiency = fields.Float('Efficiency Factor')
+ capacity_per_cycle = fields.Float('Capacity per Cycle')
+ time_cycle = fields.Float('Time for 1 cycle (hour)',
+ help="Time in hours for doing one cycle.")
+ time_start = fields.Float('Time before prod.',
+ help="Time in hours for the setup.")
+ time_stop = fields.Float('Time after prod.',
+ help="Time in hours for the cleaning.")
+ op_number = fields.Integer('Número de Persona', default='0')
+ default = fields.Boolean('Default')
+
+ @api.one
+ @api.onchange('workcenter')
+ def onchange_workcenter(self):
+ if self.workcenter:
+ self.capacity_per_cycle = self.workcenter.capacity_per_cycle
+ self.time_efficiency = self.workcenter.time_efficiency
+ self.time_cycle = self.workcenter.time_cycle
+ self.time_start = self.workcenter.time_start
+ self.time_stop = self.workcenter.time_stop
+ self.default = False
+
+
+class MrpRoutingOperation(models.Model):
+ _name = 'mrp.routing.operation'
+ _description = 'MRP Routing Operation'
+
+ name = fields.Char('Name', required=True)
+ code = fields.Char('Code')
+ description = fields.Text('Description')
+ steps = fields.Text('Relevant Steps')
+ workcenters = fields.Many2many(
+ 'mrp.workcenter', 'mrp_operation_workcenter_rel', 'operation',
+ 'workcenter', 'Work centers')
+ op_number = fields.Integer('Número de Persona', default='0')
diff --git a/mrp_operations_extension/models/mrp_routing_workcenter.py b/mrp_operations_extension/models/mrp_routing_workcenter.py
new file mode 100644
index 000000000..037cfcb83
--- /dev/null
+++ b/mrp_operations_extension/models/mrp_routing_workcenter.py
@@ -0,0 +1,83 @@
+
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2008-2014 AvanzOSC (Daniel). All Rights Reserved
+# Date: 10/07/2014
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/.
+#
+##############################################################################
+
+from openerp import models, fields, api, exceptions, _
+
+
+class MrpRoutingWorkcenter(models.Model):
+ _inherit = 'mrp.routing.workcenter'
+
+ operation = fields.Many2one('mrp.routing.operation', string='Operation')
+ op_wc_lines = fields.One2many('mrp.operation.workcenter',
+ 'routing_workcenter',
+ 'Workcenter Info Lines')
+
+ @api.one
+ @api.onchange('operation')
+ def onchange_operation(self):
+ if self.operation:
+ self.name = self.operation.name
+ self.note = self.operation.description
+ op_wc_lst = []
+ data = {}
+ for operation_wc in self.operation.workcenters:
+ data = {'workcenter': operation_wc.id,
+ 'capacity_per_cycle': operation_wc.capacity_per_cycle,
+ 'time_efficiency': operation_wc.time_efficiency,
+ 'time_cycle': operation_wc.time_cycle,
+ 'time_start': operation_wc.time_start,
+ 'time_stop': operation_wc.time_stop,
+ 'default': False,
+ 'op_number': self.operation.op_number
+ }
+ op_wc_lst.append(data)
+ self.op_wc_lines = op_wc_lst
+
+ @api.multi
+ @api.onchange('op_wc_lines')
+ def onchange_default(self):
+ for record in self:
+ kont = 0
+ wkc = False
+ for opwc_line in record.op_wc_lines:
+ if opwc_line.default:
+ kont += 1
+ if not wkc:
+ record.workcenter_id = opwc_line.workcenter.id
+ if kont > 1:
+ raise exceptions.Warning(_('There is another line set as '
+ 'default, disable it first.'))
+
+ @api.one
+ @api.constrains('op_wc_lines')
+ def _check_default(self):
+ kont = 0
+ wkc = False
+ for opwc_line in self.op_wc_lines:
+ if opwc_line.default:
+ kont += 1
+ if not wkc:
+ self.workcenter_id = opwc_line.workcenter.id
+ if kont > 1:
+ raise exceptions.Warning(_('There is another line set as '
+ 'default, disable it first.'))
diff --git a/mrp_operations_extension/models/mrp_workcenter.py b/mrp_operations_extension/models/mrp_workcenter.py
new file mode 100644
index 000000000..4adde98a4
--- /dev/null
+++ b/mrp_operations_extension/models/mrp_workcenter.py
@@ -0,0 +1,36 @@
+
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2008-2014 AvanzOSC (Daniel). All Rights Reserved
+# Date: 10/07/2014
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/.
+#
+##############################################################################
+
+from openerp import models, fields
+
+
+class MrpWorkcenter(models.Model):
+ _inherit = 'mrp.workcenter'
+
+ pre_op_product = fields.Many2one('product.product',
+ string='Pre Operation Cost')
+ post_op_product = fields.Many2one('product.product',
+ string='Post Operation Cost')
+ rt_operations = fields.Many2many(
+ 'mrp.routing.operation', 'mrp_operation_workcenter_rel', 'workcenter',
+ 'operation', 'Routing Operations')
diff --git a/mrp_operations_extension/models/stock_move.py b/mrp_operations_extension/models/stock_move.py
new file mode 100644
index 000000000..42ebe1fec
--- /dev/null
+++ b/mrp_operations_extension/models/stock_move.py
@@ -0,0 +1,29 @@
+
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Daniel Campos (danielcampos@avanzosc.es) Date: 25/08/2014
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/.
+#
+##############################################################################
+
+from openerp import models, fields
+
+
+class StockMove(models.Model):
+ _inherit = "stock.move"
+
+ work_order = fields.Many2one('mrp.production.workcenter.line',
+ string='Work Order')
diff --git a/mrp_operations_extension/views/mrp_bom_view.xml b/mrp_operations_extension/views/mrp_bom_view.xml
new file mode 100644
index 000000000..ba4bde865
--- /dev/null
+++ b/mrp_operations_extension/views/mrp_bom_view.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+ mrp.bom.form.inh
+ mrp.bom
+
+
+
+
+
+
+
+
+
+
diff --git a/mrp_operations_extension/views/mrp_operation_workcenter_view.xml b/mrp_operations_extension/views/mrp_operation_workcenter_view.xml
new file mode 100644
index 000000000..6e75f880b
--- /dev/null
+++ b/mrp_operations_extension/views/mrp_operation_workcenter_view.xml
@@ -0,0 +1,38 @@
+
+
+
+
+ rountig.operation.tree
+ mrp.operation.workcenter
+
+
+
+
+
+
+
+ rountig.operation.tree
+ mrp.operation.workcenter
+
+
+
+
+
+
+ Workcenter Operation
+ ir.actions.act_window
+ mrp.operation.workcenter
+ form
+ tree,form
+
+
+
diff --git a/mrp_operations_extension/views/mrp_production_view.xml b/mrp_operations_extension/views/mrp_production_view.xml
new file mode 100644
index 000000000..f3960e27e
--- /dev/null
+++ b/mrp_operations_extension/views/mrp_production_view.xml
@@ -0,0 +1,70 @@
+
+
+
+
+ mrp.production.product.tree.view.inh
+
+ mrp.production.product.line
+
+
+
+
+
+
+
+
+ mrp.production.product.form.view.inh
+
+ mrp.production.product.line
+
+
+
+
+
+
+
+
+
+ mrp.production.form.view.inh
+ mrp.production
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mrp_operations_extension/views/mrp_routing_operation_view.xml b/mrp_operations_extension/views/mrp_routing_operation_view.xml
new file mode 100644
index 000000000..43c41b4b7
--- /dev/null
+++ b/mrp_operations_extension/views/mrp_routing_operation_view.xml
@@ -0,0 +1,47 @@
+
+
+
+
+ rountig.operation.tree
+ mrp.routing.operation
+
+
+
+
+
+
+
+
+
+ rountig.operation.form
+ mrp.routing.operation
+
+
+
+
+
+
+ Routing Operation
+ ir.actions.act_window
+ mrp.routing.operation
+ form
+ tree,form
+
+
+
+
+
diff --git a/mrp_operations_extension/views/mrp_routing_workcenter_view.xml b/mrp_operations_extension/views/mrp_routing_workcenter_view.xml
new file mode 100644
index 000000000..ccfb50c6e
--- /dev/null
+++ b/mrp_operations_extension/views/mrp_routing_workcenter_view.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+ mrp.routing.workcenter.tree.inh
+ mrp.routing.workcenter
+
+
+
+
+
+
+
+
+
+ mrp.routing.workcenter.form.inh
+ mrp.routing.workcenter
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mrp_operations_extension/views/mrp_workcenter_view.xml b/mrp_operations_extension/views/mrp_workcenter_view.xml
new file mode 100644
index 000000000..220c7214f
--- /dev/null
+++ b/mrp_operations_extension/views/mrp_workcenter_view.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+ mrp.workcenter.tree.inh
+ mrp.workcenter
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+