From 80efea8d3d11f3eb829dea670f95bf85befb2e9b Mon Sep 17 00:00:00 2001 From: alfredo Date: Wed, 14 Jan 2015 10:29:32 +0100 Subject: [PATCH] [IMP mrp_bom_version] [DEL mrp_bom_version, NEW mrp_bom_state] --- mrp_bom_version/README.rst | 18 ---- mrp_bom_version/__init__.py | 18 ---- mrp_bom_version/__openerp__.py | 32 ------- mrp_bom_version/data/mrp_bom_data.xml | 11 --- mrp_bom_version/i18n/es.po | 96 ------------------- mrp_bom_version/i18n/mrp_bom_version.pot | 96 ------------------- mrp_bom_version/models/__init__.py | 18 ---- mrp_bom_version/models/mrp.py | 98 -------------------- mrp_bom_version/views/mrp_bom_view.xml | 113 ----------------------- 9 files changed, 500 deletions(-) delete mode 100644 mrp_bom_version/README.rst delete mode 100644 mrp_bom_version/__init__.py delete mode 100644 mrp_bom_version/__openerp__.py delete mode 100644 mrp_bom_version/data/mrp_bom_data.xml delete mode 100644 mrp_bom_version/i18n/es.po delete mode 100644 mrp_bom_version/i18n/mrp_bom_version.pot delete mode 100644 mrp_bom_version/models/__init__.py delete mode 100644 mrp_bom_version/models/mrp.py delete mode 100644 mrp_bom_version/views/mrp_bom_view.xml diff --git a/mrp_bom_version/README.rst b/mrp_bom_version/README.rst deleted file mode 100644 index f66a2b32c..000000000 --- a/mrp_bom_version/README.rst +++ /dev/null @@ -1,18 +0,0 @@ -MRP - BoM version -================= - -This module performs the following: - -1.- In the MRP BoM list object, 2 new fields are added: - - 1.1.- Historical Date, of type date. - 1.2.- 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. - -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. -It also adds a constraint for the sequence field to be unique. diff --git a/mrp_bom_version/__init__.py b/mrp_bom_version/__init__.py deleted file mode 100644 index c58ee95de..000000000 --- a/mrp_bom_version/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- 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 deleted file mode 100644 index a9b57c916..000000000 --- a/mrp_bom_version/__openerp__.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- 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": "Manufacturing", - "website": "http://www.odoomrp.com", - "depends": [ - "mrp", - ], - "data": [ - "data/mrp_bom_data.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 deleted file mode 100644 index 2fe6424ca..000000000 --- a/mrp_bom_version/data/mrp_bom_data.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - MRP BoM Active - mrp.bom - - MRP BoM Active - - - diff --git a/mrp_bom_version/i18n/es.po b/mrp_bom_version/i18n/es.po deleted file mode 100644 index 8f25cf7e8..000000000 --- a/mrp_bom_version/i18n/es.po +++ /dev/null @@ -1,96 +0,0 @@ -# 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-11-10 09:13+0000\n" -"PO-Revision-Date: 2014-11-10 10:14+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 -#: model:mail.message.subtype,description:mrp_bom_version.mt_active -#: model:mail.message.subtype,name:mrp_bom_version.mt_active -msgid "MRP BoM Active" -msgstr "MRP BoM Active" - -#. 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 -#: 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:53 -#, python-format -msgid "The sequence must be unique" -msgstr "La secuencia 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 deleted file mode 100644 index a2aa517a0..000000000 --- a/mrp_bom_version/i18n/mrp_bom_version.pot +++ /dev/null @@ -1,96 +0,0 @@ -# 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-11-10 09:13+0000\n" -"PO-Revision-Date: 2014-11-10 09:13+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 -#: model:mail.message.subtype,description:mrp_bom_version.mt_active -#: model:mail.message.subtype,name:mrp_bom_version.mt_active -msgid "MRP BoM 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 -#: 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:53 -#, python-format -msgid "The sequence 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 deleted file mode 100644 index 86314fbb3..000000000 --- a/mrp_bom_version/models/__init__.py +++ /dev/null @@ -1,18 +0,0 @@ -# -*- 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 deleted file mode 100644 index af2fbe70a..000000000 --- a/mrp_bom_version/models/mrp.py +++ /dev/null @@ -1,98 +0,0 @@ -# -*- 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, _ - - -class MrpBom(models.Model): - _inherit = 'mrp.bom' - - _track = { - 'state': { - 'mrp_bom_version.mt_active': lambda self, cr, uid, obj, - ctx=None: obj.state == 'active', - }, - } - - def _get_max_sequence(self): - bom = self.search([], order='sequence desc', limit=1) - maxseq = bom.sequence + 1 - return maxseq - - 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) - sequence = fields.Integer(default=_get_max_sequence, copy=False) - - @api.one - @api.constrains('sequence') - def check_mrp_bom_sequence(self): - domain = [('id', '!=', self.id), ('sequence', '=', self.sequence), - ('product_tmpl_id', '=', self.product_tmpl_id.id), - ('product_id', '=', self.product_id.id)] - if self.search(domain): - raise exceptions.Warning( - _('The sequence must be unique')) - - @api.multi - def button_active(self): - return self.write({'state': 'active'}) - - @api.multi - def button_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', '<=', fields.Datetime.now()), - '|', ('date_stop', '=', False), - ('date_stop', '>=', fields.Datetime.now())] - 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 deleted file mode 100644 index 33764e3b0..000000000 --- a/mrp_bom_version/views/mrp_bom_view.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - - 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 - - - - - - - - - - - - -
-