diff --git a/mrp_bom_version/__init__.py b/mrp_bom_version/__init__.py
new file mode 100644
index 000000000..c58ee95de
--- /dev/null
+++ b/mrp_bom_version/__init__.py
@@ -0,0 +1,18 @@
+# -*- 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/.
+#
+##############################################################################
+from . import models
diff --git a/mrp_bom_version/__openerp__.py b/mrp_bom_version/__openerp__.py
new file mode 100644
index 000000000..54d5ab046
--- /dev/null
+++ b/mrp_bom_version/__openerp__.py
@@ -0,0 +1,53 @@
+# -*- 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/.
+#
+##############################################################################
+{
+ "name": "MRP BoM Version",
+ "version": "1.0",
+ "author": "OdooMRP team",
+ "category": "MRP",
+ "website": "http://www.odoomrp.com",
+ "description": """
+ This module performs the following:
+
+ 1.- In the MRP BoM list object, 3 new fields are added:
+
+ 1.1.- Review, of type integer, defined by hand. When saving the list
+ verified that there is another with the same sequence.
+ 1.2.- Historical Date, of type date.
+ 1.3.- Status, of type selection, with these values: draft, in active
+ and historical. This new field has gotten because it has added a
+ workflow to MRP BoM list object.
+
+ 2.- In the MRP bom List object, a workflow is added, is this:
+
+ 2.1.- Draft -> In Active -> Historical, and you can not go back.
+
+ You can only modify the components and / or production process if it is in
+ draft status. The other fields can only be changed if they are not in
+ historical state.
+ when the MRP BoM list is put to active, a record of who has activated,
+ and when will include in chatter/log.
+ """,
+ "depends": ['mrp',
+ ],
+ "data": ['data/mrp_bom_data.xml',
+ 'data/mrp_bom_workflow.xml',
+ 'views/mrp_bom_view.xml',
+ ],
+ "installable": True
+}
diff --git a/mrp_bom_version/data/mrp_bom_data.xml b/mrp_bom_version/data/mrp_bom_data.xml
new file mode 100644
index 000000000..2fe6424ca
--- /dev/null
+++ b/mrp_bom_version/data/mrp_bom_data.xml
@@ -0,0 +1,11 @@
+
+
+
+
+ MRP BoM Active
+ mrp.bom
+
+ MRP BoM Active
+
+
+
diff --git a/mrp_bom_version/data/mrp_bom_workflow.xml b/mrp_bom_version/data/mrp_bom_workflow.xml
new file mode 100644
index 000000000..f06bf7132
--- /dev/null
+++ b/mrp_bom_version/data/mrp_bom_workflow.xml
@@ -0,0 +1,40 @@
+
+
+
+
+ mrp.bom.basic
+ mrp.bom
+ True
+
+
+
+ True
+ draft
+ function
+ action_draft()
+
+
+
+ active
+ function
+ action_active()
+
+
+
+ True
+ historical
+ function
+ action_historical()
+
+
+
+
+ button_active
+
+
+
+
+ button_historical
+
+
+
\ No newline at end of file
diff --git a/mrp_bom_version/i18n/es.po b/mrp_bom_version/i18n/es.po
new file mode 100644
index 000000000..a551e0ec6
--- /dev/null
+++ b/mrp_bom_version/i18n/es.po
@@ -0,0 +1,95 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * mrp_bom_version
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-10-23 14:36+0000\n"
+"PO-Revision-Date: 2014-10-23 16:40+0100\n"
+"Last-Translator: Alfredo \n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+
+#. module: mrp_bom_version
+#: view:mrp.bom:mrp_bom_version.view_mrp_bom_filter_inh_version
+#: selection:mrp.bom,state:0
+msgid "Active"
+msgstr "Activo"
+
+#. module: mrp_bom_version
+#: model:ir.model,name:mrp_bom_version.model_mrp_bom
+msgid "Bill of Material"
+msgstr "Lista de material"
+
+#. module: mrp_bom_version
+#: selection:mrp.bom,state:0
+msgid "Draft"
+msgstr "Borrador"
+
+#. module: mrp_bom_version
+#: view:mrp.bom:mrp_bom_version.mrp_bom_form_view_inh_version
+#: selection:mrp.bom,state:0
+msgid "Historical"
+msgstr "Histórica"
+
+#. module: mrp_bom_version
+#: field:mrp.bom,historical_date:0
+msgid "Historical Date"
+msgstr "Fecha historificación"
+
+#. module: mrp_bom_version
+#: view:mrp.bom:mrp_bom_version.mrp_bom_form_view_inh_version
+msgid "In active"
+msgstr "En activo"
+
+#. module: mrp_bom_version
+#: view:mrp.bom:mrp_bom_version.mrp_bom_tree_view
+msgid "MRP BoMs"
+msgstr "MRP LdMs"
+
+#. module: mrp_bom_version
+#: model:ir.model,name:mrp_bom_version.model_mrp_production
+msgid "Manufacturing Order"
+msgstr "Órden de producción"
+
+#. module: mrp_bom_version
+#: view:mrp.bom:mrp_bom_version.view_mrp_bom_filter_inh_version
+msgid "Product"
+msgstr "Producto"
+
+#. module: mrp_bom_version
+#: field:mrp.bom,review:0
+msgid "Review"
+msgstr "Revisión"
+
+#. module: mrp_bom_version
+#: view:mrp.bom:mrp_bom_version.view_mrp_bom_filter_inh_version
+msgid "State"
+msgstr "Estado"
+
+#. module: mrp_bom_version
+#: field:mrp.bom,state:0
+msgid "Status"
+msgstr "Estatus"
+
+#. module: mrp_bom_version
+#: code:addons/mrp_bom_version/models/mrp.py:49
+#, python-format
+msgid "The version number must be unique"
+msgstr "El número de versión debe ser única"
+
+#. module: mrp_bom_version
+#: view:mrp.bom:mrp_bom_version.mrp_bom_form_view_inh_version
+msgid "{'readonly':[('state', '!=', 'draft')]}"
+msgstr "{'readonly':[('state', '!=', 'draft')]}"
+
+#. module: mrp_bom_version
+#: view:mrp.bom:mrp_bom_version.mrp_bom_form_view_inh_version
+msgid "{'readonly':[('state', '=', 'historical')]}"
+msgstr "{'readonly':[('state', '=', 'historical')]}"
+
diff --git a/mrp_bom_version/i18n/mrp_bom_version.pot b/mrp_bom_version/i18n/mrp_bom_version.pot
new file mode 100644
index 000000000..f99295cce
--- /dev/null
+++ b/mrp_bom_version/i18n/mrp_bom_version.pot
@@ -0,0 +1,95 @@
+# Translation of Odoo Server.
+# This file contains the translation of the following modules:
+# * mrp_bom_version
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Odoo Server 8.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-10-23 14:35+0000\n"
+"PO-Revision-Date: 2014-10-23 14:35+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: mrp_bom_version
+#: view:mrp.bom:mrp_bom_version.view_mrp_bom_filter_inh_version
+#: selection:mrp.bom,state:0
+msgid "Active"
+msgstr ""
+
+#. module: mrp_bom_version
+#: model:ir.model,name:mrp_bom_version.model_mrp_bom
+msgid "Bill of Material"
+msgstr ""
+
+#. module: mrp_bom_version
+#: selection:mrp.bom,state:0
+msgid "Draft"
+msgstr ""
+
+#. module: mrp_bom_version
+#: view:mrp.bom:mrp_bom_version.mrp_bom_form_view_inh_version
+#: selection:mrp.bom,state:0
+msgid "Historical"
+msgstr ""
+
+#. module: mrp_bom_version
+#: field:mrp.bom,historical_date:0
+msgid "Historical Date"
+msgstr ""
+
+#. module: mrp_bom_version
+#: view:mrp.bom:mrp_bom_version.mrp_bom_form_view_inh_version
+msgid "In active"
+msgstr ""
+
+#. module: mrp_bom_version
+#: view:mrp.bom:mrp_bom_version.mrp_bom_tree_view
+msgid "MRP BoMs"
+msgstr ""
+
+#. module: mrp_bom_version
+#: model:ir.model,name:mrp_bom_version.model_mrp_production
+msgid "Manufacturing Order"
+msgstr ""
+
+#. module: mrp_bom_version
+#: view:mrp.bom:mrp_bom_version.view_mrp_bom_filter_inh_version
+msgid "Product"
+msgstr ""
+
+#. module: mrp_bom_version
+#: field:mrp.bom,review:0
+msgid "Review"
+msgstr ""
+
+#. module: mrp_bom_version
+#: view:mrp.bom:mrp_bom_version.view_mrp_bom_filter_inh_version
+msgid "State"
+msgstr ""
+
+#. module: mrp_bom_version
+#: field:mrp.bom,state:0
+msgid "Status"
+msgstr ""
+
+#. module: mrp_bom_version
+#: code:addons/mrp_bom_version/models/mrp.py:49
+#, python-format
+msgid "The version number must be unique"
+msgstr ""
+
+#. module: mrp_bom_version
+#: view:mrp.bom:mrp_bom_version.mrp_bom_form_view_inh_version
+msgid "{'readonly':[('state', '!=', 'draft')]}"
+msgstr ""
+
+#. module: mrp_bom_version
+#: view:mrp.bom:mrp_bom_version.mrp_bom_form_view_inh_version
+msgid "{'readonly':[('state', '=', 'historical')]}"
+msgstr ""
+
diff --git a/mrp_bom_version/models/__init__.py b/mrp_bom_version/models/__init__.py
new file mode 100644
index 000000000..86314fbb3
--- /dev/null
+++ b/mrp_bom_version/models/__init__.py
@@ -0,0 +1,18 @@
+# -*- 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/.
+#
+##############################################################################
+from . import mrp
diff --git a/mrp_bom_version/models/mrp.py b/mrp_bom_version/models/mrp.py
new file mode 100644
index 000000000..b63ef0c83
--- /dev/null
+++ b/mrp_bom_version/models/mrp.py
@@ -0,0 +1,116 @@
+# -*- 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see http://www.gnu.org/licenses/.
+#
+##############################################################################
+from openerp import models, fields, api, exceptions, _
+from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
+import time
+
+
+class MrpBom(models.Model):
+ _inherit = 'mrp.bom'
+
+ _track = {
+ 'state': {
+ 'mrp_bom_version.mt_active': lambda self, cr, uid, obj,
+ ctx=None: obj.state == 'active',
+ },
+ }
+
+ review = fields.Integer(string='Review')
+ historical_date = fields.Date(string='Historical Date', readonly=True)
+ state = fields.Selection([('draft', 'Draft'),
+ ('active', 'Active'),
+ ('historical', 'Historical'),
+ ], string='Status', index=True, readonly=True,
+ default='draft', copy=False)
+
+ @api.one
+ @api.constrains('review')
+ def check_mrp_bom_version(self):
+ domain = [('id', '!=', self.id), ('review', '=', self.review)]
+ if self.product_tmpl_id:
+ domain.append(('product_tmpl_id', '=', self.product_tmpl_id.id))
+ else:
+ domain.append(('product_tmpl_id', '=', False))
+ if self.product_id:
+ domain.append(('product_id', '=', self.product_id.id))
+ else:
+ domain.append(('product_id', '=', False))
+ found = self.search(domain)
+ if found:
+ raise exceptions.Warning(
+ _('The version number must be unique'))
+
+ def copy(self, cr, uid, id, default=None, context=None):
+ if default is None:
+ default = {}
+ default.update({'review': 0})
+ return super(MrpBom, self).copy(cr, uid, id, default=default,
+ context=context)
+
+ @api.multi
+ def action_draft(self):
+ return self.write({'state': 'draft'})
+
+ @api.multi
+ def action_active(self):
+ return self.write({'state': 'active'})
+
+ @api.multi
+ def action_historical(self):
+ return self.write({'state': 'historical',
+ 'historical_date': fields.Date.today()})
+
+
+class MrpProduction(models.Model):
+ _inherit = 'mrp.production'
+
+ def product_id_change(self, cr, uid, ids, product_id, product_qty=0,
+ context=None):
+ bom_obj = self.pool['mrp.bom']
+ product_obj = self.pool['product.product']
+ res = super(MrpProduction, self).product_id_change(
+ cr, uid, ids, product_id=product_id, product_qty=product_qty,
+ context=context)
+ if product_id:
+ res['value'].update({'bom_id': False})
+ product_tmpl_id = product_obj.browse(
+ cr, uid, product_id, context=context).product_tmpl_id.id
+ domain = [('state', '=', 'active'),
+ '|',
+ ('product_id', '=', product_id),
+ '&',
+ ('product_id', '=', False),
+ ('product_tmpl_id', '=', product_tmpl_id)
+ ]
+ domain = domain + ['|', ('date_start', '=', False),
+ ('date_start', '<=',
+ time.strftime(DEFAULT_SERVER_DATETIME_FORMAT)),
+ '|', ('date_stop', '=', False),
+ ('date_stop', '>=',
+ time.strftime(
+ DEFAULT_SERVER_DATETIME_FORMAT))]
+ bom_ids = bom_obj.search(cr, uid, domain, context=context)
+ bom_id = 0
+ min_seq = 0
+ for bom in bom_obj.browse(cr, uid, bom_ids, context=context):
+ if min_seq == 0 or bom.sequence < min_seq:
+ min_seq = bom.sequence
+ bom_id = bom.id
+ if bom_id > 0:
+ res['value'].update({'bom_id': bom_id})
+ return res
diff --git a/mrp_bom_version/views/mrp_bom_view.xml b/mrp_bom_version/views/mrp_bom_view.xml
new file mode 100644
index 000000000..f9483b65e
--- /dev/null
+++ b/mrp_bom_version/views/mrp_bom_view.xml
@@ -0,0 +1,113 @@
+
+
+
+
+ mrp.bom.tree.view
+ mrp.bom
+
+
+
+
+
+
+
+
+
+
+
+ mrp.bom.form.view.inh.version
+ mrp.bom
+
+
+
+
+
+
+
+
+
+
+
+
+ {'readonly':[('state', '=', 'historical')]}
+
+
+ {'readonly':[('state', '=', 'historical')]}
+
+
+ {'readonly':[('state', '=', 'historical')]}
+
+
+ {'readonly':[('state', '=', 'historical')]}
+
+
+ {'readonly':[('state', '!=', 'draft')]}
+
+
+ {'readonly':[('state', '=', 'historical')]}
+
+
+ {'readonly':[('state', '=', 'historical')]}
+
+
+ {'readonly':[('state', '=', 'historical')]}
+
+
+ {'readonly':[('state', '=', 'historical')]}
+
+
+ {'readonly':[('state', '!=', 'draft')]}
+
+
+ {'readonly':[('state', '=', 'historical')]}
+
+
+ {'readonly':[('state', '=', 'historical')]}
+
+
+ {'readonly':[('state', '=', 'historical')]}
+
+
+ {'readonly':[('state', '=', 'historical')]}
+
+
+ {'readonly':[('state', '=', 'historical')]}
+
+
+ {'readonly':[('state', '=', 'historical')]}
+
+
+ {'readonly':[('state', '=', 'historical')]}
+
+
+ {'readonly':[('state', '=', 'historical')]}
+
+
+ {'readonly':[('state', '=', 'historical')]}
+
+
+ {'readonly':[('state', '=', 'historical')]}
+
+
+
+
+ view.mrp.bom.filter.inh.version
+ mrp.bom
+
+
+
+
+
+
+
+
+
+
+
+
+
+