From f117c16c83edfb2389fbb4977b828607c712f763 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Fri, 13 Nov 2015 22:03:03 +0100 Subject: [PATCH 01/45] [IMP] mrp_hook: Provide hooks for _bom_explode method As we are struggled by the structure of core current code, and https://github.com/odoo/odoo/pull/8885 hasn't been accepted in v8, we need to make this hard move to allow a lot of workarounds like modules not depending this one, but anyway the method itself is not too much inheritable. --- mrp_hook/README.rst | 29 +++++++ mrp_hook/__init__.py | 5 ++ mrp_hook/__openerp__.py | 22 ++++++ mrp_hook/models/__init__.py | 5 ++ mrp_hook/models/mrp_bom.py | 150 ++++++++++++++++++++++++++++++++++++ 5 files changed, 211 insertions(+) create mode 100644 mrp_hook/README.rst create mode 100644 mrp_hook/__init__.py create mode 100644 mrp_hook/__openerp__.py create mode 100644 mrp_hook/models/__init__.py create mode 100644 mrp_hook/models/mrp_bom.py diff --git a/mrp_hook/README.rst b/mrp_hook/README.rst new file mode 100644 index 00000000000..20ead183abd --- /dev/null +++ b/mrp_hook/README.rst @@ -0,0 +1,29 @@ +=============================== +Hooks for enabling advanced MRP +=============================== + +Technical module that provides the proper framework infrastructure (hooks, +fallback, etc) to enable advanced functionality in the manufacturing area, +as https://github.com/odoo/odoo/pull/8885 hasn't been accepted for v8. + +* Hooks in *_bom_explode* method for returning dictionary for consume and + workcenter lines. +* Provide product and template. + +By itself it doesn't provide anything, but serves as base for others modules +to develop its features. + +Known issues / Roadmap +====================== + +* This module fully overwrites _bom_explode method, so any other module + inheriting this method should take that into account. +* On v9, this module can be removed. + +Credits +======= + +Contributors +------------ + +* Pedro M. Baeza diff --git a/mrp_hook/__init__.py b/mrp_hook/__init__.py new file mode 100644 index 00000000000..721dbe492a0 --- /dev/null +++ b/mrp_hook/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# (c) 2015 Serv. Tecnol. Avanzados - Pedro M. Baeza +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from . import models diff --git a/mrp_hook/__openerp__.py b/mrp_hook/__openerp__.py new file mode 100644 index 00000000000..7c573e9ae6c --- /dev/null +++ b/mrp_hook/__openerp__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# (c) 2015 Serv. Tecnol. Avanzados - Pedro M. Baeza +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +{ + "name": "MRP Hooks", + "version": "8.0.1.0.0", + "category": "Hidden", + "author": "OdooMRP team, " + "AvanzOSC, " + "Serv. Tecnol. Avanzados - Pedro M. Baeza", + "website": "http://www.odoomrp.com", + "contributors": [ + "Pedro M. Baeza ", + ], + "depends": [ + "mrp", + ], + "data": [ + ], + "installable": True +} diff --git a/mrp_hook/models/__init__.py b/mrp_hook/models/__init__.py new file mode 100644 index 00000000000..29373fdb132 --- /dev/null +++ b/mrp_hook/models/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# (c) 2015 Serv. Tecnol. Avanzados - Pedro M. Baeza +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from . import mrp_bom diff --git a/mrp_hook/models/mrp_bom.py b/mrp_hook/models/mrp_bom.py new file mode 100644 index 00000000000..8035d77c95d --- /dev/null +++ b/mrp_hook/models/mrp_bom.py @@ -0,0 +1,150 @@ +# -*- coding: utf-8 -*- +# (c) 2015 Serv. Tecnol. Avanzados - Pedro M. Baeza +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +from openerp import models, api, tools, _ +from openerp.exceptions import Warning as UserError +from openerp.addons.product import _common + + +class MrpBom(models.Model): + _inherit = 'mrp.bom' + + @api.model + def _factor(self, factor, product_efficiency, product_rounding): + factor = factor / (product_efficiency or 1.0) + factor = _common.ceiling(factor, product_rounding) + if factor < product_rounding: + factor = product_rounding + return factor + + @api.multi + def _prepare_wc_line(self, wc_use, level=0, factor=1): + self.ensure_one() + wc = wc_use.workcenter_id + d, m = divmod(factor, wc_use.workcenter_id.capacity_per_cycle) + mult = (d + (m and 1.0 or 0.0)) + cycle = mult * wc_use.cycle_nbr + return { + 'name': (tools.ustr(wc_use.name) + ' - ' + + tools.ustr(self.product_tmpl_id.name_get()[0][1])), + 'workcenter_id': wc.id, + 'sequence': level + (wc_use.sequence or 0), + 'cycle': cycle, + 'hour': float( + wc_use.hour_nbr * mult + + (wc.time_start or 0.0) + + (wc.time_stop or 0.0) + + cycle * (wc.time_cycle or 0.0) * (wc.time_efficiency or 1.0)), + } + + @api.model + def _prepare_consume_line(self, bom_line, quantity, factor=1): + uos_qty = (bom_line.product_uos and + self._factor( + bom_line.product_uos_qty * factor, + bom_line.product_efficiency, bom_line.product_rounding)) + return { + 'name': bom_line.product_id.name, + 'product_id': bom_line.product_id.id, + 'product_qty': quantity, + 'product_uom': bom_line.product_uom.id, + 'product_uos_qty': uos_qty or False, + 'product_uos': bom_line.product_uos.id, + } + + @api.model + def _bom_find_prepare(self, bom_line, properties=None): + return self._bom_find( + product_id=bom_line.product_id.id, properties=properties) + + @api.model + def _get_bom_product_name(self, bom_line): + return bom_line.product_id.name_get()[0][1] + + @api.v7 + def _bom_explode(self, cr, uid, bom, product, factor, properties=None, + level=0, routing_id=False, previous_products=None, + master_bom=None, context=None): + return bom._bom_explode( + product, factor, properties=properties, level=level, + routing_id=routing_id, previous_products=previous_products, + master_bom=master_bom) + + @api.v8 + def _bom_explode(self, product, factor, properties=None, level=0, + routing_id=False, previous_products=None, + master_bom=None): + """ Finds Products and Work Centers for related BoM for manufacturing + order. + @param bom: BoM of particular product template. + @param product: Select a particular variant of the BoM. If False use + BoM without variants. + @param factor: Factor represents the quantity, but in UoM of the BoM, + taking into account the numbers produced by the BoM + @param properties: A List of properties Ids. + @param level: Depth level to find BoM lines starts from 10. + @param previous_products: List of product previously use by bom + explore to avoid recursion + @param master_bom: When recursion, used to display the name of the + master bom + @return: result: List of dictionaries containing product details. + result2: List of dictionaries containing Work Center details. + """ + self.ensure_one() + bom = self + uom_obj = self.env["product.uom"] + routing_obj = self.env['mrp.routing'] + master_bom = master_bom or bom + factor = self._factor( + factor, bom.product_efficiency, bom.product_rounding) + result = [] + result2 = [] + routing = ((routing_id and routing_obj.browse(routing_id)) or + bom.routing_id or False) + if routing: + for wc_use in routing.workcenter_lines: + result2.append(self._prepare_wc_line( + wc_use, level=level, factor=factor)) + for bom_line_id in bom.bom_line_ids: + if self._skip_bom_line(bom_line_id, product): + continue + if (set(map(int, bom_line_id.property_ids or [])) - + set(properties or [])): + continue + product_tmpl_id = bom_line_id.product_id.product_tmpl_id.id + if (previous_products and + product_tmpl_id in previous_products): + raise UserError( + _('BoM "%s" contains a BoM line with a product recursion: ' + '"%s".') % (master_bom.name, + bom_line_id.product_id.name_get()[0][1])) + quantity = self._factor( + bom_line_id.product_qty * factor, + bom_line_id.product_efficiency, bom_line_id.product_rounding) + bom_id = self._bom_find_prepare(bom_line_id, properties=properties) + # If BoM should not behave like PhantoM, just add the product, + # otherwise explode further + if (bom_line_id.type != "phantom" and + (not bom_id or self.browse(bom_id).type != "phantom")): + result.append( + self._prepare_consume_line(bom_line_id, quantity, factor)) + elif bom_id: + all_prod = [bom.product_tmpl_id.id] + (previous_products or []) + bom2 = self.browse(bom_id) + # We need to convert to units/UoM of chosen BoM + factor2 = uom_obj._compute_qty( + bom_line_id.product_uom.id, quantity, bom2.product_uom.id) + quantity2 = factor2 / bom2.product_qty + res = bom2._bom_explode( + bom_line_id.product_id, quantity2, properties=properties, + level=level + 10, previous_products=all_prod, + master_bom=master_bom) + result = result + res[0] + result2 = result2 + res[1] + else: + raise UserError( + _('BoM "%s" contains a phantom BoM line but the product ' + '"%s" does not have any BoM defined.') % + (master_bom.name, self._get_bom_product_name(bom_line_id))) + return result, result2 From 96e670ab66ce81c7a0a886e0b5a9b0e7aaf2d20e Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Fri, 20 Nov 2015 21:39:04 +0100 Subject: [PATCH 02/45] OCA Transbot updated translations from Transifex --- mrp_hook/i18n/es.po | 37 +++++++++++++++++++++++++++++++++++++ mrp_hook/i18n/it.po | 37 +++++++++++++++++++++++++++++++++++++ mrp_hook/i18n/pt_BR.po | 37 +++++++++++++++++++++++++++++++++++++ mrp_hook/i18n/ro.po | 38 ++++++++++++++++++++++++++++++++++++++ mrp_hook/i18n/sl.po | 38 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 187 insertions(+) create mode 100644 mrp_hook/i18n/es.po create mode 100644 mrp_hook/i18n/it.po create mode 100644 mrp_hook/i18n/pt_BR.po create mode 100644 mrp_hook/i18n/ro.po create mode 100644 mrp_hook/i18n/sl.po diff --git a/mrp_hook/i18n/es.po b/mrp_hook/i18n/es.po new file mode 100644 index 00000000000..779847fce25 --- /dev/null +++ b/mrp_hook/i18n/es.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_hook +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: odoomrp-wip (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-11-20 17:16+0000\n" +"PO-Revision-Date: 2015-11-13 21:25+0000\n" +"Last-Translator: <>\n" +"Language-Team: Spanish (http://www.transifex.com/oca/odoomrp-wip-8-0/language/es/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: es\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mrp_hook +#: model:ir.model,name:mrp_hook.model_mrp_bom +msgid "Bill of Material" +msgstr "Lista de material" + +#. module: mrp_hook +#: code:addons/mrp_hook/models/mrp_bom.py:119 +#, python-format +msgid "BoM \"%s\" contains a BoM line with a product recursion: \"%s\"." +msgstr "" + +#. module: mrp_hook +#: code:addons/mrp_hook/models/mrp_bom.py:147 +#, python-format +msgid "" +"BoM \"%s\" contains a phantom BoM line but the product \"%s\" does not have " +"any BoM defined." +msgstr "" diff --git a/mrp_hook/i18n/it.po b/mrp_hook/i18n/it.po new file mode 100644 index 00000000000..22f8ee85c4e --- /dev/null +++ b/mrp_hook/i18n/it.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_hook +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: odoomrp-wip (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-11-20 17:16+0000\n" +"PO-Revision-Date: 2015-11-13 21:25+0000\n" +"Last-Translator: <>\n" +"Language-Team: Italian (http://www.transifex.com/oca/odoomrp-wip-8-0/language/it/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: it\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: mrp_hook +#: model:ir.model,name:mrp_hook.model_mrp_bom +msgid "Bill of Material" +msgstr "Distinta base" + +#. module: mrp_hook +#: code:addons/mrp_hook/models/mrp_bom.py:119 +#, python-format +msgid "BoM \"%s\" contains a BoM line with a product recursion: \"%s\"." +msgstr "" + +#. module: mrp_hook +#: code:addons/mrp_hook/models/mrp_bom.py:147 +#, python-format +msgid "" +"BoM \"%s\" contains a phantom BoM line but the product \"%s\" does not have " +"any BoM defined." +msgstr "" diff --git a/mrp_hook/i18n/pt_BR.po b/mrp_hook/i18n/pt_BR.po new file mode 100644 index 00000000000..05aebdfcf0a --- /dev/null +++ b/mrp_hook/i18n/pt_BR.po @@ -0,0 +1,37 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_hook +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: odoomrp-wip (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-11-20 17:16+0000\n" +"PO-Revision-Date: 2015-11-13 21:25+0000\n" +"Last-Translator: <>\n" +"Language-Team: Portuguese (Brazil) (http://www.transifex.com/oca/odoomrp-wip-8-0/language/pt_BR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: pt_BR\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: mrp_hook +#: model:ir.model,name:mrp_hook.model_mrp_bom +msgid "Bill of Material" +msgstr "Lista de materiais" + +#. module: mrp_hook +#: code:addons/mrp_hook/models/mrp_bom.py:119 +#, python-format +msgid "BoM \"%s\" contains a BoM line with a product recursion: \"%s\"." +msgstr "" + +#. module: mrp_hook +#: code:addons/mrp_hook/models/mrp_bom.py:147 +#, python-format +msgid "" +"BoM \"%s\" contains a phantom BoM line but the product \"%s\" does not have " +"any BoM defined." +msgstr "" diff --git a/mrp_hook/i18n/ro.po b/mrp_hook/i18n/ro.po new file mode 100644 index 00000000000..eecb95d0efe --- /dev/null +++ b/mrp_hook/i18n/ro.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_hook +# +# Translators: +# Dorin Hongu , 2015 +msgid "" +msgstr "" +"Project-Id-Version: odoomrp-wip (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-11-20 17:16+0000\n" +"PO-Revision-Date: 2015-11-18 00:46+0000\n" +"Last-Translator: Dorin Hongu \n" +"Language-Team: Romanian (http://www.transifex.com/oca/odoomrp-wip-8-0/language/ro/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: ro\n" +"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n" + +#. module: mrp_hook +#: model:ir.model,name:mrp_hook.model_mrp_bom +msgid "Bill of Material" +msgstr "Listă de materiale" + +#. module: mrp_hook +#: code:addons/mrp_hook/models/mrp_bom.py:119 +#, python-format +msgid "BoM \"%s\" contains a BoM line with a product recursion: \"%s\"." +msgstr "LdM\"%s\" conține o line cu un produs recurent: \"%s\"." + +#. module: mrp_hook +#: code:addons/mrp_hook/models/mrp_bom.py:147 +#, python-format +msgid "" +"BoM \"%s\" contains a phantom BoM line but the product \"%s\" does not have " +"any BoM defined." +msgstr "LdM \"%s\" conține o linie fantomă dar produsul \"%s\" nu are definită o LdM." diff --git a/mrp_hook/i18n/sl.po b/mrp_hook/i18n/sl.po new file mode 100644 index 00000000000..fcb939c8fd7 --- /dev/null +++ b/mrp_hook/i18n/sl.po @@ -0,0 +1,38 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_hook +# +# Translators: +# Matjaž Mozetič , 2015 +msgid "" +msgstr "" +"Project-Id-Version: odoomrp-wip (8.0)\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-11-20 17:16+0000\n" +"PO-Revision-Date: 2015-11-14 04:47+0000\n" +"Last-Translator: Matjaž Mozetič \n" +"Language-Team: Slovenian (http://www.transifex.com/oca/odoomrp-wip-8-0/language/sl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: sl\n" +"Plural-Forms: nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);\n" + +#. module: mrp_hook +#: model:ir.model,name:mrp_hook.model_mrp_bom +msgid "Bill of Material" +msgstr "Kosovnica" + +#. module: mrp_hook +#: code:addons/mrp_hook/models/mrp_bom.py:119 +#, python-format +msgid "BoM \"%s\" contains a BoM line with a product recursion: \"%s\"." +msgstr "Kosovnica \"%s\" vsebuje postavko z rekurzivnim proizvodom: \"%s\"." + +#. module: mrp_hook +#: code:addons/mrp_hook/models/mrp_bom.py:147 +#, python-format +msgid "" +"BoM \"%s\" contains a phantom BoM line but the product \"%s\" does not have " +"any BoM defined." +msgstr "Kosovnica \"%s\" vsebuje postavko navidezne kosovnice, a proizvod \"%s\" nima določene nobene kosovnice." From b543da32eae75d19e4ac1e5868cc6538d657c0b9 Mon Sep 17 00:00:00 2001 From: campos Date: Wed, 20 Aug 2014 10:50:04 +0200 Subject: [PATCH 03/45] [ADD] mrp_operations_extension --- mrp_operations_extension/__init__.py | 24 ++++++ mrp_operations_extension/__openerp__.py | 51 ++++++++++++ mrp_operations_extension/models/__init__.py | 25 ++++++ mrp_operations_extension/models/mrp_bom.py | 62 ++++++++++++++ .../models/mrp_production.py | 69 +++++++++++++++ .../models/mrp_routing_operation.py | 66 +++++++++++++++ .../models/mrp_routing_workcenter.py | 83 +++++++++++++++++++ .../models/mrp_workcenter.py | 36 ++++++++ mrp_operations_extension/models/stock_move.py | 29 +++++++ .../views/mrp_bom_view.xml | 17 ++++ .../views/mrp_operation_workcenter_view.xml | 38 +++++++++ .../views/mrp_production_view.xml | 70 ++++++++++++++++ .../views/mrp_routing_operation_view.xml | 47 +++++++++++ .../views/mrp_routing_workcenter_view.xml | 54 ++++++++++++ .../views/mrp_workcenter_view.xml | 25 ++++++ 15 files changed, 696 insertions(+) create mode 100644 mrp_operations_extension/__init__.py create mode 100644 mrp_operations_extension/__openerp__.py create mode 100644 mrp_operations_extension/models/__init__.py create mode 100644 mrp_operations_extension/models/mrp_bom.py create mode 100644 mrp_operations_extension/models/mrp_production.py create mode 100644 mrp_operations_extension/models/mrp_routing_operation.py create mode 100644 mrp_operations_extension/models/mrp_routing_workcenter.py create mode 100644 mrp_operations_extension/models/mrp_workcenter.py create mode 100644 mrp_operations_extension/models/stock_move.py create mode 100644 mrp_operations_extension/views/mrp_bom_view.xml create mode 100644 mrp_operations_extension/views/mrp_operation_workcenter_view.xml create mode 100644 mrp_operations_extension/views/mrp_production_view.xml create mode 100644 mrp_operations_extension/views/mrp_routing_operation_view.xml create mode 100644 mrp_operations_extension/views/mrp_routing_workcenter_view.xml create mode 100644 mrp_operations_extension/views/mrp_workcenter_view.xml diff --git a/mrp_operations_extension/__init__.py b/mrp_operations_extension/__init__.py new file mode 100644 index 00000000000..3543e95f410 --- /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 00000000000..bbcb1d3eae5 --- /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 00000000000..b83c5acdefc --- /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 00000000000..db5ba33fa32 --- /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 00000000000..5428a345c7f --- /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 00000000000..a695989b7fb --- /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 00000000000..037cfcb8315 --- /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 00000000000..4adde98a4cc --- /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 00000000000..42ebe1fecc8 --- /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 00000000000..ba4bde8655e --- /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 00000000000..6e75f880b81 --- /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 00000000000..f3960e27e1b --- /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 00000000000..43c41b4b7d8 --- /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 00000000000..ccfb50c6ec9 --- /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 00000000000..220c7214f67 --- /dev/null +++ b/mrp_operations_extension/views/mrp_workcenter_view.xml @@ -0,0 +1,25 @@ + + + + + + mrp.workcenter.tree.inh + mrp.workcenter + + + + + + + + + + + + + + + + + + From 29a378e2cd630c32ee2f2429c3a2ee88dd43c672 Mon Sep 17 00:00:00 2001 From: avanzosc1 Date: Fri, 26 Sep 2014 12:56:53 +0200 Subject: [PATCH 04/45] [MOD] view changes --- .../views/mrp_production_view.xml | 74 +++++++++++++++++-- 1 file changed, 67 insertions(+), 7 deletions(-) diff --git a/mrp_operations_extension/views/mrp_production_view.xml b/mrp_operations_extension/views/mrp_production_view.xml index f3960e27e1b..ce5a20c1390 100644 --- a/mrp_operations_extension/views/mrp_production_view.xml +++ b/mrp_operations_extension/views/mrp_production_view.xml @@ -50,21 +50,81 @@ + 2 + + - + + + + + + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + Work centre line inh + mrp.production.workcenter.line + + + + + + + + + + From 0f36cdefd758f694a3b27e9281cf732a2e8e5f7d Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Sun, 28 Sep 2014 18:02:50 +0200 Subject: [PATCH 05/45] [IMP] mrp_operations_extension: PEP8 + Travis --- mrp_operations_extension/__openerp__.py | 16 +++++++++------- .../models/mrp_routing_operation.py | 2 +- .../security/ir.model.access.csv | 3 +++ 3 files changed, 13 insertions(+), 8 deletions(-) create mode 100644 mrp_operations_extension/security/ir.model.access.csv diff --git a/mrp_operations_extension/__openerp__.py b/mrp_operations_extension/__openerp__.py index bbcb1d3eae5..67c4d8ce7e4 100644 --- a/mrp_operations_extension/__openerp__.py +++ b/mrp_operations_extension/__openerp__.py @@ -40,12 +40,14 @@ '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', - ], + "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', + 'security/ir.model.access.csv', + ], "installable": True } diff --git a/mrp_operations_extension/models/mrp_routing_operation.py b/mrp_operations_extension/models/mrp_routing_operation.py index a695989b7fb..7bc4027b76e 100644 --- a/mrp_operations_extension/models/mrp_routing_operation.py +++ b/mrp_operations_extension/models/mrp_routing_operation.py @@ -19,7 +19,7 @@ # ############################################################################## -from openerp import models, fields, api, exceptions +from openerp import models, fields, api class MrpOperationWorkcenter(models.Model): diff --git a/mrp_operations_extension/security/ir.model.access.csv b/mrp_operations_extension/security/ir.model.access.csv new file mode 100644 index 00000000000..571fc4ee38c --- /dev/null +++ b/mrp_operations_extension/security/ir.model.access.csv @@ -0,0 +1,3 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_mrp_operation_workcenter,access_mrp_operation_workcenter,model_mrp_operation_workcenter,mrp.group_mrp_user,1,1,1,1 +access_mrp_routing_operation,access_mrp_routing_operation,model_mrp_routing_operation,mrp.group_mrp_user,1,1,1,1 \ No newline at end of file From a6bfcca8730f59d96a1dbcdce9c43961e80428b3 Mon Sep 17 00:00:00 2001 From: oihane Date: Fri, 3 Oct 2014 11:30:34 +0200 Subject: [PATCH 06/45] [FIX+IMP] mrp_operations_extension --- mrp_operations_extension/__init__.py | 6 +- mrp_operations_extension/__openerp__.py | 46 +++--- mrp_operations_extension/models/__init__.py | 5 +- mrp_operations_extension/models/mrp_bom.py | 42 +++--- .../models/mrp_production.py | 60 ++++++-- .../models/mrp_routing_operation.py | 7 +- .../models/mrp_routing_workcenter.py | 9 +- .../models/mrp_workcenter.py | 5 - mrp_operations_extension/models/stock_move.py | 3 - .../views/mrp_production_view.xml | 129 ++++++++++++++-- .../views/mrp_routing_operation_view.xml | 5 +- .../views/mrp_workcenter_view.xml | 1 - mrp_operations_extension/wizard/__init__.py | 19 +++ .../wizard/mrp_product_produce.py | 142 ++++++++++++++++++ .../wizard/mrp_workorder_produce_view.xml | 106 +++++++++++++ 15 files changed, 493 insertions(+), 92 deletions(-) create mode 100644 mrp_operations_extension/wizard/__init__.py create mode 100644 mrp_operations_extension/wizard/mrp_product_produce.py create mode 100644 mrp_operations_extension/wizard/mrp_workorder_produce_view.xml diff --git a/mrp_operations_extension/__init__.py b/mrp_operations_extension/__init__.py index 3543e95f410..ecfcca2419d 100644 --- a/mrp_operations_extension/__init__.py +++ b/mrp_operations_extension/__init__.py @@ -1,11 +1,6 @@ - # -*- 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 @@ -22,3 +17,4 @@ ############################################################################## from . import models +from . import wizard diff --git a/mrp_operations_extension/__openerp__.py b/mrp_operations_extension/__openerp__.py index 67c4d8ce7e4..23e88264040 100644 --- a/mrp_operations_extension/__openerp__.py +++ b/mrp_operations_extension/__openerp__.py @@ -2,10 +2,6 @@ # -*- 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 @@ -25,29 +21,45 @@ "name": "MRP Operations Extension", "version": "1.0", "description": """ - This module adds: +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 + - Adds 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": ['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 ", + ], + "depends": [ + "mrp_operations", + "mrp", + "stock", + ], "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', - 'security/ir.model.access.csv', + "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", ], "installable": True } diff --git a/mrp_operations_extension/models/__init__.py b/mrp_operations_extension/models/__init__.py index b83c5acdefc..f8074ae6857 100644 --- a/mrp_operations_extension/models/__init__.py +++ b/mrp_operations_extension/models/__init__.py @@ -1,4 +1,3 @@ - # -*- encoding: utf-8 -*- ############################################################################## # @@ -17,9 +16,9 @@ # ############################################################################## -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 +from . import mrp_routing_operation +from . import stock_move diff --git a/mrp_operations_extension/models/mrp_bom.py b/mrp_operations_extension/models/mrp_bom.py index db5ba33fa32..ecc52b489fb 100644 --- a/mrp_operations_extension/models/mrp_bom.py +++ b/mrp_operations_extension/models/mrp_bom.py @@ -1,11 +1,6 @@ - # -*- 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 @@ -21,39 +16,42 @@ # ############################################################################## -from openerp import models, fields, tools +from openerp import models, fields, tools, api 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 + @api.model + def _bom_explode(self, bom, product, factor, properties=None, level=0, + routing_id=False, previous_products=None, + master_bom=None): + routing_id = bom.routing_id.id or routing_id + result, result2 = super(MrpBom, self)._bom_explode( + bom, product, factor, properties=properties, level=level, + routing_id=routing_id, previous_products=previous_products, + master_bom=master_bom) + result2 = self._get_workorder_operations(result2, level=level, + routing_id=routing_id) + return result, result2 + + def _get_workorder_operations(self, result2, level=0, routing_id=False): + routing_line_obj = self.env['mrp.routing.workcenter'] for work_order in result2: seq = work_order['sequence'] - level - routing_lines = routing_line_obj.search(cr, uid, [ + routing_lines = routing_line_obj.search([ ('routing_id', '=', routing_id), ('sequence', '=', seq)]) routing_line_id = False if len(routing_lines) == 1: - routing_line_id = routing_lines[0] + routing_line_id = routing_lines[0].id elif len(routing_lines) > 1: - for routing_line in routing_line_obj.browse(cr, uid, - routing_lines): + for routing_line in routing_line_obj.browse(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 + return result2 class MrpBomLine(models.Model): diff --git a/mrp_operations_extension/models/mrp_production.py b/mrp_operations_extension/models/mrp_production.py index 5428a345c7f..f9d9ca5e919 100644 --- a/mrp_operations_extension/models/mrp_production.py +++ b/mrp_operations_extension/models/mrp_production.py @@ -1,9 +1,6 @@ - # -*- 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 @@ -19,7 +16,7 @@ # ############################################################################## -from openerp import models, fields, api +from openerp import models, fields, api, exceptions, _ class MrpProduction(models.Model): @@ -29,27 +26,46 @@ class MrpProduction(models.Model): 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 + self._get_workorder_in_product_lines(self.workcenter_lines, + self.product_lines) + return res + + def _get_workorder_in_product_lines(self, workcenter_lines, 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: + for bom_line in self.bom_id.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 + + def _get_workorder_in_move_lines(self, product_lines, move_lines): + for move_line in move_lines: + for product_line in product_lines: + if product_line.product_id.id == move_line.product_id.id: + move_line.work_order = product_line.work_order.id @api.multi def action_confirm(self): + produce = False + for workcenter_line in self.workcenter_lines: + if workcenter_line.do_production: + produce = True + break + if not produce: + raise exceptions.Warning( + _('Produce Operation'), _('At least one operation ' + 'must have checked ' + '"Move produced quantity to stock"' + 'field')) 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 + self._get_workorder_in_move_lines(self.product_lines, self.move_lines) + return res + + @api.multi + def action_compute(self, properties=None): + res = super(MrpProduction, self).action_compute(properties=properties) + self._get_workorder_in_move_lines(self.product_lines, self.move_lines) return res @@ -60,10 +76,22 @@ class MrpProductionProductLine(models.Model): 'Work Order') -class mrp_production_workcenter_line(models.Model): +class MrpProductionWorkcenterLine(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') + do_production = fields.Boolean( + string='Move Final Product to Stock') + + @api.model + def create(self, data): + workcenter_obj = self.env['mrp.routing.workcenter'] + if 'routing_wc_line' in data: + routing_wc_line_id = data.get('routing_wc_line') + work = workcenter_obj.browse(routing_wc_line_id) + data.update({'do_production': + work.operation.do_production}) + return super(MrpProductionWorkcenterLine, self).create(data) diff --git a/mrp_operations_extension/models/mrp_routing_operation.py b/mrp_operations_extension/models/mrp_routing_operation.py index 7bc4027b76e..5106eebf74f 100644 --- a/mrp_operations_extension/models/mrp_routing_operation.py +++ b/mrp_operations_extension/models/mrp_routing_operation.py @@ -1,9 +1,6 @@ - # -*- 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 @@ -64,3 +61,7 @@ class MrpRoutingOperation(models.Model): 'mrp.workcenter', 'mrp_operation_workcenter_rel', 'operation', 'workcenter', 'Work centers') op_number = fields.Integer('Número de Persona', default='0') + do_production = fields.Boolean( + string='Move Final Product to Stock') + picking_type_id = fields.Many2one( + 'stock.picking.type', string='Picking Type') diff --git a/mrp_operations_extension/models/mrp_routing_workcenter.py b/mrp_operations_extension/models/mrp_routing_workcenter.py index 037cfcb8315..bfbf08d7ed7 100644 --- a/mrp_operations_extension/models/mrp_routing_workcenter.py +++ b/mrp_operations_extension/models/mrp_routing_workcenter.py @@ -1,11 +1,6 @@ - # -*- 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 @@ -16,7 +11,7 @@ # 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 +# 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/. # ############################################################################## @@ -31,6 +26,8 @@ class MrpRoutingWorkcenter(models.Model): op_wc_lines = fields.One2many('mrp.operation.workcenter', 'routing_workcenter', 'Workcenter Info Lines') + do_production = fields.Boolean( + string='Move produced quantity to stock') @api.one @api.onchange('operation') diff --git a/mrp_operations_extension/models/mrp_workcenter.py b/mrp_operations_extension/models/mrp_workcenter.py index 4adde98a4cc..b1eddc7bf8e 100644 --- a/mrp_operations_extension/models/mrp_workcenter.py +++ b/mrp_operations_extension/models/mrp_workcenter.py @@ -1,11 +1,6 @@ - # -*- 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 diff --git a/mrp_operations_extension/models/stock_move.py b/mrp_operations_extension/models/stock_move.py index 42ebe1fecc8..e1b8f5e71e6 100644 --- a/mrp_operations_extension/models/stock_move.py +++ b/mrp_operations_extension/models/stock_move.py @@ -1,9 +1,6 @@ - # -*- 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 diff --git a/mrp_operations_extension/views/mrp_production_view.xml b/mrp_operations_extension/views/mrp_production_view.xml index ce5a20c1390..75821e6d354 100644 --- a/mrp_operations_extension/views/mrp_production_view.xml +++ b/mrp_operations_extension/views/mrp_production_view.xml @@ -72,10 +72,25 @@ expr="//field[@name='workcenter_lines']/form//field[@name='hour']" position="replace"> + + + + + + + + + + Work centre line inh mrp.production.workcenter.line - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mrp_operations_extension/views/mrp_routing_operation_view.xml b/mrp_operations_extension/views/mrp_routing_operation_view.xml index 43c41b4b7d8..792d90300cc 100644 --- a/mrp_operations_extension/views/mrp_routing_operation_view.xml +++ b/mrp_operations_extension/views/mrp_routing_operation_view.xml @@ -9,6 +9,7 @@ + @@ -22,7 +23,9 @@ - + + + diff --git a/mrp_operations_extension/views/mrp_workcenter_view.xml b/mrp_operations_extension/views/mrp_workcenter_view.xml index 220c7214f67..2100aa0b4ce 100644 --- a/mrp_operations_extension/views/mrp_workcenter_view.xml +++ b/mrp_operations_extension/views/mrp_workcenter_view.xml @@ -20,6 +20,5 @@ - diff --git a/mrp_operations_extension/wizard/__init__.py b/mrp_operations_extension/wizard/__init__.py new file mode 100644 index 00000000000..0383abe4b91 --- /dev/null +++ b/mrp_operations_extension/wizard/__init__.py @@ -0,0 +1,19 @@ +# -*- 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 Affero General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +############################################################################## + +from . import mrp_product_produce diff --git a/mrp_operations_extension/wizard/mrp_product_produce.py b/mrp_operations_extension/wizard/mrp_product_produce.py new file mode 100644 index 00000000000..2c08e9fba7f --- /dev/null +++ b/mrp_operations_extension/wizard/mrp_product_produce.py @@ -0,0 +1,142 @@ +# -*- 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 Affero General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +############################################################################## + +from openerp import fields, models + + +class MrpWorkOrderProduce(models.TransientModel): + _name = "mrp.work.order.produce" + + def default_get(self, cr, uid, fields, context=None): + a = super(MrpWorkOrderProduce, self).default_get( + cr, uid, fields, context=context) + work = self.pool['mrp.production.workcenter.line'].browse( + cr, uid, context.get('active_ids'), context=context)[0] + a.update({'final_product': work.do_production}) + return a + + def _get_product_id(self): + """ To obtain product id + @return: id + """ + prod = False + if self.env.context.get("active_id"): + work_line = self.env['mrp.production.workcenter.line'].browse( + self.env.context.get("active_id")) + prod = work_line.production_id + return prod and prod.product_id or False + + def _get_track(self): + prod = self._get_product_id() + return prod and prod.track_production or False + + def do_produce(self, cr, uid, ids, context=None): + work_line = self.pool['mrp.production.workcenter.line'].browse( + cr, uid, context.get("active_id"), context=context) + production_id = work_line.production_id.id + assert production_id + data = self.browse(cr, uid, ids[0], context=context) + self.pool['mrp.production'].action_produce( + cr, uid, production_id, False, data.mode, data, context=context) + return {} + + def do_consume(self, cr, uid, ids, context=None): + work_line = self.pool['mrp.production.workcenter.line'].browse( + cr, uid, context.get("active_id"), context=context) + production_id = work_line.production_id.id + assert production_id + data = self.browse(cr, uid, ids[0], context=context) + self.pool['mrp.production'].action_produce( + cr, uid, production_id, False, 'consume', data, context=context) + return {} + + def do_consume_produce(self, cr, uid, ids, context=None): + work_line = self.pool['mrp.production.workcenter.line'].browse( + cr, uid, context.get("active_id"), context=context) + production_id = work_line.production_id.id + assert production_id + data = self.browse(cr, uid, ids[0], context=context) + self.pool['mrp.production'].action_produce( + cr, uid, production_id, False, 'consume_produce', data, + context=context) + return {} + + def on_change_qty(self, cr, uid, ids, product_qty, consume_lines, + context=None): + """ + When changing the quantity of products to be producedit will + recalculate the number of raw materials needed according to + the scheduled products and the already consumed/produced products + It will return the consume lines needed for the products + to be produced which the user can still adapt + """ + prod_obj = self.pool["mrp.production"] + work_line = self.pool['mrp.production.workcenter.line'].browse( + cr, uid, context.get("active_id"), context=context) + production = work_line.production_id + consume_lines = [] + new_consume_lines = [] + if product_qty > 0.0: + consume_lines = prod_obj._calculate_qty( + cr, uid, production, product_qty=product_qty, context=context) + line_ids = [i.product_id.id for i in work_line.product_line] + for consume in consume_lines: + if consume['product_id'] in line_ids: + new_consume_lines.append([0, False, consume]) + return {'value': {'consume_lines': new_consume_lines}} + + def _get_product_qty(self): + """ To obtain product quantity + @param self: The object pointer. + @param cr: A database cursor + @param uid: ID of the user currently logged in + @param context: A standard dictionary + @return: Quantity + """ + work_line = self.env['mrp.production.workcenter.line'].browse( + self.env.context.get("active_id")) + prod = work_line.production_id + done = 0.0 + for move in prod.move_created_ids2: + if move.product_id == prod.product_id: + if not move.scrapped: + done += move.product_qty + return (prod.product_qty - done) or prod.product_qty + + product_id = fields.Many2one('product.product', + string='Product', default=_get_product_id) + product_qty = fields.Float('Select Quantity', + digits=(12, 6), required=True, + default=_get_product_qty) + mode = fields.Selection([('consume_produce', 'Consume & Produce'), + ('consume', 'Consume Only')], + string='Mode', required=True, + default='consume') + lot_id = fields.Many2one('stock.production.lot', 'Lot') + consume_lines = fields.One2many('mrp.product.produce.line', + 'work_produce_id', + string='Products Consumed') + track_production = fields.Boolean('Track production', default=_get_track) + + final_product = fields.Boolean(string='Final Product to Stock') + + +class MrpProductProduceLine(models.TransientModel): + _inherit = "mrp.product.produce.line" + + work_produce_id = fields.Many2one('mrp.work.order.produce') diff --git a/mrp_operations_extension/wizard/mrp_workorder_produce_view.xml b/mrp_operations_extension/wizard/mrp_workorder_produce_view.xml new file mode 100644 index 00000000000..67be6b8034c --- /dev/null +++ b/mrp_operations_extension/wizard/mrp_workorder_produce_view.xml @@ -0,0 +1,106 @@ + + + + + + + + + MRP Work Order Produce + mrp.work.order.produce + +
+ + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + + + MRP Work Order Produce + mrp.work.order.produce + +
+ + + + + + + + + + + + + + + + + + +
+
+
+
+
+ + + + Produce + ir.actions.act_window + mrp.work.order.produce + form + form + new + + + + Consume + ir.actions.act_window + mrp.work.order.produce + form + form + new + + + + +
+
From 7b35b00c516c23a5282cd0cdd9afed731b8f1be5 Mon Sep 17 00:00:00 2001 From: Ainara Date: Tue, 11 Nov 2014 10:36:50 +0100 Subject: [PATCH 07/45] [FIX] traceback al confirmar una MO --- mrp_operations_extension/models/mrp_bom.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mrp_operations_extension/models/mrp_bom.py b/mrp_operations_extension/models/mrp_bom.py index ecc52b489fb..3a16748783e 100644 --- a/mrp_operations_extension/models/mrp_bom.py +++ b/mrp_operations_extension/models/mrp_bom.py @@ -45,7 +45,7 @@ def _get_workorder_operations(self, result2, level=0, routing_id=False): if len(routing_lines) == 1: routing_line_id = routing_lines[0].id elif len(routing_lines) > 1: - for routing_line in routing_line_obj.browse(routing_lines): + for routing_line in routing_lines: name_val = tools.ustr(routing_line.name) + ' - ' if name_val in work_order['name']: routing_line_id = routing_line.id From e11627c21b81057c19cecb48308c36008793e6b9 Mon Sep 17 00:00:00 2001 From: oihane Date: Thu, 13 Nov 2014 11:18:43 +0100 Subject: [PATCH 08/45] [FIX] Pylint fixing --- mrp_operations_extension/wizard/mrp_product_produce.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mrp_operations_extension/wizard/mrp_product_produce.py b/mrp_operations_extension/wizard/mrp_product_produce.py index 2c08e9fba7f..4a0db73194d 100644 --- a/mrp_operations_extension/wizard/mrp_product_produce.py +++ b/mrp_operations_extension/wizard/mrp_product_produce.py @@ -22,9 +22,9 @@ class MrpWorkOrderProduce(models.TransientModel): _name = "mrp.work.order.produce" - def default_get(self, cr, uid, fields, context=None): + def default_get(self, cr, uid, var_fields, context=None): a = super(MrpWorkOrderProduce, self).default_get( - cr, uid, fields, context=context) + cr, uid, var_fields, context=context) work = self.pool['mrp.production.workcenter.line'].browse( cr, uid, context.get('active_ids'), context=context)[0] a.update({'final_product': work.do_production}) From 52abc82b6c42830c72349d8bd380a035837d22af Mon Sep 17 00:00:00 2001 From: campos Date: Wed, 26 Nov 2014 13:00:50 +0100 Subject: [PATCH 09/45] [FIX] mrp_operations_extension: When no routing_id is defined in the manufacturing order move Final Product to Stock check in operation is not controlled. --- mrp_operations_extension/models/mrp_production.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mrp_operations_extension/models/mrp_production.py b/mrp_operations_extension/models/mrp_production.py index f9d9ca5e919..1fd8b98cb60 100644 --- a/mrp_operations_extension/models/mrp_production.py +++ b/mrp_operations_extension/models/mrp_production.py @@ -48,10 +48,13 @@ def _get_workorder_in_move_lines(self, product_lines, move_lines): @api.multi def action_confirm(self): produce = False - for workcenter_line in self.workcenter_lines: - if workcenter_line.do_production: - produce = True - break + if not self.routing_id: + produce = True + else: + for workcenter_line in self.workcenter_lines: + if workcenter_line.do_production: + produce = True + break if not produce: raise exceptions.Warning( _('Produce Operation'), _('At least one operation ' From 0c2536a71709b0423d99cec4c90626938d8eba0d Mon Sep 17 00:00:00 2001 From: oihane Date: Wed, 3 Dec 2014 17:16:45 +0100 Subject: [PATCH 10/45] [FIX] mrp_operations_extension Phantom bom lines with workorder association When installing variants, it doesn't assign corresponding wo to scheduled product Domain added to avoid selecting workorders that don't apply --- mrp_operations_extension/README.rst | 9 ++++++ mrp_operations_extension/__openerp__.py | 30 +++++++------------ mrp_operations_extension/models/mrp_bom.py | 7 +++-- .../models/mrp_production.py | 18 +++++++++-- .../views/mrp_bom_view.xml | 9 ++++-- .../views/mrp_production_view.xml | 15 ++++++---- 6 files changed, 55 insertions(+), 33 deletions(-) create mode 100644 mrp_operations_extension/README.rst diff --git a/mrp_operations_extension/README.rst b/mrp_operations_extension/README.rst new file mode 100644 index 00000000000..b12ce8d5c7b --- /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 23e88264040..d34f3a86c9a 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 3a16748783e..e9d78a3e4df 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 @@ def _get_workorder_operations(self, result2, level=0, routing_id=False): 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 1fd8b98cb60..1d13604e25b 100644 --- a/mrp_operations_extension/models/mrp_production.py +++ b/mrp_operations_extension/models/mrp_production.py @@ -27,10 +27,12 @@ def _action_compute_lines(self, properties=None): 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 @@ def _get_workorder_in_product_lines(self, workcenter_lines, product_lines): 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 ba4bde8655e..e4250fb973f 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 75821e6d354..427c21a7ef4 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 @@ - + - + - + - + Date: Tue, 16 Dec 2014 17:52:20 +0100 Subject: [PATCH 11/45] [IMP] mrp_operations_extension: Limit to not add products from work order tree --- .../models/mrp_production.py | 24 ++++++++----------- .../views/mrp_production_view.xml | 4 ++-- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/mrp_operations_extension/models/mrp_production.py b/mrp_operations_extension/models/mrp_production.py index 1d13604e25b..df4cf6045a3 100644 --- a/mrp_operations_extension/models/mrp_production.py +++ b/mrp_operations_extension/models/mrp_production.py @@ -53,14 +53,18 @@ def _get_workorder_in_product_lines(self, workcenter_lines, product_lines, 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: - for product_line in product_lines: - if product_line.product_id.id == move_line.product_id.id: - move_line.work_order = product_line.work_order.id + @api.model + def _make_production_consume_line(self, line): + res = super(MrpProduction, self)._make_production_consume_line(line) + if line.work_order and res: + st_move_obj = self.env['stock.move'] + move = st_move_obj.browse(res) + move.work_order = line.work_order.id + return res @api.multi - def action_confirm(self): + def action_compute(self, properties=None): + res = super(MrpProduction, self).action_compute(properties=properties) produce = False if not self.routing_id: produce = True @@ -75,14 +79,6 @@ def action_confirm(self): 'must have checked ' '"Move produced quantity to stock"' 'field')) - res = super(MrpProduction, self).action_confirm() - self._get_workorder_in_move_lines(self.product_lines, self.move_lines) - return res - - @api.multi - def action_compute(self, properties=None): - res = super(MrpProduction, self).action_compute(properties=properties) - self._get_workorder_in_move_lines(self.product_lines, self.move_lines) return res diff --git a/mrp_operations_extension/views/mrp_production_view.xml b/mrp_operations_extension/views/mrp_production_view.xml index 427c21a7ef4..8ed299e9402 100644 --- a/mrp_operations_extension/views/mrp_production_view.xml +++ b/mrp_operations_extension/views/mrp_production_view.xml @@ -91,7 +91,7 @@ + nolabel="1" colspan="4"/> @@ -199,7 +199,7 @@ + colspan="4" col="4" readonly="1"/> From d6f8905bea61e63ae5108bd9c83cf3813899fdab Mon Sep 17 00:00:00 2001 From: oihane Date: Wed, 31 Dec 2014 12:12:31 +0100 Subject: [PATCH 12/45] [FIX+IMP] mrp_operations_extension IMP: Deleting workers info and new module IMP: Adding fields in base modules, extension updates onchange IMP: Changes in views and field names REM: Deleted module IMP: Configuration part added --- mrp_operations_extension/README.rst | 2 +- mrp_operations_extension/__openerp__.py | 11 ++------ mrp_operations_extension/models/__init__.py | 1 + .../models/mrp_routing_operation.py | 10 +++++-- .../models/mrp_workcenter.py | 19 ++++++++++++- mrp_operations_extension/models/res_config.py | 27 +++++++++++++++++++ .../mrp_operations_extension_security.xml | 9 +++++++ .../views/mrp_operation_workcenter_view.xml | 2 ++ .../views/mrp_routing_workcenter_view.xml | 27 ++++++++++--------- .../views/mrp_workcenter_view.xml | 20 +++++++++----- .../views/res_config_view.xml | 19 +++++++++++++ 11 files changed, 116 insertions(+), 31 deletions(-) create mode 100644 mrp_operations_extension/models/res_config.py create mode 100644 mrp_operations_extension/security/mrp_operations_extension_security.xml create mode 100644 mrp_operations_extension/views/res_config_view.xml diff --git a/mrp_operations_extension/README.rst b/mrp_operations_extension/README.rst index b12ce8d5c7b..991538ecc88 100644 --- a/mrp_operations_extension/README.rst +++ b/mrp_operations_extension/README.rst @@ -4,6 +4,6 @@ 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 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 d34f3a86c9a..322dbe1681c 100644 --- a/mrp_operations_extension/__openerp__.py +++ b/mrp_operations_extension/__openerp__.py @@ -21,15 +21,6 @@ "name": "MRP Operations Extension", "version": "1.0", "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" - ], "author": "OdooMRP team", "website": "http://www.odoomrp.com", "contributors": [ @@ -51,7 +42,9 @@ "views/mrp_production_view.xml", "views/mrp_bom_view.xml", "views/mrp_routing_workcenter_view.xml", + "views/res_config_view.xml", "security/ir.model.access.csv", + "security/mrp_operations_extension_security.xml", ], "installable": True } diff --git a/mrp_operations_extension/models/__init__.py b/mrp_operations_extension/models/__init__.py index f8074ae6857..52a72a636db 100644 --- a/mrp_operations_extension/models/__init__.py +++ b/mrp_operations_extension/models/__init__.py @@ -22,3 +22,4 @@ from . import mrp_workcenter from . import mrp_routing_operation from . import stock_move +from . import res_config diff --git a/mrp_operations_extension/models/mrp_routing_operation.py b/mrp_operations_extension/models/mrp_routing_operation.py index 5106eebf74f..d44196eb8a3 100644 --- a/mrp_operations_extension/models/mrp_routing_operation.py +++ b/mrp_operations_extension/models/mrp_routing_operation.py @@ -17,6 +17,7 @@ ############################################################################## from openerp import models, fields, api +from openerp.addons import decimal_precision as dp class MrpOperationWorkcenter(models.Model): @@ -34,7 +35,10 @@ class MrpOperationWorkcenter(models.Model): 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') + op_number = fields.Integer('# Operators', default='0') + op_avg_cost = fields.Float( + string='Operator Average Cost', + digits=dp.get_precision('Product Price')) default = fields.Boolean('Default') @api.one @@ -46,6 +50,8 @@ def onchange_workcenter(self): self.time_cycle = self.workcenter.time_cycle self.time_start = self.workcenter.time_start self.time_stop = self.workcenter.time_stop + self.op_number = self.workcenter.op_number + self.op_avg_cost = self.workcenter.op_avg_cost self.default = False @@ -60,7 +66,7 @@ class MrpRoutingOperation(models.Model): workcenters = fields.Many2many( 'mrp.workcenter', 'mrp_operation_workcenter_rel', 'operation', 'workcenter', 'Work centers') - op_number = fields.Integer('Número de Persona', default='0') + op_number = fields.Integer('# Operators', default='0') do_production = fields.Boolean( string='Move Final Product to Stock') picking_type_id = fields.Many2one( diff --git a/mrp_operations_extension/models/mrp_workcenter.py b/mrp_operations_extension/models/mrp_workcenter.py index b1eddc7bf8e..31ea54a604c 100644 --- a/mrp_operations_extension/models/mrp_workcenter.py +++ b/mrp_operations_extension/models/mrp_workcenter.py @@ -16,12 +16,22 @@ # ############################################################################## -from openerp import models, fields +from openerp import models, fields, api +from openerp.addons import decimal_precision as dp class MrpWorkcenter(models.Model): _inherit = 'mrp.workcenter' + @api.one + @api.depends('operators') + def _operators_number_avg_cost(self): + self.op_number = len(self.operators) + op_avg_cost = 0.0 + for operator in self.operators: + op_avg_cost += operator.employee_ids[0].product_id.standard_price + self.op_avg_cost = op_avg_cost / (self.op_number or 1) + pre_op_product = fields.Many2one('product.product', string='Pre Operation Cost') post_op_product = fields.Many2one('product.product', @@ -29,3 +39,10 @@ class MrpWorkcenter(models.Model): rt_operations = fields.Many2many( 'mrp.routing.operation', 'mrp_operation_workcenter_rel', 'workcenter', 'operation', 'Routing Operations') + operators = fields.Many2many('res.users', 'mrp_wc_operator_rel', + 'workcenter_id', 'operator_id', 'Operators') + op_number = fields.Integer( + string='# Operators', compute=_operators_number_avg_cost) + op_avg_cost = fields.Float( + string='Operator average cost', + digits=dp.get_precision('Product Price')) diff --git a/mrp_operations_extension/models/res_config.py b/mrp_operations_extension/models/res_config.py new file mode 100644 index 00000000000..b3dc8aa1697 --- /dev/null +++ b/mrp_operations_extension/models/res_config.py @@ -0,0 +1,27 @@ +# -*- 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 Affero General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +############################################################################## + +from openerp import models, fields + + +class MrpConfigSettings(models.TransientModel): + _inherit = 'mrp.config.settings' + + group_mrp_workers = fields.Boolean( + string='Manage operators ', implied_group='mrp_operations_extension.group_mrp_workers', + help='') diff --git a/mrp_operations_extension/security/mrp_operations_extension_security.xml b/mrp_operations_extension/security/mrp_operations_extension_security.xml new file mode 100644 index 00000000000..63df8f15e32 --- /dev/null +++ b/mrp_operations_extension/security/mrp_operations_extension_security.xml @@ -0,0 +1,9 @@ + + + + + Manufacturing Operators + + + + diff --git a/mrp_operations_extension/views/mrp_operation_workcenter_view.xml b/mrp_operations_extension/views/mrp_operation_workcenter_view.xml index 6e75f880b81..648e9145d53 100644 --- a/mrp_operations_extension/views/mrp_operation_workcenter_view.xml +++ b/mrp_operations_extension/views/mrp_operation_workcenter_view.xml @@ -22,6 +22,8 @@ + + diff --git a/mrp_operations_extension/views/mrp_routing_workcenter_view.xml b/mrp_operations_extension/views/mrp_routing_workcenter_view.xml index ccfb50c6ec9..84bae1ba570 100644 --- a/mrp_operations_extension/views/mrp_routing_workcenter_view.xml +++ b/mrp_operations_extension/views/mrp_routing_workcenter_view.xml @@ -8,7 +8,7 @@ - + @@ -20,33 +20,36 @@ - + - + diff --git a/mrp_operations_extension/views/mrp_workcenter_view.xml b/mrp_operations_extension/views/mrp_workcenter_view.xml index 2100aa0b4ce..45ad641744c 100644 --- a/mrp_operations_extension/views/mrp_workcenter_view.xml +++ b/mrp_operations_extension/views/mrp_workcenter_view.xml @@ -1,21 +1,29 @@ - - mrp.workcenter.tree.inh + mrp.workcenter.form.inh mrp.workcenter - + - + - + + + + + + + + - + diff --git a/mrp_operations_extension/views/res_config_view.xml b/mrp_operations_extension/views/res_config_view.xml new file mode 100644 index 00000000000..1a557458e5c --- /dev/null +++ b/mrp_operations_extension/views/res_config_view.xml @@ -0,0 +1,19 @@ + + + + + mrp.settings.form + mrp.config.settings + + + +
+ +
+
+
+
+ +
+
From ea890030ec3a9b45ec679b56b06f72c25c12433b Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Mon, 5 Jan 2015 04:39:56 +0100 Subject: [PATCH 13/45] [IMP] mrp_operations_extension: Cost labels --- mrp_operations_extension/models/mrp_workcenter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mrp_operations_extension/models/mrp_workcenter.py b/mrp_operations_extension/models/mrp_workcenter.py index 31ea54a604c..8e65803e32c 100644 --- a/mrp_operations_extension/models/mrp_workcenter.py +++ b/mrp_operations_extension/models/mrp_workcenter.py @@ -33,9 +33,9 @@ def _operators_number_avg_cost(self): self.op_avg_cost = op_avg_cost / (self.op_number or 1) pre_op_product = fields.Many2one('product.product', - string='Pre Operation Cost') + string='Pre-operation costing product') post_op_product = fields.Many2one('product.product', - string='Post Operation Cost') + string='Post-operation costing product') rt_operations = fields.Many2many( 'mrp.routing.operation', 'mrp_operation_workcenter_rel', 'workcenter', 'operation', 'Routing Operations') From ac37a6096371c07656c4474c6e0f0b93662e7881 Mon Sep 17 00:00:00 2001 From: oihane Date: Mon, 5 Jan 2015 09:34:21 +0100 Subject: [PATCH 14/45] [FIX+IMP] mrp_operations_extension IMP: Translations FIX: Fixing some names FIX: Some functional changes FIX: Default line functionality --- mrp_operations_extension/i18n/es.po | 450 ++++++++++++++++++ .../i18n/mrp_operations_extension.pot | 450 ++++++++++++++++++ mrp_operations_extension/models/mrp_bom.py | 21 +- .../models/mrp_routing_operation.py | 23 + .../models/mrp_routing_workcenter.py | 66 ++- mrp_operations_extension/models/res_config.py | 4 +- .../views/mrp_production_view.xml | 44 +- .../views/mrp_routing_workcenter_view.xml | 3 + 8 files changed, 988 insertions(+), 73 deletions(-) create mode 100644 mrp_operations_extension/i18n/es.po create mode 100644 mrp_operations_extension/i18n/mrp_operations_extension.pot diff --git a/mrp_operations_extension/i18n/es.po b/mrp_operations_extension/i18n/es.po new file mode 100644 index 00000000000..b1be3bdaaec --- /dev/null +++ b/mrp_operations_extension/i18n/es.po @@ -0,0 +1,450 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_operations_extension +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-01-05 08:28+0000\n" +"PO-Revision-Date: 2015-01-05 08:28+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_operations_extension +#: field:mrp.operation.workcenter,op_number:0 +#: field:mrp.routing.operation,op_number:0 +msgid "# Operators" +msgstr "# Operators" + +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +msgid "Actual Production Date" +msgstr "Fecha real de fabricación" + +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_production.py:78 +#, python-format +msgid "At least one operation must have checked \"Move produced quantity to stock\"field" +msgstr "At least one operation must have checked \"Move produced quantity to stock\"field" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_bom +msgid "Bill of Material" +msgstr "Lista de material" + +#. module: mrp_operations_extension +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_produce_wizard +msgid "Cancel" +msgstr "Cancel" + +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_operation_buttons_form_view +msgid "Cancel Order" +msgstr "Cancelar orden" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,capacity_per_cycle:0 +msgid "Capacity per Cycle" +msgstr "Capacity per Cycle" + +#. module: mrp_operations_extension +#: field:mrp.routing.operation,code:0 +msgid "Code" +msgstr "Code" + +#. module: mrp_operations_extension +#: model:ir.actions.act_window,name:mrp_operations_extension.act_mrp_work_order_consume +#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard +msgid "Consume" +msgstr "Consume" + +#. module: mrp_operations_extension +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_produce_wizard +#: selection:mrp.work.order.produce,mode:0 +msgid "Consume & Produce" +msgstr "Consume & Produce" + +#. module: mrp_operations_extension +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_produce_wizard +msgid "Consume Lines" +msgstr "Consume Lines" + +#. module: mrp_operations_extension +#: selection:mrp.work.order.produce,mode:0 +msgid "Consume Only" +msgstr "Consume Only" + +#. module: mrp_operations_extension +#: field:mrp.bom.line,operation:0 +msgid "Consumed" +msgstr "Consumed" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,create_uid:0 +#: field:mrp.routing.operation,create_uid:0 +#: field:mrp.work.order.produce,create_uid:0 +msgid "Created by" +msgstr "Created by" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,create_date:0 +#: field:mrp.routing.operation,create_date:0 +#: field:mrp.work.order.produce,create_date:0 +msgid "Created on" +msgstr "Created on" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,default:0 +msgid "Default" +msgstr "Default" + +#. module: mrp_operations_extension +#: field:mrp.routing.operation,description:0 +msgid "Description" +msgstr "Description" + +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +msgid "Duration" +msgstr "Duración" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,time_efficiency:0 +msgid "Efficiency Factor" +msgstr "Efficiency Factor" + +#. module: mrp_operations_extension +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +msgid "Extra Information" +msgstr "Extra Information" + +#. module: mrp_operations_extension +#: field:mrp.work.order.produce,final_product:0 +msgid "Final Product to Stock" +msgstr "Final Product to Stock" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,id:0 +#: field:mrp.routing.operation,id:0 +#: field:mrp.work.order.produce,id:0 +msgid "ID" +msgstr "ID" + +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +msgid "Information" +msgstr "Información" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,write_uid:0 +#: field:mrp.routing.operation,write_uid:0 +#: field:mrp.work.order.produce,write_uid:0 +msgid "Last Updated by" +msgstr "Last Updated by" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,write_date:0 +#: field:mrp.routing.operation,write_date:0 +#: field:mrp.work.order.produce,write_date:0 +msgid "Last Updated on" +msgstr "Last Updated on" + +#. module: mrp_operations_extension +#: field:mrp.work.order.produce,lot_id:0 +msgid "Lot" +msgstr "Lot" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_operation_workcenter +msgid "MRP Operation Workcenter" +msgstr "MRP Operation Workcenter" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_routing_operation +msgid "MRP Routing Operation" +msgstr "MRP Routing Operation" + +#. module: mrp_operations_extension +#: field:mrp.config.settings,group_mrp_workers:0 +msgid "Manage operators in work centers " +msgstr "Manage operators in work centers " + +#. module: mrp_operations_extension +#: model:res.groups,name:mrp_operations_extension.group_mrp_workers +msgid "Manufacturing Operators" +msgstr "Manufacturing Operators" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_production +msgid "Manufacturing Order" +msgstr "Órden de producción" + +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +msgid "Materials" +msgstr "Materials" + +#. module: mrp_operations_extension +#: field:mrp.work.order.produce,mode:0 +msgid "Mode" +msgstr "Mode" + +#. module: mrp_operations_extension +#: field:mrp.production.workcenter.line,do_production:0 +#: field:mrp.routing.operation,do_production:0 +msgid "Move Final Product to Stock" +msgstr "Move Final Product to Stock" + +#. module: mrp_operations_extension +#: field:mrp.routing.workcenter,do_production:0 +msgid "Move produced quantity to stock" +msgstr "Move produced quantity to stock" + +#. module: mrp_operations_extension +#: field:mrp.routing.operation,name:0 +msgid "Name" +msgstr "Nombre" + +#. module: mrp_operations_extension +#: field:mrp.routing.workcenter,operation:0 +msgid "Operation" +msgstr "Operación" + +#. module: mrp_operations_extension +#: model:ir.ui.menu,name:mrp_operations_extension.mrp_routing_menu +msgid "Operations" +msgstr "Operaciones" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,op_avg_cost:0 +msgid "Operator Average Cost" +msgstr "Coste medio de operador" + +#. module: mrp_operations_extension +#: field:mrp.workcenter,op_avg_cost:0 +msgid "Operator average cost" +msgstr "Coste medio de operador" + +#. module: mrp_operations_extension +#: view:mrp.workcenter:mrp_operations_extension.mrp_workcenter_form_view_inh +#: field:mrp.workcenter,operators:0 +msgid "Operators" +msgstr "Operadores" + +#. module: mrp_operations_extension +#: field:mrp.routing.operation,picking_type_id:0 +msgid "Picking Type" +msgstr "Picking Type" + +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +msgid "Planned Date" +msgstr "Fecha planeada" + +#. module: mrp_operations_extension +#: field:mrp.workcenter,post_op_product:0 +msgid "Post Operation Cost" +msgstr "Coste de post-operación" + +#. module: mrp_operations_extension +#: field:mrp.workcenter,pre_op_product:0 +msgid "Pre Operation Cost" +msgstr "Coste de pre-operación" + +#. module: mrp_operations_extension +#: model:ir.actions.act_window,name:mrp_operations_extension.act_mrp_work_order_produce +#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_produce_wizard +msgid "Produce" +msgstr "Fabricar" + +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_production.py:78 +#, python-format +msgid "Produce Operation" +msgstr "Produce Operation" + +#. module: mrp_operations_extension +#: field:mrp.work.order.produce,product_id:0 +msgid "Product" +msgstr "Product" + +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +#: field:mrp.production.workcenter.line,product_line:0 +msgid "Product Lines" +msgstr "Líneas de Producto" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_product_produce_line +msgid "Product Produce Consume lines" +msgstr "Líneas de consumo de los producto producidos" + +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +msgid "Product to Produce" +msgstr "Producto a producir" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_production_product_line +msgid "Production Scheduled Product" +msgstr "Fabricación planificada producto" + +#. module: mrp_operations_extension +#: field:mrp.work.order.produce,consume_lines:0 +msgid "Products Consumed" +msgstr "Products Consumed" + +#. module: mrp_operations_extension +#: field:mrp.routing.operation,steps:0 +msgid "Relevant Steps" +msgstr "Relevant Steps" + +#. module: mrp_operations_extension +#: model:ir.actions.act_window,name:mrp_operations_extension.mrp_routing_operation_action +#: view:mrp.routing.operation:mrp_operations_extension.rountig_operation_form +#: view:mrp.routing.operation:mrp_operations_extension.rountig_operation_tree +msgid "Routing Operation" +msgstr "Routing Operation" + +#. module: mrp_operations_extension +#: view:mrp.workcenter:mrp_operations_extension.mrp_workcenter_form_view_inh +#: field:mrp.workcenter,rt_operations:0 +msgid "Routing Operations" +msgstr "Routing Operations" + +#. module: mrp_operations_extension +#: field:mrp.production.workcenter.line,routing_wc_line:0 +msgid "Routing WC Line" +msgstr "Routing WC Line" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,routing_workcenter:0 +msgid "Routing Workcenter" +msgstr "Routing Workcenter" + +#. module: mrp_operations_extension +#: field:mrp.work.order.produce,product_qty:0 +msgid "Select Quantity" +msgstr "Select Quantity" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_stock_move +msgid "Stock Move" +msgstr "Movimiento de existencias" + +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_routing_workcenter.py:65 +#: code:addons/mrp_operations_extension/models/mrp_routing_workcenter.py:79 +#, python-format +msgid "There is another line set as default, disable it first." +msgstr "There is another line set as default, disable it first." + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,time_stop:0 +msgid "Time after prod." +msgstr "Time after prod." + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,time_start:0 +msgid "Time before prod." +msgstr "Time before prod." + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,time_cycle:0 +msgid "Time for 1 cycle (hour)" +msgstr "Time for 1 cycle (hour)" + +#. module: mrp_operations_extension +#: help:mrp.operation.workcenter,time_cycle:0 +msgid "Time in hours for doing one cycle." +msgstr "Time in hours for doing one cycle." + +#. module: mrp_operations_extension +#: help:mrp.operation.workcenter,time_stop:0 +msgid "Time in hours for the cleaning." +msgstr "Time in hours for the cleaning." + +#. module: mrp_operations_extension +#: help:mrp.operation.workcenter,time_start:0 +msgid "Time in hours for the setup." +msgstr "Time in hours for the setup." + +#. module: mrp_operations_extension +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_produce_wizard +msgid "To Consume" +msgstr "To Consume" + +#. module: mrp_operations_extension +#: field:mrp.work.order.produce,track_production:0 +msgid "Track production" +msgstr "Track production" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_workcenter +#: field:mrp.operation.workcenter,workcenter:0 +msgid "Work Center" +msgstr "Centro de producción" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_routing_workcenter +msgid "Work Center Usage" +msgstr "Utilización del centro de producción" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_production_workcenter_line +#: field:mrp.production.product.line,work_order:0 +#: field:stock.move,work_order:0 +msgid "Work Order" +msgstr "Orden de trabajo" + +#. module: mrp_operations_extension +#: field:mrp.routing.operation,workcenters:0 +msgid "Work centers" +msgstr "Centros de producción" + +#. module: mrp_operations_extension +#: field:mrp.product.produce.line,work_produce_id:0 +msgid "Work produce id" +msgstr "Work produce id" + +#. module: mrp_operations_extension +#: view:mrp.routing.workcenter:mrp_operations_extension.mrp_routing_workcenter_form_view_inh +#: field:mrp.routing.workcenter,op_wc_lines:0 +msgid "Workcenter Info Lines" +msgstr "Líneas de info. de centro de producción" + +#. module: mrp_operations_extension +#: view:mrp.routing.operation:mrp_operations_extension.rountig_operation_form +msgid "Workcenters" +msgstr "Workcenters" + +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_operation_buttons_form_view +msgid "oe_highlight" +msgstr "oe_highlight" + +#. module: mrp_operations_extension +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_produce_wizard +msgid "or" +msgstr "o" + diff --git a/mrp_operations_extension/i18n/mrp_operations_extension.pot b/mrp_operations_extension/i18n/mrp_operations_extension.pot new file mode 100644 index 00000000000..366ad219ddd --- /dev/null +++ b/mrp_operations_extension/i18n/mrp_operations_extension.pot @@ -0,0 +1,450 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mrp_operations_extension +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 8.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2015-01-05 08:25+0000\n" +"PO-Revision-Date: 2015-01-05 08:25+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_operations_extension +#: field:mrp.operation.workcenter,op_number:0 +#: field:mrp.routing.operation,op_number:0 +msgid "# Operators" +msgstr "" + +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +msgid "Actual Production Date" +msgstr "" + +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_production.py:78 +#, python-format +msgid "At least one operation must have checked \"Move produced quantity to stock\"field" +msgstr "" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_bom +msgid "Bill of Material" +msgstr "" + +#. module: mrp_operations_extension +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_produce_wizard +msgid "Cancel" +msgstr "" + +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_operation_buttons_form_view +msgid "Cancel Order" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,capacity_per_cycle:0 +msgid "Capacity per Cycle" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.routing.operation,code:0 +msgid "Code" +msgstr "" + +#. module: mrp_operations_extension +#: model:ir.actions.act_window,name:mrp_operations_extension.act_mrp_work_order_consume +#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard +msgid "Consume" +msgstr "" + +#. module: mrp_operations_extension +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_produce_wizard +#: selection:mrp.work.order.produce,mode:0 +msgid "Consume & Produce" +msgstr "" + +#. module: mrp_operations_extension +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_produce_wizard +msgid "Consume Lines" +msgstr "" + +#. module: mrp_operations_extension +#: selection:mrp.work.order.produce,mode:0 +msgid "Consume Only" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.bom.line,operation:0 +msgid "Consumed" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,create_uid:0 +#: field:mrp.routing.operation,create_uid:0 +#: field:mrp.work.order.produce,create_uid:0 +msgid "Created by" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,create_date:0 +#: field:mrp.routing.operation,create_date:0 +#: field:mrp.work.order.produce,create_date:0 +msgid "Created on" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,default:0 +msgid "Default" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.routing.operation,description:0 +msgid "Description" +msgstr "" + +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +msgid "Duration" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,time_efficiency:0 +msgid "Efficiency Factor" +msgstr "" + +#. module: mrp_operations_extension +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +msgid "Extra Information" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.work.order.produce,final_product:0 +msgid "Final Product to Stock" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,id:0 +#: field:mrp.routing.operation,id:0 +#: field:mrp.work.order.produce,id:0 +msgid "ID" +msgstr "" + +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +msgid "Information" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,write_uid:0 +#: field:mrp.routing.operation,write_uid:0 +#: field:mrp.work.order.produce,write_uid:0 +msgid "Last Updated by" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,write_date:0 +#: field:mrp.routing.operation,write_date:0 +#: field:mrp.work.order.produce,write_date:0 +msgid "Last Updated on" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.work.order.produce,lot_id:0 +msgid "Lot" +msgstr "" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_operation_workcenter +msgid "MRP Operation Workcenter" +msgstr "" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_routing_operation +msgid "MRP Routing Operation" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.config.settings,group_mrp_workers:0 +msgid "Manage operators in work centers " +msgstr "" + +#. module: mrp_operations_extension +#: model:res.groups,name:mrp_operations_extension.group_mrp_workers +msgid "Manufacturing Operators" +msgstr "" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_production +msgid "Manufacturing Order" +msgstr "" + +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +msgid "Materials" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.work.order.produce,mode:0 +msgid "Mode" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.production.workcenter.line,do_production:0 +#: field:mrp.routing.operation,do_production:0 +msgid "Move Final Product to Stock" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.routing.workcenter,do_production:0 +msgid "Move produced quantity to stock" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.routing.operation,name:0 +msgid "Name" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.routing.workcenter,operation:0 +msgid "Operation" +msgstr "" + +#. module: mrp_operations_extension +#: model:ir.ui.menu,name:mrp_operations_extension.mrp_routing_menu +msgid "Operations" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,op_avg_cost:0 +msgid "Operator Average Cost" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.workcenter,op_avg_cost:0 +msgid "Operator average cost" +msgstr "" + +#. module: mrp_operations_extension +#: view:mrp.workcenter:mrp_operations_extension.mrp_workcenter_form_view_inh +#: field:mrp.workcenter,operators:0 +msgid "Operators" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.routing.operation,picking_type_id:0 +msgid "Picking Type" +msgstr "" + +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +msgid "Planned Date" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.workcenter,post_op_product:0 +msgid "Post Operation Cost" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.workcenter,pre_op_product:0 +msgid "Pre Operation Cost" +msgstr "" + +#. module: mrp_operations_extension +#: model:ir.actions.act_window,name:mrp_operations_extension.act_mrp_work_order_produce +#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_produce_wizard +msgid "Produce" +msgstr "" + +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_production.py:78 +#, python-format +msgid "Produce Operation" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.work.order.produce,product_id:0 +msgid "Product" +msgstr "" + +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +#: field:mrp.production.workcenter.line,product_line:0 +msgid "Product Lines" +msgstr "" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_product_produce_line +msgid "Product Produce Consume lines" +msgstr "" + +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +msgid "Product to Produce" +msgstr "" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_production_product_line +msgid "Production Scheduled Product" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.work.order.produce,consume_lines:0 +msgid "Products Consumed" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.routing.operation,steps:0 +msgid "Relevant Steps" +msgstr "" + +#. module: mrp_operations_extension +#: model:ir.actions.act_window,name:mrp_operations_extension.mrp_routing_operation_action +#: view:mrp.routing.operation:mrp_operations_extension.rountig_operation_form +#: view:mrp.routing.operation:mrp_operations_extension.rountig_operation_tree +msgid "Routing Operation" +msgstr "" + +#. module: mrp_operations_extension +#: view:mrp.workcenter:mrp_operations_extension.mrp_workcenter_form_view_inh +#: field:mrp.workcenter,rt_operations:0 +msgid "Routing Operations" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.production.workcenter.line,routing_wc_line:0 +msgid "Routing WC Line" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,routing_workcenter:0 +msgid "Routing Workcenter" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.work.order.produce,product_qty:0 +msgid "Select Quantity" +msgstr "" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_stock_move +msgid "Stock Move" +msgstr "" + +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_routing_workcenter.py:65 +#: code:addons/mrp_operations_extension/models/mrp_routing_workcenter.py:79 +#, python-format +msgid "There is another line set as default, disable it first." +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,time_stop:0 +msgid "Time after prod." +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,time_start:0 +msgid "Time before prod." +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,time_cycle:0 +msgid "Time for 1 cycle (hour)" +msgstr "" + +#. module: mrp_operations_extension +#: help:mrp.operation.workcenter,time_cycle:0 +msgid "Time in hours for doing one cycle." +msgstr "" + +#. module: mrp_operations_extension +#: help:mrp.operation.workcenter,time_stop:0 +msgid "Time in hours for the cleaning." +msgstr "" + +#. module: mrp_operations_extension +#: help:mrp.operation.workcenter,time_start:0 +msgid "Time in hours for the setup." +msgstr "" + +#. module: mrp_operations_extension +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_produce_wizard +msgid "To Consume" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.work.order.produce,track_production:0 +msgid "Track production" +msgstr "" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_workcenter +#: field:mrp.operation.workcenter,workcenter:0 +msgid "Work Center" +msgstr "" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_routing_workcenter +msgid "Work Center Usage" +msgstr "" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_production_workcenter_line +#: field:mrp.production.product.line,work_order:0 +#: field:stock.move,work_order:0 +msgid "Work Order" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.routing.operation,workcenters:0 +msgid "Work centers" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.product.produce.line,work_produce_id:0 +msgid "Work produce id" +msgstr "" + +#. module: mrp_operations_extension +#: view:mrp.routing.workcenter:mrp_operations_extension.mrp_routing_workcenter_form_view_inh +#: field:mrp.routing.workcenter,op_wc_lines:0 +msgid "Workcenter Info Lines" +msgstr "" + +#. module: mrp_operations_extension +#: view:mrp.routing.operation:mrp_operations_extension.rountig_operation_form +msgid "Workcenters" +msgstr "" + +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_operation_buttons_form_view +msgid "oe_highlight" +msgstr "" + +#. module: mrp_operations_extension +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard +#: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_produce_wizard +msgid "or" +msgstr "" + diff --git a/mrp_operations_extension/models/mrp_bom.py b/mrp_operations_extension/models/mrp_bom.py index e9d78a3e4df..3a6b0a6d15c 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, api +from openerp import models, fields, api, _ class MrpBom(models.Model): @@ -54,8 +54,25 @@ def _get_workorder_operations(self, result2, level=0, routing_id=False): work_order['routing_wc_line'] = routing_line_id return result2 + @api.multi + @api.onchange('routing_id') + def onchange_routing_id(self): + for line in self.bom_line_ids: + line.operation = (self.routing_id.workcenter_lines and + self.routing_id.workcenter_lines[0]) + if self.routing_id: + return {'warning': { + 'title': _('Changing Routing'), + 'message': _("Changing routing will cause to change the" + " operation in which each component will be" + " consumed, by default it is set the first" + " one of the routing") + }} + return {} + class MrpBomLine(models.Model): _inherit = 'mrp.bom.line' - operation = fields.Many2one('mrp.routing.workcenter', 'Consumed') + operation = fields.Many2one( + comodel_name='mrp.routing.workcenter', string='Consumed in') diff --git a/mrp_operations_extension/models/mrp_routing_operation.py b/mrp_operations_extension/models/mrp_routing_operation.py index d44196eb8a3..fee7bc5796a 100644 --- a/mrp_operations_extension/models/mrp_routing_operation.py +++ b/mrp_operations_extension/models/mrp_routing_operation.py @@ -54,6 +54,29 @@ def onchange_workcenter(self): self.op_avg_cost = self.workcenter.op_avg_cost self.default = False + @api.model + def create(self, vals): + res = super(MrpOperationWorkcenter, self).create(vals) + if vals.get('default', False): + routing_obj = self.env['mrp.routing.workcenter'] + routing = routing_obj.browse(vals.get('routing_workcenter', False)) + routing.workcenter_id = vals.get('workcenter', False) + for line in routing.op_wc_lines: + if line != res: + line.default = False + return res + + @api.multi + def write(self, vals): + res = super(MrpOperationWorkcenter, self).write(vals) + for record in self: + if vals.get('default', False): + record.routing_workcenter.workcenter_id = record.workcenter + for line in record.routing_workcenter.op_wc_lines: + if line != record: + line.default = False + return res + class MrpRoutingOperation(models.Model): _name = 'mrp.routing.operation' diff --git a/mrp_operations_extension/models/mrp_routing_workcenter.py b/mrp_operations_extension/models/mrp_routing_workcenter.py index bfbf08d7ed7..b8c4ac1ed56 100644 --- a/mrp_operations_extension/models/mrp_routing_workcenter.py +++ b/mrp_operations_extension/models/mrp_routing_workcenter.py @@ -25,7 +25,7 @@ class MrpRoutingWorkcenter(models.Model): operation = fields.Many2one('mrp.routing.operation', string='Operation') op_wc_lines = fields.One2many('mrp.operation.workcenter', 'routing_workcenter', - 'Workcenter Info Lines') + 'Possible work centers for this operation') do_production = fields.Boolean( string='Move produced quantity to stock') @@ -38,43 +38,37 @@ def onchange_operation(self): 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 - } + 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.onchange('workcenter_id') + def onchange_workcenter(self): + if self.workcenter_id: + self.hour_nbr = self.workcenter_id.time_cycle + for line in self.op_wc_lines: + line.default = False + if line.workcenter == self.workcenter_id: + line.default = True @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.')) + @api.onchange('op_wc_lines') + def onchange_lines_default(self): + default = 0 + for line in self.op_wc_lines: + if line.default: + self.workcenter_id = line.workcenter + default += 1 + if default > 1: + raise exceptions.Warning(_('There is another line set as' + ' default, disable it first.')) diff --git a/mrp_operations_extension/models/res_config.py b/mrp_operations_extension/models/res_config.py index b3dc8aa1697..c2816a67ea7 100644 --- a/mrp_operations_extension/models/res_config.py +++ b/mrp_operations_extension/models/res_config.py @@ -23,5 +23,5 @@ class MrpConfigSettings(models.TransientModel): _inherit = 'mrp.config.settings' group_mrp_workers = fields.Boolean( - string='Manage operators ', implied_group='mrp_operations_extension.group_mrp_workers', - help='') + string='Manage operators in work centers ', + implied_group='mrp_operations_extension.group_mrp_workers') diff --git a/mrp_operations_extension/views/mrp_production_view.xml b/mrp_operations_extension/views/mrp_production_view.xml index 8ed299e9402..7ea90b925fa 100644 --- a/mrp_operations_extension/views/mrp_production_view.xml +++ b/mrp_operations_extension/views/mrp_production_view.xml @@ -75,12 +75,6 @@ expr="//field[@name='workcenter_lines']/form//field[@name='hour']" position="replace">
- - +
diff --git a/mrp_operations_extension/views/mrp_routing_workcenter_view.xml b/mrp_operations_extension/views/mrp_routing_workcenter_view.xml index 84bae1ba570..e58049b95c5 100644 --- a/mrp_operations_extension/views/mrp_routing_workcenter_view.xml +++ b/mrp_operations_extension/views/mrp_routing_workcenter_view.xml @@ -10,6 +10,9 @@ + + float_time + From 23c6cbf99e01942527698c009c6a5c2d1a244dcc Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Sun, 18 Jan 2015 13:19:15 +0100 Subject: [PATCH 15/45] [FIX+IMP] mrp_operations_extension FIX: Operation where is production properly handled IMP: Some views enhanced FIX: No warning at MO confirmation if there is no route. IMP: Show cycle length and capacity in route. FIX: Propagate capacity data. --- mrp_operations_extension/__openerp__.py | 2 +- mrp_operations_extension/i18n/es.po | 245 ++++++++++-------- .../i18n/mrp_operations_extension.pot | 117 +++++---- mrp_operations_extension/models/__init__.py | 2 +- mrp_operations_extension/models/mrp_bom.py | 2 + .../models/mrp_production.py | 53 ++-- .../models/mrp_routing.py | 123 +++++++++ .../models/mrp_routing_operation.py | 65 +---- .../models/mrp_routing_workcenter.py | 74 ------ .../views/mrp_production_view.xml | 55 ++-- .../views/mrp_routing_operation_view.xml | 38 +-- ...rkcenter_view.xml => mrp_routing_view.xml} | 58 +++-- 12 files changed, 416 insertions(+), 418 deletions(-) create mode 100644 mrp_operations_extension/models/mrp_routing.py delete mode 100644 mrp_operations_extension/models/mrp_routing_workcenter.py rename mrp_operations_extension/views/{mrp_routing_workcenter_view.xml => mrp_routing_view.xml} (54%) diff --git a/mrp_operations_extension/__openerp__.py b/mrp_operations_extension/__openerp__.py index 322dbe1681c..74d9a8ed015 100644 --- a/mrp_operations_extension/__openerp__.py +++ b/mrp_operations_extension/__openerp__.py @@ -41,7 +41,7 @@ "views/mrp_routing_operation_view.xml", "views/mrp_production_view.xml", "views/mrp_bom_view.xml", - "views/mrp_routing_workcenter_view.xml", + "views/mrp_routing_view.xml", "views/res_config_view.xml", "security/ir.model.access.csv", "security/mrp_operations_extension_security.xml", diff --git a/mrp_operations_extension/i18n/es.po b/mrp_operations_extension/i18n/es.po index b1be3bdaaec..bb03bf4d2a4 100644 --- a/mrp_operations_extension/i18n/es.po +++ b/mrp_operations_extension/i18n/es.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-01-05 08:28+0000\n" -"PO-Revision-Date: 2015-01-05 08:28+0000\n" +"POT-Creation-Date: 2015-01-18 12:06+0000\n" +"PO-Revision-Date: 2015-01-18 12:06+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -18,31 +18,31 @@ msgstr "" #. module: mrp_operations_extension #: field:mrp.operation.workcenter,op_number:0 #: field:mrp.routing.operation,op_number:0 -msgid "# Operators" -msgstr "# Operators" +msgid "# operators" +msgstr "Nº operadores" #. module: mrp_operations_extension #: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh #: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view msgid "Actual Production Date" -msgstr "Fecha real de fabricación" +msgstr "Fecha real de producción" #. module: mrp_operations_extension -#: code:addons/mrp_operations_extension/models/mrp_production.py:78 +#: code:addons/mrp_operations_extension/models/mrp_production.py:29 #, python-format -msgid "At least one operation must have checked \"Move produced quantity to stock\"field" -msgstr "At least one operation must have checked \"Move produced quantity to stock\"field" +msgid "At least one work order must have checked 'Produce here'" +msgstr "Al menos una órden de trabajo debe tener marcada 'Producir aquí'" #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_mrp_bom msgid "Bill of Material" -msgstr "Lista de material" +msgstr "Lista de materiales" #. module: mrp_operations_extension #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_produce_wizard msgid "Cancel" -msgstr "Cancel" +msgstr "Cancelar" #. module: mrp_operations_extension #: view:mrp.production:mrp_operations_extension.mrp_production_operation_buttons_form_view @@ -51,67 +51,84 @@ msgstr "Cancelar orden" #. module: mrp_operations_extension #: field:mrp.operation.workcenter,capacity_per_cycle:0 -msgid "Capacity per Cycle" -msgstr "Capacity per Cycle" +msgid "Capacity per cycle" +msgstr "Capacidad por ciclo" + +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_bom.py:67 +#, python-format +msgid "Changing Routing" +msgstr "Cambiando ruta" + +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_bom.py:68 +#, python-format +msgid "Changing routing will cause to change the operation in which each component will be consumed, by default it is set the first one of the routing" +msgstr "Cambiar la ruta causará que cambie la operación en la que cada componente se consumirá. Por defecto se establece la primera de la ruta." #. module: mrp_operations_extension #: field:mrp.routing.operation,code:0 msgid "Code" -msgstr "Code" +msgstr "Código" #. module: mrp_operations_extension #: model:ir.actions.act_window,name:mrp_operations_extension.act_mrp_work_order_consume -#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +#: view:mrp.production:mrp_operations_extension.mrp_production_operation_buttons_form_view #: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard msgid "Consume" -msgstr "Consume" +msgstr "Consumir" #. module: mrp_operations_extension #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_produce_wizard #: selection:mrp.work.order.produce,mode:0 msgid "Consume & Produce" -msgstr "Consume & Produce" +msgstr "Consumir y producir" #. module: mrp_operations_extension #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_produce_wizard msgid "Consume Lines" -msgstr "Consume Lines" +msgstr "Líneas de consumo" #. module: mrp_operations_extension #: selection:mrp.work.order.produce,mode:0 msgid "Consume Only" -msgstr "Consume Only" +msgstr "Sólo consumir" #. module: mrp_operations_extension #: field:mrp.bom.line,operation:0 -msgid "Consumed" -msgstr "Consumed" +msgid "Consumed in" +msgstr "Consumido en" #. module: mrp_operations_extension #: field:mrp.operation.workcenter,create_uid:0 #: field:mrp.routing.operation,create_uid:0 #: field:mrp.work.order.produce,create_uid:0 msgid "Created by" -msgstr "Created by" +msgstr "Creado por" #. module: mrp_operations_extension #: field:mrp.operation.workcenter,create_date:0 #: field:mrp.routing.operation,create_date:0 #: field:mrp.work.order.produce,create_date:0 msgid "Created on" -msgstr "Created on" +msgstr "Creado en" #. module: mrp_operations_extension #: field:mrp.operation.workcenter,default:0 msgid "Default" -msgstr "Default" +msgstr "Por defecto" + +#. module: mrp_operations_extension +#: view:mrp.routing.workcenter:mrp_operations_extension.mrp_routing_workcenter_tree_view_inh +msgid "Default workcenter" +msgstr "Centro de trabajo por defecto" #. module: mrp_operations_extension #: field:mrp.routing.operation,description:0 msgid "Description" -msgstr "Description" +msgstr "Descripción" #. module: mrp_operations_extension #: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh @@ -121,18 +138,18 @@ msgstr "Duración" #. module: mrp_operations_extension #: field:mrp.operation.workcenter,time_efficiency:0 -msgid "Efficiency Factor" -msgstr "Efficiency Factor" +msgid "Efficiency factor" +msgstr "Factor de eficacia" #. module: mrp_operations_extension #: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view msgid "Extra Information" -msgstr "Extra Information" +msgstr "Información extra" #. module: mrp_operations_extension #: field:mrp.work.order.produce,final_product:0 msgid "Final Product to Stock" -msgstr "Final Product to Stock" +msgstr "Producto final a existencias" #. module: mrp_operations_extension #: field:mrp.operation.workcenter,id:0 @@ -141,6 +158,11 @@ msgstr "Final Product to Stock" msgid "ID" msgstr "ID" +#. module: mrp_operations_extension +#: help:mrp.routing.workcenter,do_production:0 +msgid "If enabled, the production and movement to stock of the final products will be done in this operation. There can be only one operation per route with this check marked." +msgstr "Si está habilitado, la producción y el movimiento a existencias de los productos finales se realizará en esta operación. Sólo puede haber una operación por ruta con esta casilla marcada." + #. module: mrp_operations_extension #: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh #: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view @@ -152,65 +174,49 @@ msgstr "Información" #: field:mrp.routing.operation,write_uid:0 #: field:mrp.work.order.produce,write_uid:0 msgid "Last Updated by" -msgstr "Last Updated by" +msgstr "Última actualización por" #. module: mrp_operations_extension #: field:mrp.operation.workcenter,write_date:0 #: field:mrp.routing.operation,write_date:0 #: field:mrp.work.order.produce,write_date:0 msgid "Last Updated on" -msgstr "Last Updated on" +msgstr "Última actualización en" #. module: mrp_operations_extension #: field:mrp.work.order.produce,lot_id:0 msgid "Lot" -msgstr "Lot" +msgstr "Lote" #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_mrp_operation_workcenter msgid "MRP Operation Workcenter" -msgstr "MRP Operation Workcenter" +msgstr "Centro de trabajo de la operación" #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_mrp_routing_operation msgid "MRP Routing Operation" -msgstr "MRP Routing Operation" +msgstr "Operación de la ruta" #. module: mrp_operations_extension #: field:mrp.config.settings,group_mrp_workers:0 msgid "Manage operators in work centers " -msgstr "Manage operators in work centers " +msgstr "Gestionar operadores en los centros de trabajo" #. module: mrp_operations_extension #: model:res.groups,name:mrp_operations_extension.group_mrp_workers msgid "Manufacturing Operators" -msgstr "Manufacturing Operators" - -#. module: mrp_operations_extension -#: model:ir.model,name:mrp_operations_extension.model_mrp_production -msgid "Manufacturing Order" -msgstr "Órden de producción" +msgstr "Operadores de fabricación" #. module: mrp_operations_extension #: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh msgid "Materials" -msgstr "Materials" +msgstr "Materiales" #. module: mrp_operations_extension #: field:mrp.work.order.produce,mode:0 msgid "Mode" -msgstr "Mode" - -#. module: mrp_operations_extension -#: field:mrp.production.workcenter.line,do_production:0 -#: field:mrp.routing.operation,do_production:0 -msgid "Move Final Product to Stock" -msgstr "Move Final Product to Stock" - -#. module: mrp_operations_extension -#: field:mrp.routing.workcenter,do_production:0 -msgid "Move produced quantity to stock" -msgstr "Move produced quantity to stock" +msgstr "Modo" #. module: mrp_operations_extension #: field:mrp.routing.operation,name:0 @@ -225,17 +231,17 @@ msgstr "Operación" #. module: mrp_operations_extension #: model:ir.ui.menu,name:mrp_operations_extension.mrp_routing_menu msgid "Operations" -msgstr "Operaciones" - -#. module: mrp_operations_extension -#: field:mrp.operation.workcenter,op_avg_cost:0 -msgid "Operator Average Cost" -msgstr "Coste medio de operador" +msgstr "" #. module: mrp_operations_extension #: field:mrp.workcenter,op_avg_cost:0 msgid "Operator average cost" -msgstr "Coste medio de operador" +msgstr "Coste medio del operador" + +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,op_avg_cost:0 +msgid "Operator avg. cost" +msgstr "Coste medio operador" #. module: mrp_operations_extension #: view:mrp.workcenter:mrp_operations_extension.mrp_workcenter_form_view_inh @@ -246,55 +252,65 @@ msgstr "Operadores" #. module: mrp_operations_extension #: field:mrp.routing.operation,picking_type_id:0 msgid "Picking Type" -msgstr "Picking Type" +msgstr "Tipo de albarán" #. module: mrp_operations_extension #: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh #: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view msgid "Planned Date" -msgstr "Fecha planeada" +msgstr "Fecha planificada" + +#. module: mrp_operations_extension +#: field:mrp.routing.workcenter,op_wc_lines:0 +msgid "Possible work centers for this operation" +msgstr "Posibles centros de trabajo para esta operación" + +#. module: mrp_operations_extension +#: view:mrp.routing.workcenter:mrp_operations_extension.mrp_routing_workcenter_form_view_inh +msgid "Possible workcenters" +msgstr "Posibles centros de trabajo" #. module: mrp_operations_extension #: field:mrp.workcenter,post_op_product:0 -msgid "Post Operation Cost" -msgstr "Coste de post-operación" +msgid "Post-operation costing product" +msgstr "" #. module: mrp_operations_extension #: field:mrp.workcenter,pre_op_product:0 -msgid "Pre Operation Cost" -msgstr "Coste de pre-operación" +msgid "Pre-operation costing product" +msgstr "Producto de coste de pre-operación" #. module: mrp_operations_extension #: model:ir.actions.act_window,name:mrp_operations_extension.act_mrp_work_order_produce -#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +#: view:mrp.production:mrp_operations_extension.mrp_production_operation_buttons_form_view #: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_produce_wizard msgid "Produce" -msgstr "Fabricar" +msgstr "Producir" #. module: mrp_operations_extension -#: code:addons/mrp_operations_extension/models/mrp_production.py:78 -#, python-format -msgid "Produce Operation" -msgstr "Produce Operation" +#: field:mrp.production.workcenter.line,do_production:0 +#: field:mrp.routing.workcenter,do_production:0 +msgid "Produce here" +msgstr "Producir aquí" #. module: mrp_operations_extension #: field:mrp.work.order.produce,product_id:0 msgid "Product" -msgstr "Product" +msgstr "Producto" #. module: mrp_operations_extension #: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh #: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view #: field:mrp.production.workcenter.line,product_line:0 msgid "Product Lines" -msgstr "Líneas de Producto" +msgstr "Líneas de producto" #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_mrp_product_produce_line msgid "Product Produce Consume lines" -msgstr "Líneas de consumo de los producto producidos" +msgstr "Líneas de consumo de productos producidos" #. module: mrp_operations_extension #: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh @@ -305,45 +321,50 @@ msgstr "Producto a producir" #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_mrp_production_product_line msgid "Production Scheduled Product" -msgstr "Fabricación planificada producto" +msgstr "Producto planificado de producción" #. module: mrp_operations_extension #: field:mrp.work.order.produce,consume_lines:0 msgid "Products Consumed" -msgstr "Products Consumed" +msgstr "Productos consumidos" #. module: mrp_operations_extension #: field:mrp.routing.operation,steps:0 msgid "Relevant Steps" -msgstr "Relevant Steps" +msgstr "Pasos relevantes" + +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_routing +msgid "Routing" +msgstr "Ruta" #. module: mrp_operations_extension #: model:ir.actions.act_window,name:mrp_operations_extension.mrp_routing_operation_action #: view:mrp.routing.operation:mrp_operations_extension.rountig_operation_form #: view:mrp.routing.operation:mrp_operations_extension.rountig_operation_tree msgid "Routing Operation" -msgstr "Routing Operation" +msgstr "Operación de la ruta" #. module: mrp_operations_extension #: view:mrp.workcenter:mrp_operations_extension.mrp_workcenter_form_view_inh #: field:mrp.workcenter,rt_operations:0 msgid "Routing Operations" -msgstr "Routing Operations" +msgstr "Operaciones de la ruta" #. module: mrp_operations_extension #: field:mrp.production.workcenter.line,routing_wc_line:0 msgid "Routing WC Line" -msgstr "Routing WC Line" +msgstr "Línea de CT de la ruta" #. module: mrp_operations_extension #: field:mrp.operation.workcenter,routing_workcenter:0 -msgid "Routing Workcenter" -msgstr "Routing Workcenter" +msgid "Routing workcenter" +msgstr "Centro de trabajo de la ruta" #. module: mrp_operations_extension #: field:mrp.work.order.produce,product_qty:0 msgid "Select Quantity" -msgstr "Select Quantity" +msgstr "Seleccione cantidad" #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_stock_move @@ -351,96 +372,94 @@ msgid "Stock Move" msgstr "Movimiento de existencias" #. module: mrp_operations_extension -#: code:addons/mrp_operations_extension/models/mrp_routing_workcenter.py:65 -#: code:addons/mrp_operations_extension/models/mrp_routing_workcenter.py:79 +#: code:addons/mrp_operations_extension/models/mrp_routing.py:57 +#, python-format +msgid "There must be one and only one line set as default." +msgstr "Debe haber una y sólo una línea marcado como por defecto." + +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_routing.py:33 #, python-format -msgid "There is another line set as default, disable it first." -msgstr "There is another line set as default, disable it first." +msgid "There must be one and only one operation with 'Produce here' check marked." +msgstr "Debe haber una y sólo una operación con la casilla 'Producir aquí' marcada." #. module: mrp_operations_extension #: field:mrp.operation.workcenter,time_stop:0 msgid "Time after prod." -msgstr "Time after prod." +msgstr "Tiempo después de prod." #. module: mrp_operations_extension #: field:mrp.operation.workcenter,time_start:0 msgid "Time before prod." -msgstr "Time before prod." +msgstr "Tiempo antes de prod." #. module: mrp_operations_extension #: field:mrp.operation.workcenter,time_cycle:0 -msgid "Time for 1 cycle (hour)" -msgstr "Time for 1 cycle (hour)" +msgid "Time for 1 cycle (hours)" +msgstr "Tiempo para 1 ciclo (horas)" #. module: mrp_operations_extension #: help:mrp.operation.workcenter,time_cycle:0 msgid "Time in hours for doing one cycle." -msgstr "Time in hours for doing one cycle." +msgstr "Time en horas para realizar un ciclo." #. module: mrp_operations_extension #: help:mrp.operation.workcenter,time_stop:0 msgid "Time in hours for the cleaning." -msgstr "Time in hours for the cleaning." +msgstr "Tiempo en horas para la limpieza." #. module: mrp_operations_extension #: help:mrp.operation.workcenter,time_start:0 msgid "Time in hours for the setup." -msgstr "Time in hours for the setup." +msgstr "Tiempo en horas para la preparación" #. module: mrp_operations_extension #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_produce_wizard msgid "To Consume" -msgstr "To Consume" +msgstr "A consumir" #. module: mrp_operations_extension #: field:mrp.work.order.produce,track_production:0 msgid "Track production" -msgstr "Track production" +msgstr "Rastrear producción" #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_mrp_workcenter -#: field:mrp.operation.workcenter,workcenter:0 msgid "Work Center" -msgstr "Centro de producción" +msgstr "Centro de trabajo" #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_mrp_routing_workcenter msgid "Work Center Usage" -msgstr "Utilización del centro de producción" +msgstr "Uso del centro de trabajo" #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_mrp_production_workcenter_line #: field:mrp.production.product.line,work_order:0 #: field:stock.move,work_order:0 msgid "Work Order" -msgstr "Orden de trabajo" +msgstr "Órden de trabajo" #. module: mrp_operations_extension #: field:mrp.routing.operation,workcenters:0 msgid "Work centers" -msgstr "Centros de producción" +msgstr "Centros de trabajo" #. module: mrp_operations_extension #: field:mrp.product.produce.line,work_produce_id:0 msgid "Work produce id" -msgstr "Work produce id" +msgstr "ID de centro de producción" #. module: mrp_operations_extension -#: view:mrp.routing.workcenter:mrp_operations_extension.mrp_routing_workcenter_form_view_inh -#: field:mrp.routing.workcenter,op_wc_lines:0 -msgid "Workcenter Info Lines" -msgstr "Líneas de info. de centro de producción" +#: field:mrp.operation.workcenter,workcenter:0 +msgid "Workcenter" +msgstr "Centro de trabajo" #. module: mrp_operations_extension #: view:mrp.routing.operation:mrp_operations_extension.rountig_operation_form msgid "Workcenters" -msgstr "Workcenters" - -#. module: mrp_operations_extension -#: view:mrp.production:mrp_operations_extension.mrp_production_operation_buttons_form_view -msgid "oe_highlight" -msgstr "oe_highlight" +msgstr "Centros de trabajo" #. module: mrp_operations_extension #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard diff --git a/mrp_operations_extension/i18n/mrp_operations_extension.pot b/mrp_operations_extension/i18n/mrp_operations_extension.pot index 366ad219ddd..a4d8b72b78f 100644 --- a/mrp_operations_extension/i18n/mrp_operations_extension.pot +++ b/mrp_operations_extension/i18n/mrp_operations_extension.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-01-05 08:25+0000\n" -"PO-Revision-Date: 2015-01-05 08:25+0000\n" +"POT-Creation-Date: 2015-01-18 12:06+0000\n" +"PO-Revision-Date: 2015-01-18 12:06+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -18,7 +18,7 @@ msgstr "" #. module: mrp_operations_extension #: field:mrp.operation.workcenter,op_number:0 #: field:mrp.routing.operation,op_number:0 -msgid "# Operators" +msgid "# operators" msgstr "" #. module: mrp_operations_extension @@ -28,9 +28,9 @@ msgid "Actual Production Date" msgstr "" #. module: mrp_operations_extension -#: code:addons/mrp_operations_extension/models/mrp_production.py:78 +#: code:addons/mrp_operations_extension/models/mrp_production.py:29 #, python-format -msgid "At least one operation must have checked \"Move produced quantity to stock\"field" +msgid "At least one work order must have checked 'Produce here'" msgstr "" #. module: mrp_operations_extension @@ -51,7 +51,19 @@ msgstr "" #. module: mrp_operations_extension #: field:mrp.operation.workcenter,capacity_per_cycle:0 -msgid "Capacity per Cycle" +msgid "Capacity per cycle" +msgstr "" + +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_bom.py:67 +#, python-format +msgid "Changing Routing" +msgstr "" + +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_bom.py:68 +#, python-format +msgid "Changing routing will cause to change the operation in which each component will be consumed, by default it is set the first one of the routing" msgstr "" #. module: mrp_operations_extension @@ -61,7 +73,7 @@ msgstr "" #. module: mrp_operations_extension #: model:ir.actions.act_window,name:mrp_operations_extension.act_mrp_work_order_consume -#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +#: view:mrp.production:mrp_operations_extension.mrp_production_operation_buttons_form_view #: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard msgid "Consume" @@ -86,7 +98,7 @@ msgstr "" #. module: mrp_operations_extension #: field:mrp.bom.line,operation:0 -msgid "Consumed" +msgid "Consumed in" msgstr "" #. module: mrp_operations_extension @@ -108,6 +120,11 @@ msgstr "" msgid "Default" msgstr "" +#. module: mrp_operations_extension +#: view:mrp.routing.workcenter:mrp_operations_extension.mrp_routing_workcenter_tree_view_inh +msgid "Default workcenter" +msgstr "" + #. module: mrp_operations_extension #: field:mrp.routing.operation,description:0 msgid "Description" @@ -121,7 +138,7 @@ msgstr "" #. module: mrp_operations_extension #: field:mrp.operation.workcenter,time_efficiency:0 -msgid "Efficiency Factor" +msgid "Efficiency factor" msgstr "" #. module: mrp_operations_extension @@ -141,6 +158,11 @@ msgstr "" msgid "ID" msgstr "" +#. module: mrp_operations_extension +#: help:mrp.routing.workcenter,do_production:0 +msgid "If enabled, the production and movement to stock of the final products will be done in this operation. There can be only one operation per route with this check marked." +msgstr "" + #. module: mrp_operations_extension #: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh #: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view @@ -186,11 +208,6 @@ msgstr "" msgid "Manufacturing Operators" msgstr "" -#. module: mrp_operations_extension -#: model:ir.model,name:mrp_operations_extension.model_mrp_production -msgid "Manufacturing Order" -msgstr "" - #. module: mrp_operations_extension #: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh msgid "Materials" @@ -201,17 +218,6 @@ msgstr "" msgid "Mode" msgstr "" -#. module: mrp_operations_extension -#: field:mrp.production.workcenter.line,do_production:0 -#: field:mrp.routing.operation,do_production:0 -msgid "Move Final Product to Stock" -msgstr "" - -#. module: mrp_operations_extension -#: field:mrp.routing.workcenter,do_production:0 -msgid "Move produced quantity to stock" -msgstr "" - #. module: mrp_operations_extension #: field:mrp.routing.operation,name:0 msgid "Name" @@ -228,13 +234,13 @@ msgid "Operations" msgstr "" #. module: mrp_operations_extension -#: field:mrp.operation.workcenter,op_avg_cost:0 -msgid "Operator Average Cost" +#: field:mrp.workcenter,op_avg_cost:0 +msgid "Operator average cost" msgstr "" #. module: mrp_operations_extension -#: field:mrp.workcenter,op_avg_cost:0 -msgid "Operator average cost" +#: field:mrp.operation.workcenter,op_avg_cost:0 +msgid "Operator avg. cost" msgstr "" #. module: mrp_operations_extension @@ -254,19 +260,29 @@ msgstr "" msgid "Planned Date" msgstr "" +#. module: mrp_operations_extension +#: field:mrp.routing.workcenter,op_wc_lines:0 +msgid "Possible work centers for this operation" +msgstr "" + +#. module: mrp_operations_extension +#: view:mrp.routing.workcenter:mrp_operations_extension.mrp_routing_workcenter_form_view_inh +msgid "Possible workcenters" +msgstr "" + #. module: mrp_operations_extension #: field:mrp.workcenter,post_op_product:0 -msgid "Post Operation Cost" +msgid "Post-operation costing product" msgstr "" #. module: mrp_operations_extension #: field:mrp.workcenter,pre_op_product:0 -msgid "Pre Operation Cost" +msgid "Pre-operation costing product" msgstr "" #. module: mrp_operations_extension #: model:ir.actions.act_window,name:mrp_operations_extension.act_mrp_work_order_produce -#: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh +#: view:mrp.production:mrp_operations_extension.mrp_production_operation_buttons_form_view #: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_produce_wizard @@ -274,9 +290,9 @@ msgid "Produce" msgstr "" #. module: mrp_operations_extension -#: code:addons/mrp_operations_extension/models/mrp_production.py:78 -#, python-format -msgid "Produce Operation" +#: field:mrp.production.workcenter.line,do_production:0 +#: field:mrp.routing.workcenter,do_production:0 +msgid "Produce here" msgstr "" #. module: mrp_operations_extension @@ -317,6 +333,11 @@ msgstr "" msgid "Relevant Steps" msgstr "" +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_routing +msgid "Routing" +msgstr "" + #. module: mrp_operations_extension #: model:ir.actions.act_window,name:mrp_operations_extension.mrp_routing_operation_action #: view:mrp.routing.operation:mrp_operations_extension.rountig_operation_form @@ -337,7 +358,7 @@ msgstr "" #. module: mrp_operations_extension #: field:mrp.operation.workcenter,routing_workcenter:0 -msgid "Routing Workcenter" +msgid "Routing workcenter" msgstr "" #. module: mrp_operations_extension @@ -351,10 +372,15 @@ msgid "Stock Move" msgstr "" #. module: mrp_operations_extension -#: code:addons/mrp_operations_extension/models/mrp_routing_workcenter.py:65 -#: code:addons/mrp_operations_extension/models/mrp_routing_workcenter.py:79 +#: code:addons/mrp_operations_extension/models/mrp_routing.py:57 +#, python-format +msgid "There must be one and only one line set as default." +msgstr "" + +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_routing.py:33 #, python-format -msgid "There is another line set as default, disable it first." +msgid "There must be one and only one operation with 'Produce here' check marked." msgstr "" #. module: mrp_operations_extension @@ -369,7 +395,7 @@ msgstr "" #. module: mrp_operations_extension #: field:mrp.operation.workcenter,time_cycle:0 -msgid "Time for 1 cycle (hour)" +msgid "Time for 1 cycle (hours)" msgstr "" #. module: mrp_operations_extension @@ -400,7 +426,6 @@ msgstr "" #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_mrp_workcenter -#: field:mrp.operation.workcenter,workcenter:0 msgid "Work Center" msgstr "" @@ -427,9 +452,8 @@ msgid "Work produce id" msgstr "" #. module: mrp_operations_extension -#: view:mrp.routing.workcenter:mrp_operations_extension.mrp_routing_workcenter_form_view_inh -#: field:mrp.routing.workcenter,op_wc_lines:0 -msgid "Workcenter Info Lines" +#: field:mrp.operation.workcenter,workcenter:0 +msgid "Workcenter" msgstr "" #. module: mrp_operations_extension @@ -437,11 +461,6 @@ msgstr "" msgid "Workcenters" msgstr "" -#. module: mrp_operations_extension -#: view:mrp.production:mrp_operations_extension.mrp_production_operation_buttons_form_view -msgid "oe_highlight" -msgstr "" - #. module: mrp_operations_extension #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_produce_wizard diff --git a/mrp_operations_extension/models/__init__.py b/mrp_operations_extension/models/__init__.py index 52a72a636db..240ea76e9cb 100644 --- a/mrp_operations_extension/models/__init__.py +++ b/mrp_operations_extension/models/__init__.py @@ -16,7 +16,7 @@ # ############################################################################## -from . import mrp_routing_workcenter +from . import mrp_routing 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 index 3a6b0a6d15c..7d3ad683cf7 100644 --- a/mrp_operations_extension/models/mrp_bom.py +++ b/mrp_operations_extension/models/mrp_bom.py @@ -52,6 +52,8 @@ def _get_workorder_operations(self, result2, level=0, routing_id=False): break if 'routing_wc_line' not in work_order: work_order['routing_wc_line'] = routing_line_id + wc = self.env['mrp.routing.workcenter'].browse(routing_line_id) + work_order['do_production'] = wc.do_production return result2 @api.multi diff --git a/mrp_operations_extension/models/mrp_production.py b/mrp_operations_extension/models/mrp_production.py index df4cf6045a3..77ecd59ef3b 100644 --- a/mrp_operations_extension/models/mrp_production.py +++ b/mrp_operations_extension/models/mrp_production.py @@ -22,17 +22,24 @@ class MrpProduction(models.Model): _inherit = 'mrp.production' + @api.multi + def action_confirm(self): + if (self.routing_id and + not any([x.do_production for x in self.workcenter_lines])): + raise exceptions.Warning( + _("At least one work order must have checked 'Produce here'")) + return super(MrpProduction, self).action_confirm() + @api.multi def _action_compute_lines(self, properties=None): - res = super(MrpProduction, - self)._action_compute_lines(properties=properties) - self._get_workorder_in_product_lines(self.workcenter_lines, - self.product_lines, - properties=properties) + res = super(MrpProduction, self)._action_compute_lines( + properties=properties) + self._get_workorder_in_product_lines( + self.workcenter_lines, self.product_lines, properties=properties) return res - def _get_workorder_in_product_lines(self, workcenter_lines, product_lines, - properties=None): + 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: @@ -62,25 +69,6 @@ def _make_production_consume_line(self, line): move.work_order = line.work_order.id return res - @api.multi - def action_compute(self, properties=None): - res = super(MrpProduction, self).action_compute(properties=properties) - produce = False - if not self.routing_id: - produce = True - else: - for workcenter_line in self.workcenter_lines: - if workcenter_line.do_production: - produce = True - break - if not produce: - raise exceptions.Warning( - _('Produce Operation'), _('At least one operation ' - 'must have checked ' - '"Move produced quantity to stock"' - 'field')) - return res - class MrpProductionProductLine(models.Model): _inherit = 'mrp.production.product.line' @@ -96,15 +84,4 @@ class MrpProductionWorkcenterLine(models.Model): 'work_order', string='Product Lines') routing_wc_line = fields.Many2one('mrp.routing.workcenter', string='Routing WC Line') - do_production = fields.Boolean( - string='Move Final Product to Stock') - - @api.model - def create(self, data): - workcenter_obj = self.env['mrp.routing.workcenter'] - if 'routing_wc_line' in data: - routing_wc_line_id = data.get('routing_wc_line') - work = workcenter_obj.browse(routing_wc_line_id) - data.update({'do_production': - work.operation.do_production}) - return super(MrpProductionWorkcenterLine, self).create(data) + do_production = fields.Boolean(string='Produce here') diff --git a/mrp_operations_extension/models/mrp_routing.py b/mrp_operations_extension/models/mrp_routing.py new file mode 100644 index 00000000000..6bb226f7349 --- /dev/null +++ b/mrp_operations_extension/models/mrp_routing.py @@ -0,0 +1,123 @@ +# -*- 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 Affero General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +############################################################################## + +from openerp import models, fields, api, _ +from openerp.addons import decimal_precision as dp + + +class MrpRouting(models.Model): + _inherit = 'mrp.routing' + + @api.one + @api.constrains('workcenter_lines') + def _check_produce_operation(self): + if not self.workcenter_lines: + return + num_produce = sum([x.do_production for x in self.workcenter_lines]) + if num_produce != 1: + raise Warning(_("There must be one and only one operation with " + "'Produce here' check marked.")) + + +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', + string='Possible work centers for this operation') + do_production = fields.Boolean( + string='Produce here', + help="If enabled, the production and movement to stock of the final " + "products will be done in this operation. There can be only one " + "operation per route with this check marked.") + + @api.constrains('op_wc_lines') + def _check_default_op_wc_lines(self): + if not self.op_wc_lines: + return + num_default = len([x for x in self.op_wc_lines if x.default]) + if num_default != 1: + raise Warning( + _('There must be one and only one line set as default.')) + + @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 = [] + 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, + 'op_number': self.operation.op_number, + } + op_wc_lst.append(data) + op_wc_lst[0]['default'] = True + self.op_wc_lines = op_wc_lst + + @api.one + @api.onchange('op_wc_lines') + def onchange_lines_default(self): + for line in self.op_wc_lines: + if line.default: + self.workcenter_id = line.workcenter + self.cycle_nbr = line.capacity_per_cycle + self.hour_nbr = line.time_cycle + break + + +class MrpOperationWorkcenter(models.Model): + _name = 'mrp.operation.workcenter' + _description = 'MRP Operation Workcenter' + + workcenter = fields.Many2one( + 'mrp.workcenter', string='Workcenter', required=True) + routing_workcenter = fields.Many2one( + 'mrp.routing.workcenter', 'Routing workcenter', required=True) + time_efficiency = fields.Float('Efficiency factor') + capacity_per_cycle = fields.Float('Capacity per cycle') + time_cycle = fields.Float('Time for 1 cycle (hours)', + 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('# operators', default='0') + op_avg_cost = fields.Float( + string='Operator avg. cost', + digits=dp.get_precision('Product Price')) + 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.op_number = self.workcenter.op_number + self.op_avg_cost = self.workcenter.op_avg_cost diff --git a/mrp_operations_extension/models/mrp_routing_operation.py b/mrp_operations_extension/models/mrp_routing_operation.py index fee7bc5796a..de73ef22376 100644 --- a/mrp_operations_extension/models/mrp_routing_operation.py +++ b/mrp_operations_extension/models/mrp_routing_operation.py @@ -16,66 +16,7 @@ # ############################################################################## -from openerp import models, fields, api -from openerp.addons import decimal_precision as dp - - -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('# Operators', default='0') - op_avg_cost = fields.Float( - string='Operator Average Cost', - digits=dp.get_precision('Product Price')) - 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.op_number = self.workcenter.op_number - self.op_avg_cost = self.workcenter.op_avg_cost - self.default = False - - @api.model - def create(self, vals): - res = super(MrpOperationWorkcenter, self).create(vals) - if vals.get('default', False): - routing_obj = self.env['mrp.routing.workcenter'] - routing = routing_obj.browse(vals.get('routing_workcenter', False)) - routing.workcenter_id = vals.get('workcenter', False) - for line in routing.op_wc_lines: - if line != res: - line.default = False - return res - - @api.multi - def write(self, vals): - res = super(MrpOperationWorkcenter, self).write(vals) - for record in self: - if vals.get('default', False): - record.routing_workcenter.workcenter_id = record.workcenter - for line in record.routing_workcenter.op_wc_lines: - if line != record: - line.default = False - return res +from openerp import models, fields class MrpRoutingOperation(models.Model): @@ -89,8 +30,6 @@ class MrpRoutingOperation(models.Model): workcenters = fields.Many2many( 'mrp.workcenter', 'mrp_operation_workcenter_rel', 'operation', 'workcenter', 'Work centers') - op_number = fields.Integer('# Operators', default='0') - do_production = fields.Boolean( - string='Move Final Product to Stock') + op_number = fields.Integer('# operators', default='0') picking_type_id = fields.Many2one( 'stock.picking.type', string='Picking Type') diff --git a/mrp_operations_extension/models/mrp_routing_workcenter.py b/mrp_operations_extension/models/mrp_routing_workcenter.py deleted file mode 100644 index b8c4ac1ed56..00000000000 --- a/mrp_operations_extension/models/mrp_routing_workcenter.py +++ /dev/null @@ -1,74 +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 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 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', - 'Possible work centers for this operation') - do_production = fields.Boolean( - string='Move produced quantity to stock') - - @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.one - @api.onchange('workcenter_id') - def onchange_workcenter(self): - if self.workcenter_id: - self.hour_nbr = self.workcenter_id.time_cycle - for line in self.op_wc_lines: - line.default = False - if line.workcenter == self.workcenter_id: - line.default = True - - @api.one - @api.onchange('op_wc_lines') - def onchange_lines_default(self): - default = 0 - for line in self.op_wc_lines: - if line.default: - self.workcenter_id = line.workcenter - default += 1 - if default > 1: - raise exceptions.Warning(_('There is another line set as' - ' default, disable it first.')) diff --git a/mrp_operations_extension/views/mrp_production_view.xml b/mrp_operations_extension/views/mrp_production_view.xml index 7ea90b925fa..93edf1c9efd 100644 --- a/mrp_operations_extension/views/mrp_production_view.xml +++ b/mrp_operations_extension/views/mrp_production_view.xml @@ -32,60 +32,45 @@ mrp.production - + - + - + - + - + + + + 2 - + - + - + + 1 - + + 1 - + + + + - - + @@ -159,7 +144,7 @@ - Work centre line inh + Workcenter line inh mrp.production.workcenter.line diff --git a/mrp_operations_extension/views/mrp_routing_operation_view.xml b/mrp_operations_extension/views/mrp_routing_operation_view.xml index 792d90300cc..6a0f2633e1d 100644 --- a/mrp_operations_extension/views/mrp_routing_operation_view.xml +++ b/mrp_operations_extension/views/mrp_routing_operation_view.xml @@ -2,36 +2,34 @@ - rountig.operation.tree + routing.operation.tree mrp.routing.operation - - rountig.operation.form + routing.operation.form mrp.routing.operation
- - - - - - - - - - - - - - + + + + + + + + + + + + +
@@ -44,7 +42,9 @@ tree,form
- +
diff --git a/mrp_operations_extension/views/mrp_routing_workcenter_view.xml b/mrp_operations_extension/views/mrp_routing_view.xml similarity index 54% rename from mrp_operations_extension/views/mrp_routing_workcenter_view.xml rename to mrp_operations_extension/views/mrp_routing_view.xml index e58049b95c5..274a9312390 100644 --- a/mrp_operations_extension/views/mrp_routing_workcenter_view.xml +++ b/mrp_operations_extension/views/mrp_routing_view.xml @@ -10,8 +10,17 @@ + + Default workcenter + - float_time + Total + + + Total + + + @@ -22,38 +31,37 @@ - - - - - + + From fbdbde9806f1fb39f13ee98fc76cd5a6f128e45c Mon Sep 17 00:00:00 2001 From: avanzosc1 Date: Thu, 22 Jan 2015 16:50:49 +0100 Subject: [PATCH 16/45] [FIX+IMP] mrp_operations_extension FIX: correct actions view reference on produce button IMP: Changes in the calculation of number of cycles + hours IMP: Group analytic lines IMP: Remove product check FIX: Wizard when produced from work order IMP: Change product cost computation --- mrp_operations_extension/models/mrp_bom.py | 17 ++++++++++++++--- .../models/mrp_production.py | 2 ++ .../views/mrp_production_view.xml | 4 ++++ .../wizard/mrp_product_produce.py | 5 +++-- .../wizard/mrp_workorder_produce_view.xml | 3 ++- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/mrp_operations_extension/models/mrp_bom.py b/mrp_operations_extension/models/mrp_bom.py index 7d3ad683cf7..10e33f7eaa8 100644 --- a/mrp_operations_extension/models/mrp_bom.py +++ b/mrp_operations_extension/models/mrp_bom.py @@ -31,11 +31,13 @@ def _bom_explode(self, bom, product, factor, properties=None, level=0, bom, product, factor, properties=properties, level=level, routing_id=routing_id, previous_products=previous_products, master_bom=master_bom) - result2 = self._get_workorder_operations(result2, level=level, + result2 = self._get_workorder_operations(result2, factor=factor, + level=level, routing_id=routing_id) return result, result2 - def _get_workorder_operations(self, result2, level=0, routing_id=False): + def _get_workorder_operations(self, result2, factor, level=0, + routing_id=False): routing_line_obj = self.env['mrp.routing.workcenter'] for work_order in result2: seq = work_order['sequence'] - level @@ -50,9 +52,18 @@ def _get_workorder_operations(self, result2, level=0, routing_id=False): if name_val in work_order['name']: routing_line_id = routing_line.id break + wc = routing_line_obj.browse(routing_line_id) + cycle = factor / wc.cycle_nbr + if wc.limited_production_capacity and not cycle.is_integer(): + cycle = int(cycle) + 1 + hour = wc.hour_nbr * cycle + default_wc_line = wc.op_wc_lines.filtered(lambda r: r.default) + work_order['cycle'] = cycle + work_order['hour'] = hour + work_order['time_start'] = default_wc_line.time_start or 0.0 + work_order['time_stop'] = default_wc_line.time_stop or 0.0 if 'routing_wc_line' not in work_order: work_order['routing_wc_line'] = routing_line_id - wc = self.env['mrp.routing.workcenter'].browse(routing_line_id) work_order['do_production'] = wc.do_production return result2 diff --git a/mrp_operations_extension/models/mrp_production.py b/mrp_operations_extension/models/mrp_production.py index 77ecd59ef3b..8b01aeb1578 100644 --- a/mrp_operations_extension/models/mrp_production.py +++ b/mrp_operations_extension/models/mrp_production.py @@ -85,3 +85,5 @@ class MrpProductionWorkcenterLine(models.Model): routing_wc_line = fields.Many2one('mrp.routing.workcenter', string='Routing WC Line') do_production = fields.Boolean(string='Produce here') + time_start = fields.Float(string="Time Start") + time_stop = fields.Float(string="Time Stop") diff --git a/mrp_operations_extension/views/mrp_production_view.xml b/mrp_operations_extension/views/mrp_production_view.xml index 93edf1c9efd..2ea1314fa2a 100644 --- a/mrp_operations_extension/views/mrp_production_view.xml +++ b/mrp_operations_extension/views/mrp_production_view.xml @@ -47,6 +47,10 @@ + + + + 2 diff --git a/mrp_operations_extension/wizard/mrp_product_produce.py b/mrp_operations_extension/wizard/mrp_product_produce.py index 4a0db73194d..70f2662e10c 100644 --- a/mrp_operations_extension/wizard/mrp_product_produce.py +++ b/mrp_operations_extension/wizard/mrp_product_produce.py @@ -52,7 +52,8 @@ def do_produce(self, cr, uid, ids, context=None): assert production_id data = self.browse(cr, uid, ids[0], context=context) self.pool['mrp.production'].action_produce( - cr, uid, production_id, False, data.mode, data, context=context) + cr, uid, production_id, data.product_qty, + data.mode, data, context=context) return {} def do_consume(self, cr, uid, ids, context=None): @@ -72,7 +73,7 @@ def do_consume_produce(self, cr, uid, ids, context=None): assert production_id data = self.browse(cr, uid, ids[0], context=context) self.pool['mrp.production'].action_produce( - cr, uid, production_id, False, 'consume_produce', data, + cr, uid, production_id, data.product_qty, 'consume_produce', data, context=context) return {} diff --git a/mrp_operations_extension/wizard/mrp_workorder_produce_view.xml b/mrp_operations_extension/wizard/mrp_workorder_produce_view.xml index 67be6b8034c..d73c5bbb2f9 100644 --- a/mrp_operations_extension/wizard/mrp_workorder_produce_view.xml +++ b/mrp_operations_extension/wizard/mrp_workorder_produce_view.xml @@ -45,7 +45,7 @@ - MRP Work Order Produce + MRP Work Order Consume mrp.work.order.produce
@@ -89,6 +89,7 @@ form form new + From 129878e4c5babc1eb512b8d36f0e8ab444a1e00a Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Sun, 1 Feb 2015 17:24:23 +0100 Subject: [PATCH 17/45] [FIX+IMP] mrp_operations_extension: FIX: Use ceil instead is_integer check IMP: Don't allow inline editing of route operations on BoM --- mrp_operations_extension/models/mrp_bom.py | 5 ++--- mrp_operations_extension/views/mrp_bom_view.xml | 5 +++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mrp_operations_extension/models/mrp_bom.py b/mrp_operations_extension/models/mrp_bom.py index 10e33f7eaa8..0afbde0937e 100644 --- a/mrp_operations_extension/models/mrp_bom.py +++ b/mrp_operations_extension/models/mrp_bom.py @@ -17,6 +17,7 @@ ############################################################################## from openerp import models, fields, api, _ +import math class MrpBom(models.Model): @@ -53,9 +54,7 @@ def _get_workorder_operations(self, result2, factor, level=0, routing_line_id = routing_line.id break wc = routing_line_obj.browse(routing_line_id) - cycle = factor / wc.cycle_nbr - if wc.limited_production_capacity and not cycle.is_integer(): - cycle = int(cycle) + 1 + cycle = int(math.ceil(factor / wc.cycle_nbr)) hour = wc.hour_nbr * cycle default_wc_line = wc.op_wc_lines.filtered(lambda r: r.default) work_order['cycle'] = cycle diff --git a/mrp_operations_extension/views/mrp_bom_view.xml b/mrp_operations_extension/views/mrp_bom_view.xml index e4250fb973f..fa20e52a623 100644 --- a/mrp_operations_extension/views/mrp_bom_view.xml +++ b/mrp_operations_extension/views/mrp_bom_view.xml @@ -10,8 +10,9 @@ + widget="selection" + domain="[('routing_id', '=', parent.routing_id)]" + groups="mrp.group_mrp_routings" /> From fa92a220ff7de1fa75daf2fc3836725e6a51d852 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Wed, 11 Feb 2015 10:34:07 +0100 Subject: [PATCH 18/45] [FIX] Check for track_all --- mrp_operations_extension/wizard/mrp_product_produce.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mrp_operations_extension/wizard/mrp_product_produce.py b/mrp_operations_extension/wizard/mrp_product_produce.py index 70f2662e10c..2478c5e1c45 100644 --- a/mrp_operations_extension/wizard/mrp_product_produce.py +++ b/mrp_operations_extension/wizard/mrp_product_produce.py @@ -43,7 +43,7 @@ def _get_product_id(self): def _get_track(self): prod = self._get_product_id() - return prod and prod.track_production or False + return prod and (prod.track_all or prod.track_production) or False def do_produce(self, cr, uid, ids, context=None): work_line = self.pool['mrp.production.workcenter.line'].browse( From 1200c07ac5dba27413ea9fe23a9940cf334882fd Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Wed, 11 Feb 2015 10:39:34 +0100 Subject: [PATCH 19/45] [IMP] File name consistency with model name --- mrp_operations_extension/wizard/__init__.py | 2 +- .../{mrp_product_produce.py => mrp_work_order_produce.py} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename mrp_operations_extension/wizard/{mrp_product_produce.py => mrp_work_order_produce.py} (100%) diff --git a/mrp_operations_extension/wizard/__init__.py b/mrp_operations_extension/wizard/__init__.py index 0383abe4b91..67cb7bf1df2 100644 --- a/mrp_operations_extension/wizard/__init__.py +++ b/mrp_operations_extension/wizard/__init__.py @@ -16,4 +16,4 @@ # ############################################################################## -from . import mrp_product_produce +from . import mrp_work_order_produce diff --git a/mrp_operations_extension/wizard/mrp_product_produce.py b/mrp_operations_extension/wizard/mrp_work_order_produce.py similarity index 100% rename from mrp_operations_extension/wizard/mrp_product_produce.py rename to mrp_operations_extension/wizard/mrp_work_order_produce.py From cab1b1c47a32ad70382c6929bbaec6d2fcc5f58b Mon Sep 17 00:00:00 2001 From: Lionel Sausin Date: Wed, 11 Feb 2015 18:58:42 +0100 Subject: [PATCH 20/45] [FIX] call super before testing the workcenters We check that the production order's workcenter lines contain at least one "Produce here" line", but at this stage they are not created because we didn't call super(). So let's call super() first. --- mrp_operations_extension/models/mrp_production.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mrp_operations_extension/models/mrp_production.py b/mrp_operations_extension/models/mrp_production.py index 8b01aeb1578..1ffe02b2886 100644 --- a/mrp_operations_extension/models/mrp_production.py +++ b/mrp_operations_extension/models/mrp_production.py @@ -24,11 +24,12 @@ class MrpProduction(models.Model): @api.multi def action_confirm(self): + res = super(MrpProduction, self).action_confirm() if (self.routing_id and not any([x.do_production for x in self.workcenter_lines])): raise exceptions.Warning( _("At least one work order must have checked 'Produce here'")) - return super(MrpProduction, self).action_confirm() + return res @api.multi def _action_compute_lines(self, properties=None): From 5c6fcbe3556952558e6746904eaf9c42cfa22d1b Mon Sep 17 00:00:00 2001 From: oihane Date: Thu, 12 Feb 2015 15:38:18 +0100 Subject: [PATCH 21/45] [FIX] Translation fixed because of issue #660 --- mrp_operations_extension/i18n/es.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mrp_operations_extension/i18n/es.po b/mrp_operations_extension/i18n/es.po index bb03bf4d2a4..94da5874884 100644 --- a/mrp_operations_extension/i18n/es.po +++ b/mrp_operations_extension/i18n/es.po @@ -31,7 +31,7 @@ msgstr "Fecha real de producción" #: code:addons/mrp_operations_extension/models/mrp_production.py:29 #, python-format msgid "At least one work order must have checked 'Produce here'" -msgstr "Al menos una órden de trabajo debe tener marcada 'Producir aquí'" +msgstr "Al menos una orden de trabajo debe tener marcada 'Producir aquí'" #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_mrp_bom @@ -231,7 +231,7 @@ msgstr "Operación" #. module: mrp_operations_extension #: model:ir.ui.menu,name:mrp_operations_extension.mrp_routing_menu msgid "Operations" -msgstr "" +msgstr "Operaciones" #. module: mrp_operations_extension #: field:mrp.workcenter,op_avg_cost:0 @@ -273,7 +273,7 @@ msgstr "Posibles centros de trabajo" #. module: mrp_operations_extension #: field:mrp.workcenter,post_op_product:0 msgid "Post-operation costing product" -msgstr "" +msgstr "Producto de coste de post-operación" #. module: mrp_operations_extension #: field:mrp.workcenter,pre_op_product:0 @@ -401,7 +401,7 @@ msgstr "Tiempo para 1 ciclo (horas)" #. module: mrp_operations_extension #: help:mrp.operation.workcenter,time_cycle:0 msgid "Time in hours for doing one cycle." -msgstr "Time en horas para realizar un ciclo." +msgstr "Tiempo en horas para realizar un ciclo." #. module: mrp_operations_extension #: help:mrp.operation.workcenter,time_stop:0 @@ -439,7 +439,7 @@ msgstr "Uso del centro de trabajo" #: field:mrp.production.product.line,work_order:0 #: field:stock.move,work_order:0 msgid "Work Order" -msgstr "Órden de trabajo" +msgstr "Orden de trabajo" #. module: mrp_operations_extension #: field:mrp.routing.operation,workcenters:0 From 733e4ed6358adf96cbd6195c2920835684a4206c Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Fri, 13 Feb 2015 01:49:57 +0100 Subject: [PATCH 22/45] [FIX+IMP] mrp_operations_extension IMP: Show workcenter on route operation if there are no lines in workcenters. FIX: Fix workcenter_id invisible condition in routing --- mrp_operations_extension/models/mrp_bom.py | 19 +++++++------------ .../models/mrp_production.py | 10 +++++----- .../views/mrp_routing_view.xml | 2 +- 3 files changed, 13 insertions(+), 18 deletions(-) diff --git a/mrp_operations_extension/models/mrp_bom.py b/mrp_operations_extension/models/mrp_bom.py index 0afbde0937e..4504e9435e0 100644 --- a/mrp_operations_extension/models/mrp_bom.py +++ b/mrp_operations_extension/models/mrp_bom.py @@ -32,9 +32,8 @@ def _bom_explode(self, bom, product, factor, properties=None, level=0, bom, product, factor, properties=properties, level=level, routing_id=routing_id, previous_products=previous_products, master_bom=master_bom) - result2 = self._get_workorder_operations(result2, factor=factor, - level=level, - routing_id=routing_id) + result2 = self._get_workorder_operations( + result2, factor=factor, level=level, routing_id=routing_id) return result, result2 def _get_workorder_operations(self, result2, factor, level=0, @@ -44,15 +43,11 @@ def _get_workorder_operations(self, result2, factor, level=0, seq = work_order['sequence'] - level routing_lines = routing_line_obj.search([ ('routing_id', '=', routing_id), ('sequence', '=', seq)]) - routing_line_id = False - if len(routing_lines) == 1: - routing_line_id = routing_lines[0].id - elif len(routing_lines) > 1: - for routing_line in routing_lines: - name_val = '%s - ' % (routing_line.name) - if name_val in work_order['name']: - routing_line_id = routing_line.id - break + routing_line_id = routing_lines.id + for routing_line in routing_lines: + if routing_line.name in work_order['name']: + routing_line_id = routing_line.id + break wc = routing_line_obj.browse(routing_line_id) cycle = int(math.ceil(factor / wc.cycle_nbr)) hour = wc.hour_nbr * cycle diff --git a/mrp_operations_extension/models/mrp_production.py b/mrp_operations_extension/models/mrp_production.py index 1ffe02b2886..c7cabfde6c5 100644 --- a/mrp_operations_extension/models/mrp_production.py +++ b/mrp_operations_extension/models/mrp_production.py @@ -63,12 +63,12 @@ def _get_workorder_in_product_lines( @api.model def _make_production_consume_line(self, line): - res = super(MrpProduction, self)._make_production_consume_line(line) - if line.work_order and res: - st_move_obj = self.env['stock.move'] - move = st_move_obj.browse(res) + move_id = super(MrpProduction, + self)._make_production_consume_line(line) + if line.work_order and move_id: + move = self.env['stock.move'].browse(move_id) move.work_order = line.work_order.id - return res + return move_id class MrpProductionProductLine(models.Model): diff --git a/mrp_operations_extension/views/mrp_routing_view.xml b/mrp_operations_extension/views/mrp_routing_view.xml index 274a9312390..1adf3d69db0 100644 --- a/mrp_operations_extension/views/mrp_routing_view.xml +++ b/mrp_operations_extension/views/mrp_routing_view.xml @@ -34,7 +34,7 @@ - 1 + {'invisible': [('op_wc_lines', '!=', [])]} 1 From 3ffaa5146d643091a801c2b456219d53410148ba Mon Sep 17 00:00:00 2001 From: alfredo Date: Tue, 3 Mar 2015 15:04:49 +0100 Subject: [PATCH 23/45] [IMP] mrp_operations_extension: Has gotten mrp_operation_produce programming module. closses #644. --- mrp_operations_extension/README.rst | 3 + mrp_operations_extension/i18n/es.po | 97 ++++++++++++++++--- .../i18n/mrp_operations_extension.pot | 79 +++++++++++++-- .../models/mrp_production.py | 54 +++++++++++ .../models/mrp_routing.py | 10 ++ .../views/mrp_production_view.xml | 9 ++ .../views/mrp_routing_view.xml | 15 ++- 7 files changed, 244 insertions(+), 23 deletions(-) diff --git a/mrp_operations_extension/README.rst b/mrp_operations_extension/README.rst index 991538ecc88..2ef8f8b32d9 100644 --- a/mrp_operations_extension/README.rst +++ b/mrp_operations_extension/README.rst @@ -7,3 +7,6 @@ This module adds: - 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. + +Controls the availability of material in operations, and controls operation +start with respect to previous. diff --git a/mrp_operations_extension/i18n/es.po b/mrp_operations_extension/i18n/es.po index 94da5874884..24fa42bad75 100644 --- a/mrp_operations_extension/i18n/es.po +++ b/mrp_operations_extension/i18n/es.po @@ -6,13 +6,13 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-01-18 12:06+0000\n" -"PO-Revision-Date: 2015-01-18 12:06+0000\n" -"Last-Translator: <>\n" +"POT-Creation-Date: 2015-03-03 13:44+0000\n" +"PO-Revision-Date: 2015-03-03 14:53+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: \n" +"Content-Transfer-Encoding: 8bit\n" "Plural-Forms: \n" #. module: mrp_operations_extension @@ -28,7 +28,7 @@ msgid "Actual Production Date" msgstr "Fecha real de producción" #. module: mrp_operations_extension -#: code:addons/mrp_operations_extension/models/mrp_production.py:29 +#: code:addons/mrp_operations_extension/models/mrp_production.py:51 #, python-format msgid "At least one work order must have checked 'Produce here'" msgstr "Al menos una orden de trabajo debe tener marcada 'Producir aquí'" @@ -36,7 +36,7 @@ msgstr "Al menos una orden de trabajo debe tener marcada 'Producir aquí'" #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_mrp_bom msgid "Bill of Material" -msgstr "Lista de materiales" +msgstr "Lista de material" #. module: mrp_operations_extension #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard @@ -55,17 +55,23 @@ msgid "Capacity per cycle" msgstr "Capacidad por ciclo" #. module: mrp_operations_extension -#: code:addons/mrp_operations_extension/models/mrp_bom.py:67 +#: code:addons/mrp_operations_extension/models/mrp_bom.py:72 #, python-format msgid "Changing Routing" msgstr "Cambiando ruta" #. module: mrp_operations_extension -#: code:addons/mrp_operations_extension/models/mrp_bom.py:68 +#: code:addons/mrp_operations_extension/models/mrp_bom.py:73 #, python-format msgid "Changing routing will cause to change the operation in which each component will be consumed, by default it is set the first one of the routing" msgstr "Cambiar la ruta causará que cambie la operación en la que cada componente se consumirá. Por defecto se establece la primera de la ruta." +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_operation_buttons_form_view +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +msgid "Check Availability" +msgstr "Comprobar disponibilidad" + #. module: mrp_operations_extension #: field:mrp.routing.operation,code:0 msgid "Code" @@ -151,6 +157,12 @@ msgstr "Información extra" msgid "Final Product to Stock" msgstr "Producto final a existencias" +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_operation_buttons_form_view +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +msgid "Force Reservation" +msgstr "Forzar reservas" + #. module: mrp_operations_extension #: field:mrp.operation.workcenter,id:0 #: field:mrp.routing.operation,id:0 @@ -208,21 +220,49 @@ msgstr "Gestionar operadores en los centros de trabajo" msgid "Manufacturing Operators" msgstr "Operadores de fabricación" +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_production +msgid "Manufacturing Order" +msgstr "Órden de producción" + #. module: mrp_operations_extension #: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh msgid "Materials" msgstr "Materiales" +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_production.py:142 +#, python-format +msgid "Missing materials" +msgstr "Esperando materiales" + +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_production.py:143 +#, python-format +msgid "Missing materials to start the production" +msgstr "Esperando materiales para empezar la producción" + #. module: mrp_operations_extension #: field:mrp.work.order.produce,mode:0 msgid "Mode" msgstr "Modo" +#. module: mrp_operations_extension +#: field:mrp.production.workcenter.line,move_lines:0 +msgid "Moves" +msgstr "Moves" + #. module: mrp_operations_extension #: field:mrp.routing.operation,name:0 msgid "Name" msgstr "Nombre" +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_production.py:138 +#, python-format +msgid "Not finished operations" +msgstr "Operaciones no finalizadas" + #. module: mrp_operations_extension #: field:mrp.routing.workcenter,operation:0 msgid "Operation" @@ -280,6 +320,18 @@ msgstr "Producto de coste de post-operación" msgid "Pre-operation costing product" msgstr "Producto de coste de pre-operación" +#. module: mrp_operations_extension +#: field:mrp.routing,previous_operations_finished:0 +#: field:mrp.routing.workcenter,previous_operations_finished:0 +msgid "Previous operations finished" +msgstr "Operaciones previsas terminadas" + +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_production.py:139 +#, python-format +msgid "Previous operations not finished" +msgstr "Operaciones previas no terminadas" + #. module: mrp_operations_extension #: model:ir.actions.act_window,name:mrp_operations_extension.act_mrp_work_order_produce #: view:mrp.production:mrp_operations_extension.mrp_production_operation_buttons_form_view @@ -287,7 +339,7 @@ msgstr "Producto de coste de pre-operación" #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_produce_wizard msgid "Produce" -msgstr "Producir" +msgstr "Fabricar" #. module: mrp_operations_extension #: field:mrp.production.workcenter.line,do_production:0 @@ -310,7 +362,7 @@ msgstr "Líneas de producto" #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_mrp_product_produce_line msgid "Product Produce Consume lines" -msgstr "Líneas de consumo de productos producidos" +msgstr "Líneas de consumo de los producto producidos" #. module: mrp_operations_extension #: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh @@ -321,7 +373,7 @@ msgstr "Producto a producir" #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_mrp_production_product_line msgid "Production Scheduled Product" -msgstr "Producto planificado de producción" +msgstr "Fabricación planificada producto" #. module: mrp_operations_extension #: field:mrp.work.order.produce,consume_lines:0 @@ -336,7 +388,7 @@ msgstr "Pasos relevantes" #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_mrp_routing msgid "Routing" -msgstr "Ruta" +msgstr "Proceso productivo" #. module: mrp_operations_extension #: model:ir.actions.act_window,name:mrp_operations_extension.mrp_routing_operation_action @@ -372,7 +424,7 @@ msgid "Stock Move" msgstr "Movimiento de existencias" #. module: mrp_operations_extension -#: code:addons/mrp_operations_extension/models/mrp_routing.py:57 +#: code:addons/mrp_operations_extension/models/mrp_routing.py:67 #, python-format msgid "There must be one and only one line set as default." msgstr "Debe haber una y sólo una línea marcado como por defecto." @@ -383,6 +435,16 @@ msgstr "Debe haber una y sólo una línea marcado como por defecto." msgid "There must be one and only one operation with 'Produce here' check marked." msgstr "Debe haber una y sólo una operación con la casilla 'Producir aquí' marcada." +#. module: mrp_operations_extension +#: field:mrp.production.workcenter.line,time_start:0 +msgid "Time Start" +msgstr "Hora inicio" + +#. module: mrp_operations_extension +#: field:mrp.production.workcenter.line,time_stop:0 +msgid "Time Stop" +msgstr "Hora parada" + #. module: mrp_operations_extension #: field:mrp.operation.workcenter,time_stop:0 msgid "Time after prod." @@ -419,6 +481,11 @@ msgstr "Tiempo en horas para la preparación" msgid "To Consume" msgstr "A consumir" +#. module: mrp_operations_extension +#: view:mrp.routing.workcenter:mrp_operations_extension.mrp_routing_workcenter_tree_view_inh +msgid "Total" +msgstr "Total" + #. module: mrp_operations_extension #: field:mrp.work.order.produce,track_production:0 msgid "Track production" @@ -427,12 +494,12 @@ msgstr "Rastrear producción" #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_mrp_workcenter msgid "Work Center" -msgstr "Centro de trabajo" +msgstr "Centro de producción" #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_mrp_routing_workcenter msgid "Work Center Usage" -msgstr "Uso del centro de trabajo" +msgstr "Utilización del centro de producción" #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_mrp_production_workcenter_line diff --git a/mrp_operations_extension/i18n/mrp_operations_extension.pot b/mrp_operations_extension/i18n/mrp_operations_extension.pot index a4d8b72b78f..51ebb70451d 100644 --- a/mrp_operations_extension/i18n/mrp_operations_extension.pot +++ b/mrp_operations_extension/i18n/mrp_operations_extension.pot @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-01-18 12:06+0000\n" -"PO-Revision-Date: 2015-01-18 12:06+0000\n" +"POT-Creation-Date: 2015-03-03 13:44+0000\n" +"PO-Revision-Date: 2015-03-03 13:44+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -28,7 +28,7 @@ msgid "Actual Production Date" msgstr "" #. module: mrp_operations_extension -#: code:addons/mrp_operations_extension/models/mrp_production.py:29 +#: code:addons/mrp_operations_extension/models/mrp_production.py:51 #, python-format msgid "At least one work order must have checked 'Produce here'" msgstr "" @@ -55,17 +55,23 @@ msgid "Capacity per cycle" msgstr "" #. module: mrp_operations_extension -#: code:addons/mrp_operations_extension/models/mrp_bom.py:67 +#: code:addons/mrp_operations_extension/models/mrp_bom.py:72 #, python-format msgid "Changing Routing" msgstr "" #. module: mrp_operations_extension -#: code:addons/mrp_operations_extension/models/mrp_bom.py:68 +#: code:addons/mrp_operations_extension/models/mrp_bom.py:73 #, python-format msgid "Changing routing will cause to change the operation in which each component will be consumed, by default it is set the first one of the routing" msgstr "" +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_operation_buttons_form_view +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +msgid "Check Availability" +msgstr "" + #. module: mrp_operations_extension #: field:mrp.routing.operation,code:0 msgid "Code" @@ -151,6 +157,12 @@ msgstr "" msgid "Final Product to Stock" msgstr "" +#. module: mrp_operations_extension +#: view:mrp.production:mrp_operations_extension.mrp_production_operation_buttons_form_view +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +msgid "Force Reservation" +msgstr "" + #. module: mrp_operations_extension #: field:mrp.operation.workcenter,id:0 #: field:mrp.routing.operation,id:0 @@ -208,21 +220,49 @@ msgstr "" msgid "Manufacturing Operators" msgstr "" +#. module: mrp_operations_extension +#: model:ir.model,name:mrp_operations_extension.model_mrp_production +msgid "Manufacturing Order" +msgstr "" + #. module: mrp_operations_extension #: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh msgid "Materials" msgstr "" +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_production.py:142 +#, python-format +msgid "Missing materials" +msgstr "" + +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_production.py:143 +#, python-format +msgid "Missing materials to start the production" +msgstr "" + #. module: mrp_operations_extension #: field:mrp.work.order.produce,mode:0 msgid "Mode" msgstr "" +#. module: mrp_operations_extension +#: field:mrp.production.workcenter.line,move_lines:0 +msgid "Moves" +msgstr "" + #. module: mrp_operations_extension #: field:mrp.routing.operation,name:0 msgid "Name" msgstr "" +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_production.py:138 +#, python-format +msgid "Not finished operations" +msgstr "" + #. module: mrp_operations_extension #: field:mrp.routing.workcenter,operation:0 msgid "Operation" @@ -280,6 +320,18 @@ msgstr "" msgid "Pre-operation costing product" msgstr "" +#. module: mrp_operations_extension +#: field:mrp.routing,previous_operations_finished:0 +#: field:mrp.routing.workcenter,previous_operations_finished:0 +msgid "Previous operations finished" +msgstr "" + +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_production.py:139 +#, python-format +msgid "Previous operations not finished" +msgstr "" + #. module: mrp_operations_extension #: model:ir.actions.act_window,name:mrp_operations_extension.act_mrp_work_order_produce #: view:mrp.production:mrp_operations_extension.mrp_production_operation_buttons_form_view @@ -372,7 +424,7 @@ msgid "Stock Move" msgstr "" #. module: mrp_operations_extension -#: code:addons/mrp_operations_extension/models/mrp_routing.py:57 +#: code:addons/mrp_operations_extension/models/mrp_routing.py:67 #, python-format msgid "There must be one and only one line set as default." msgstr "" @@ -383,6 +435,16 @@ msgstr "" msgid "There must be one and only one operation with 'Produce here' check marked." msgstr "" +#. module: mrp_operations_extension +#: field:mrp.production.workcenter.line,time_start:0 +msgid "Time Start" +msgstr "" + +#. module: mrp_operations_extension +#: field:mrp.production.workcenter.line,time_stop:0 +msgid "Time Stop" +msgstr "" + #. module: mrp_operations_extension #: field:mrp.operation.workcenter,time_stop:0 msgid "Time after prod." @@ -419,6 +481,11 @@ msgstr "" msgid "To Consume" msgstr "" +#. module: mrp_operations_extension +#: view:mrp.routing.workcenter:mrp_operations_extension.mrp_routing_workcenter_tree_view_inh +msgid "Total" +msgstr "" + #. module: mrp_operations_extension #: field:mrp.work.order.produce,track_production:0 msgid "Track production" diff --git a/mrp_operations_extension/models/mrp_production.py b/mrp_operations_extension/models/mrp_production.py index c7cabfde6c5..f0e330e453c 100644 --- a/mrp_operations_extension/models/mrp_production.py +++ b/mrp_operations_extension/models/mrp_production.py @@ -22,6 +22,26 @@ class MrpProduction(models.Model): _inherit = 'mrp.production' + def _get_minor_sequence_operation(self, operations): + if operations and len(operations) > 1: + minor_operation = operations[0] + for operation in operations[1:]: + if minor_operation.sequence > operation: + minor_operation = operation + return minor_operation + else: + return operations and operations[0] + + @api.model + def _moves_assigned(self): + res = super(MrpProduction, self)._moves_assigned() + if res: + return True + operation = self._get_minor_sequence_operation(self.workcenter_lines) + assigned_moves, no_assigned_products = \ + self._get_operation_moves(operation, state='assigned') + return no_assigned_products == [] + @api.multi def action_confirm(self): res = super(MrpProduction, self).action_confirm() @@ -88,3 +108,37 @@ class MrpProductionWorkcenterLine(models.Model): do_production = fields.Boolean(string='Produce here') time_start = fields.Float(string="Time Start") time_stop = fields.Float(string="Time Stop") + move_lines = fields.One2many('stock.move', 'work_order', + string='Moves') + + @api.one + def action_assign(self): + self.move_lines.action_assign() + + @api.one + def force_assign(self): + self.move_lines.force_assign() + + def check_minor_sequence_operations(self): + seq = self.sequence + for operation in self.production_id.workcenter_lines: + if operation.sequence < seq and operation.state != 'done': + return False + return True + + def check_operation_moves_state(self, state): + for move_line in self.move_lines: + if move_line.state != state: + return False + return True + + def action_start_working(self): + if self.routing_wc_line.previous_operations_finished and \ + not self.check_minor_sequence_operations(): + raise exceptions.Warning(_("Not finished operations"), + _("Previous operations not finished")) + if not self.check_operation_moves_state('assigned'): + raise exceptions.Warning( + _("Missing materials"), + _("Missing materials to start the production")) + return super(MrpProductionWorkcenterLine, self).action_start_working() diff --git a/mrp_operations_extension/models/mrp_routing.py b/mrp_operations_extension/models/mrp_routing.py index 6bb226f7349..474ac7d02a0 100644 --- a/mrp_operations_extension/models/mrp_routing.py +++ b/mrp_operations_extension/models/mrp_routing.py @@ -33,10 +33,17 @@ def _check_produce_operation(self): raise Warning(_("There must be one and only one operation with " "'Produce here' check marked.")) + previous_operations_finished = fields.Boolean( + string='Previous operations finished') + class MrpRoutingWorkcenter(models.Model): _inherit = 'mrp.routing.workcenter' + def get_routing_previous_operations(self): + self.previous_operations_finished = \ + self.routing_id.previous_operations_finished + operation = fields.Many2one('mrp.routing.operation', string='Operation') op_wc_lines = fields.One2many( 'mrp.operation.workcenter', 'routing_workcenter', @@ -46,6 +53,9 @@ class MrpRoutingWorkcenter(models.Model): help="If enabled, the production and movement to stock of the final " "products will be done in this operation. There can be only one " "operation per route with this check marked.") + previous_operations_finished = fields.Boolean( + string='Previous operations finished', + default="get_routing_previous_operations") @api.constrains('op_wc_lines') def _check_default_op_wc_lines(self): diff --git a/mrp_operations_extension/views/mrp_production_view.xml b/mrp_operations_extension/views/mrp_production_view.xml index 2ea1314fa2a..2fe53b0b944 100644 --- a/mrp_operations_extension/views/mrp_production_view.xml +++ b/mrp_operations_extension/views/mrp_production_view.xml @@ -137,6 +137,10 @@ @@ -158,6 +154,9 @@ + + + - - + + + diff --git a/mrp_operations_extension/views/mrp_routing_view.xml b/mrp_operations_extension/views/mrp_routing_view.xml index 6229226d831..2b87918e337 100644 --- a/mrp_operations_extension/views/mrp_routing_view.xml +++ b/mrp_operations_extension/views/mrp_routing_view.xml @@ -1,6 +1,10 @@ + + {'readonly_by_pass': True} + + mrp.routing.form mrp.routing @@ -11,14 +15,12 @@ + mrp.routing.workcenter.tree.inh mrp.routing.workcenter - - - Default workcenter @@ -33,21 +35,23 @@ + mrp.routing.workcenter.form.inh mrp.routing.workcenter +

Select the operation to copy its current data to this routing line. WARNING: Once copied, if you change operation data, it won't be reflected here, unless you select it again.

- {'invisible': [('op_wc_lines', '!=', [])]} + 1 - + - + @@ -56,19 +60,39 @@ 1 + + +