From 3c6fd5cf4105f2bc80032e2673205f72e720bd51 Mon Sep 17 00:00:00 2001 From: "Pedro M. Baeza" Date: Sun, 15 Nov 2015 13:58:11 +0100 Subject: [PATCH] [IMP] mrp_operations_extension: Fine tuning of UI + computations * Guided selection of operation inside routing lines for avoiding confusions. * Homogenization of work centers selection in routing lines. You always add a workcenter line. * Limit selectable workcenters on the work order according routing line. * Views cleaning. --- mrp_operations_extension/__init__.py | 14 + mrp_operations_extension/__openerp__.py | 2 +- mrp_operations_extension/i18n/es.po | 117 ++-- .../i18n/mrp_operations_extension.pot | 536 ------------------ .../migrations/8.0.2.0.0/post-migration.py | 9 + mrp_operations_extension/models/mrp_bom.py | 24 +- .../models/mrp_production.py | 69 +-- .../models/mrp_routing.py | 27 +- .../tests/test_mrp_operations_extension.py | 14 +- .../views/mrp_production_view.xml | 63 +- .../views/mrp_routing_view.xml | 54 +- 11 files changed, 233 insertions(+), 696 deletions(-) delete mode 100644 mrp_operations_extension/i18n/mrp_operations_extension.pot create mode 100644 mrp_operations_extension/migrations/8.0.2.0.0/post-migration.py diff --git a/mrp_operations_extension/__init__.py b/mrp_operations_extension/__init__.py index 3082d9efd..c06d7820b 100644 --- a/mrp_operations_extension/__init__.py +++ b/mrp_operations_extension/__init__.py @@ -4,6 +4,19 @@ ############################################################################## from . import models from . import wizard +from openerp import api, SUPERUSER_ID + + +def create_default_routing_workcenter_line(cr): + with api.Environment.manage(): + env = api.Environment(cr, SUPERUSER_ID, {}) + routing_wcs = env['mrp.routing.workcenter'].search( + [('op_wc_lines', '=', False)]) + for routing_wc in routing_wcs: + routing_wc.op_wc_lines = [ + (0, 0, {'workcenter': routing_wc.workcenter_id, + 'default': True, + 'custom_data': False})] def post_init_hook(cr, pool): @@ -17,3 +30,4 @@ def post_init_hook(cr, pool): ORDER BY sequence DESC, id DESC LIMIT 1) FROM mrp_routing mr); """) + create_default_routing_workcenter_line(cr) diff --git a/mrp_operations_extension/__openerp__.py b/mrp_operations_extension/__openerp__.py index 79d7f3b09..43e01edf2 100644 --- a/mrp_operations_extension/__openerp__.py +++ b/mrp_operations_extension/__openerp__.py @@ -19,7 +19,7 @@ { "name": "MRP Operations Extension", - "version": "8.0.1.1.0", + "version": "8.0.2.0.0", "category": "Manufacturing", "author": "OdooMRP team, " "AvanzOSC, " diff --git a/mrp_operations_extension/i18n/es.po b/mrp_operations_extension/i18n/es.po index 0f5c89e3f..387e42007 100644 --- a/mrp_operations_extension/i18n/es.po +++ b/mrp_operations_extension/i18n/es.po @@ -1,22 +1,19 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * mrp_operations_extension -# -# Translators: -# Oihane Crucelaegui , 2015 +# * mrp_operations_extension +# msgid "" msgstr "" -"Project-Id-Version: odoomrp-wip (8.0)\n" +"Project-Id-Version: Odoo Server 8.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2015-10-07 10:43+0000\n" -"PO-Revision-Date: 2015-10-09 10:50+0000\n" -"Last-Translator: Pedro M. Baeza \n" -"Language-Team: Spanish (http://www.transifex.com/oca/odoomrp-wip-8-0/language/es/)\n" +"POT-Creation-Date: 2015-11-15 13:40+0000\n" +"PO-Revision-Date: 2015-11-15 13:40+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" -"Language: es\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Plural-Forms: \n" #. module: mrp_operations_extension #: field:mrp.workcenter,op_number:0 @@ -29,6 +26,16 @@ msgstr "Nº operadores" msgid "# operators" msgstr "Nº operadores" +#. module: mrp_operations_extension +#: model:res.users,signature:mrp_operations_extension.user_opeext_1 +msgid "

--Mr User Opeext 1

" +msgstr "

--Operador 1

" + +#. module: mrp_operations_extension +#: model:res.users,signature:mrp_operations_extension.user_opeext_2 +msgid "

--Mr User Opeext 2

" +msgstr "

--Operador 2

" + #. 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 @@ -36,7 +43,7 @@ msgid "Actual Production Date" msgstr "Fecha real de producción" #. module: mrp_operations_extension -#: code:addons/mrp_operations_extension/models/mrp_production.py:36 +#: code:addons/mrp_operations_extension/models/mrp_production.py:35 #, 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í'" @@ -44,7 +51,12 @@ 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 +#: field:mrp.production.product.line,bom_line:0 +msgid "Bom line" +msgstr "Línea de LdM" #. module: mrp_operations_extension #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard @@ -63,17 +75,15 @@ msgid "Capacity per cycle" msgstr "Capacidad por ciclo" #. module: mrp_operations_extension -#: code:addons/mrp_operations_extension/models/mrp_bom.py:71 +#: code:addons/mrp_operations_extension/models/mrp_bom.py:49 #, python-format msgid "Changing Routing" msgstr "Cambiando ruta" #. module: mrp_operations_extension -#: code:addons/mrp_operations_extension/models/mrp_bom.py:72 +#: code:addons/mrp_operations_extension/models/mrp_bom.py:50 #, 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" +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 @@ -131,6 +141,11 @@ msgstr "Creado por" msgid "Created on" msgstr "Creado en" +#. module: mrp_operations_extension +#: field:mrp.operation.workcenter,custom_data:0 +msgid "Custom" +msgstr "Personalizado" + #. module: mrp_operations_extension #: field:mrp.operation.workcenter,default:0 msgid "Default" @@ -171,22 +186,25 @@ msgstr "Producto final a existencias" #: 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 reserva" +msgstr "Forzar reservas" #. module: mrp_operations_extension -#: field:mrp.operation.workcenter,id:0 field:mrp.routing.operation,id:0 +#: 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 #: 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." +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 +#: help:mrp.operation.workcenter,custom_data:0 +msgid "If you mark this check, this means that the work center in this routing has different capacity data than the defined on the work center itself" +msgstr "Si marca esta casilla, significará que el centro de trabajo en esta ruta tiene unos datos de capacidad diferentes a los definidos en el centro de trabajo en si" + #. 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 @@ -235,7 +253,7 @@ msgstr "Operadores de fabricación" #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_mrp_production msgid "Manufacturing Order" -msgstr "Orden de producción" +msgstr "Órden de producción" #. module: mrp_operations_extension #: view:mrp.production:mrp_operations_extension.mrp_production_form_view_inh @@ -243,7 +261,7 @@ msgid "Materials" msgstr "Materiales" #. module: mrp_operations_extension -#: code:addons/mrp_operations_extension/models/mrp_production.py:170 +#: code:addons/mrp_operations_extension/models/mrp_production.py:158 #, python-format msgid "Missing materials to start the production" msgstr "Faltan materiales para empezar la producción" @@ -263,6 +281,11 @@ msgstr "Movimientos" msgid "Name" msgstr "Nombre" +#. module: mrp_operations_extension +#: view:mrp.routing.workcenter:mrp_operations_extension.mrp_routing_workcenter_form_view_inh +msgid "Once copied, if you change operation data, it won't be reflected here, unless you select it again." +msgstr "Una vez copiados, si cambia los datos de la operación, no se reflejarán aquí, a no ser que vuelva a seleccionarla otra vez." + #. module: mrp_operations_extension #: field:mrp.routing.workcenter,operation:0 msgid "Operation" @@ -307,11 +330,6 @@ msgstr "Fecha planificada" 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 costing product" @@ -329,7 +347,7 @@ msgid "Previous operations finished" msgstr "Operaciones previas terminadas" #. module: mrp_operations_extension -#: code:addons/mrp_operations_extension/models/mrp_production.py:166 +#: code:addons/mrp_operations_extension/models/mrp_production.py:154 #, python-format msgid "Previous operations not finished" msgstr "Operaciones previas no terminadas" @@ -364,7 +382,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 los 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 @@ -375,7 +393,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 @@ -390,7 +408,7 @@ msgstr "Pasos relevantes" #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_mrp_routing msgid "Routing" -msgstr "Proceso productivo" +msgstr "Ruta de producción" #. module: mrp_operations_extension #: model:ir.actions.act_window,name:mrp_operations_extension.mrp_routing_operation_action @@ -420,13 +438,23 @@ msgstr "Centro de trabajo de la ruta" msgid "Select Quantity" msgstr "Seleccione cantidad" +#. module: mrp_operations_extension +#: view:mrp.routing.workcenter:mrp_operations_extension.mrp_routing_workcenter_form_view_inh +msgid "Select the operation to copy its current data to this routing line." +msgstr "Seleccione la operación para copiar sus datos actuales a esta línea de ruta." + #. 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.py:55 +#: view:mrp.production.workcenter.line:mrp_operations_extension.workcenter_line_inh_form_view +msgid "Stock Moves" +msgstr "Movimientos de existencias" + +#. module: mrp_operations_extension +#: code:addons/mrp_operations_extension/models/mrp_routing.py:56 #, 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." @@ -434,8 +462,7 @@ 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:19 #, python-format -msgid "" -"There must be one and only one operation with 'Produce here' check marked." +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 @@ -494,6 +521,11 @@ msgstr "Total" msgid "Track production" msgstr "Rastrear producción" +#. module: mrp_operations_extension +#: view:mrp.routing.workcenter:mrp_operations_extension.mrp_routing_workcenter_form_view_inh +msgid "WARNING:" +msgstr "AVISO:" + #. module: mrp_operations_extension #: model:ir.model,name:mrp_operations_extension.model_mrp_workcenter msgid "Work Center" @@ -514,6 +546,7 @@ msgstr "Orden de trabajo" #. module: mrp_operations_extension #: field:mrp.routing.operation,workcenters:0 +#: view:mrp.routing.workcenter:mrp_operations_extension.mrp_routing_workcenter_form_view_inh msgid "Work centers" msgstr "Centros de trabajo" @@ -535,12 +568,12 @@ msgstr "Centros de trabajo" #. module: mrp_operations_extension #: view:mrp.production:mrp_operations_extension.mrp_production_operation_buttons_form_view msgid "draft,startworking" -msgstr "" +msgstr "draft,startworking" #. module: mrp_operations_extension #: view:mrp.production:mrp_operations_extension.mrp_production_operation_buttons_form_view msgid "oe_highlight" -msgstr "" +msgstr "oe_highlight" #. module: mrp_operations_extension #: view:mrp.work.order.produce:mrp_operations_extension.view_mrp_product_consume_wizard @@ -548,7 +581,3 @@ msgstr "" msgid "or" msgstr "o" -#. module: mrp_operations_extension -#: view:mrp.routing.workcenter:mrp_operations_extension.mrp_routing_workcenter_form_view_inh -msgid "{'invisible': [('op_wc_lines', '!=', [])]}" -msgstr "" diff --git a/mrp_operations_extension/i18n/mrp_operations_extension.pot b/mrp_operations_extension/i18n/mrp_operations_extension.pot deleted file mode 100644 index 71d76d0b7..000000000 --- a/mrp_operations_extension/i18n/mrp_operations_extension.pot +++ /dev/null @@ -1,536 +0,0 @@ -# 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-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" -"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:51 -#, python-format -msgid "At least one work order must have checked 'Produce here'" -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 -#: 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: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" -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_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 "" - -#. 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 in" -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 -#: 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" -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 -#: 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 -#: field:mrp.work.order.produce,id:0 -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 -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 -#: 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" -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.workcenter,op_avg_cost:0 -msgid "Operator average hour cost" -msgstr "" - -#. module: mrp_operations_extension -#: field:mrp.operation.workcenter,op_avg_cost:0 -msgid "Operator avg. hour 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.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 costing product" -msgstr "" - -#. module: mrp_operations_extension -#: field:mrp.workcenter,pre_op_product:0 -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 -#: 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 -#: field:mrp.production.workcenter.line,do_production:0 -#: field:mrp.routing.workcenter,do_production:0 -msgid "Produce here" -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.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 -#: 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.py:67 -#, 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 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." -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 (hours)" -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 -#: 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" -msgstr "" - -#. module: mrp_operations_extension -#: model:ir.model,name:mrp_operations_extension.model_mrp_workcenter -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 -#: field:mrp.operation.workcenter,workcenter:0 -msgid "Workcenter" -msgstr "" - -#. module: mrp_operations_extension -#: view:mrp.routing.operation:mrp_operations_extension.rountig_operation_form -msgid "Workcenters" -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/migrations/8.0.2.0.0/post-migration.py b/mrp_operations_extension/migrations/8.0.2.0.0/post-migration.py new file mode 100644 index 000000000..a4558ac16 --- /dev/null +++ b/mrp_operations_extension/migrations/8.0.2.0.0/post-migration.py @@ -0,0 +1,9 @@ +# -*- 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.addons.mrp_operations_extension import ( + create_default_routing_workcenter_line) + + +def migrate(cr, version): + create_default_routing_workcenter_line(cr) diff --git a/mrp_operations_extension/models/mrp_bom.py b/mrp_operations_extension/models/mrp_bom.py index 173f845c6..d680123ff 100644 --- a/mrp_operations_extension/models/mrp_bom.py +++ b/mrp_operations_extension/models/mrp_bom.py @@ -13,27 +13,37 @@ class MrpBom(models.Model): def _prepare_wc_line(self, wc_use, level=0, factor=1): res = super(MrpBom, self)._prepare_wc_line( wc_use, level=level, factor=factor) - cycle = ( - wc_use.cycle_nbr and int(math.ceil(factor / wc_use.cycle_nbr)) or - 0) + cycle = int(math.ceil(factor / (wc_use.cycle_nbr or 1))) hour = wc_use.hour_nbr * cycle default_wc_line = wc_use.op_wc_lines.filtered(lambda r: r.default) + if default_wc_line.custom_data: + time_start = default_wc_line.time_start + time_stop = default_wc_line.time_stop + else: + time_start = default_wc_line.workcenter.time_start + time_stop = default_wc_line.workcenter.time_stop res.update({ 'cycle': cycle, 'hour': hour, - 'time_start': default_wc_line.time_start or 0.0, - 'time_stop': default_wc_line.time_stop or 0.0, + 'time_start': time_start, + 'time_stop': time_stop, 'routing_wc_line': wc_use.id, 'do_production': wc_use.do_production, }) return res + @api.model + def _prepare_consume_line(self, bom_line, quantity, factor=1): + res = super(MrpBom, self)._prepare_consume_line( + bom_line, quantity, factor=factor) + res['bom_line'] = bom_line.id + return res + @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]) + line.operation = self.routing_id.workcenter_lines[:1] if self.routing_id: return {'warning': { 'title': _('Changing Routing'), diff --git a/mrp_operations_extension/models/mrp_production.py b/mrp_operations_extension/models/mrp_production.py index ecbd20cba..d95ea3f38 100644 --- a/mrp_operations_extension/models/mrp_production.py +++ b/mrp_operations_extension/models/mrp_production.py @@ -3,7 +3,6 @@ # For copyright and license notices, see __openerp__.py file in root directory ############################################################################## from openerp import models, fields, api, exceptions, _ -import math class MrpProduction(models.Model): @@ -40,38 +39,13 @@ class MrpProduction(models.Model): 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) + # Assign work orders to each consume line + for product_line in self.product_lines: + product_line.work_order = self.workcenter_lines.filtered( + lambda x: (x.routing_wc_line == + product_line.bom_line.operation)) return res - def _get_workorder_in_product_lines( - self, workcenter_lines, product_lines, properties=None): - for workorder in workcenter_lines: - wc = workorder.routing_wc_line - cycle = wc.cycle_nbr and int(math.ceil(self.product_qty / - wc.cycle_nbr)) or 0 - workorder.cycle = cycle - workorder.hour = wc.hour_nbr * cycle - 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: - 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 - 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 - @api.model def _make_production_consume_line(self, line): move_id = super(MrpProduction, @@ -85,8 +59,9 @@ class MrpProduction(models.Model): class MrpProductionProductLine(models.Model): _inherit = 'mrp.production.product.line' - work_order = fields.Many2one('mrp.production.workcenter.line', - 'Work Order') + bom_line = fields.Many2one(comodel_name="mrp.bom.line") + work_order = fields.Many2one( + comodel_name='mrp.production.workcenter.line', string='Work Order') class MrpProductionWorkcenterLine(models.Model): @@ -102,17 +77,29 @@ class MrpProductionWorkcenterLine(models.Model): x not in ('assigned', 'cancel', 'done') for x in moves.mapped('state')) - 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') + @api.multi + @api.depends('routing_wc_line') + def _compute_possible_workcenters(self): + for line in self: + line.possible_workcenters = line.mapped( + 'routing_wc_line.op_wc_lines.workcenter') + + product_line = fields.One2many( + comodel_name='mrp.production.product.line', inverse_name='work_order', + string='Product Lines') + routing_wc_line = fields.Many2one( + comodel_name='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") - move_lines = fields.One2many('stock.move', 'work_order', - string='Moves') - is_material_ready = fields.Boolean('Materials Ready', - compute="_ready_materials") + move_lines = fields.One2many( + comodel_name='stock.move', inverse_name='work_order', string='Moves') + is_material_ready = fields.Boolean( + string='Materials Ready', compute="_ready_materials") + possible_workcenters = fields.Many2many( + comodel_name="mrp.workcenter", compute="_compute_possible_workcenters") + workcenter_id = fields.Many2one( + domain="[('id', 'in', possible_workcenters[0][2])]") @api.one def action_assign(self): diff --git a/mrp_operations_extension/models/mrp_routing.py b/mrp_operations_extension/models/mrp_routing.py index da28007ae..0b5ea28ff 100644 --- a/mrp_operations_extension/models/mrp_routing.py +++ b/mrp_operations_extension/models/mrp_routing.py @@ -26,9 +26,10 @@ class MrpRouting(models.Model): class MrpRoutingWorkcenter(models.Model): _inherit = 'mrp.routing.workcenter' - def get_routing_previous_operations(self): - self.previous_operations_finished = \ - self.routing_id.previous_operations_finished + def default_previous_operations_finished(self): + if self.routing_id: + self.previous_operations_finished = \ + self.routing_id.previous_operations_finished operation = fields.Many2one('mrp.routing.operation', string='Operation') op_wc_lines = fields.One2many( @@ -41,7 +42,7 @@ class MrpRoutingWorkcenter(models.Model): "operation per route with this check marked.") previous_operations_finished = fields.Boolean( string='Previous operations finished', - default="get_routing_previous_operations") + default=default_previous_operations_finished) picking_type_id = fields.Many2one('stock.picking.type', 'Picking Type', domain=[('code', '=', 'outgoing')]) @@ -60,6 +61,8 @@ class MrpRoutingWorkcenter(models.Model): if self.operation: self.name = self.operation.name self.note = self.operation.description + self.picking_type_id = self.operation.picking_type_id + self.op_wc_lines = False op_wc_lst = [] is_default = True for operation_wc in self.operation.workcenters: @@ -76,6 +79,7 @@ class MrpRoutingWorkcenter(models.Model): op_wc_lst.append(data) is_default = False self.op_wc_lines = op_wc_lst + self.operation = False @api.one @api.onchange('op_wc_lines') @@ -83,8 +87,12 @@ class MrpRoutingWorkcenter(models.Model): 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 + if line.custom_data: + self.cycle_nbr = line.capacity_per_cycle + self.hour_nbr = line.time_cycle + else: + self.cycle_nbr = line.workcenter.capacity_per_cycle + self.hour_nbr = line.workcenter.time_cycle break @@ -92,6 +100,11 @@ class MrpOperationWorkcenter(models.Model): _name = 'mrp.operation.workcenter' _description = 'MRP Operation Workcenter' + custom_data = fields.Boolean( + string="Custom", default=False, + help="If you mark this check, this means that the work center in this " + "routing has different capacity data than the defined on the " + "work center itself") workcenter = fields.Many2one( 'mrp.workcenter', string='Workcenter', required=True) routing_workcenter = fields.Many2one( @@ -111,7 +124,7 @@ class MrpOperationWorkcenter(models.Model): default = fields.Boolean('Default') @api.one - @api.onchange('workcenter') + @api.onchange('workcenter', 'custom_data') def onchange_workcenter(self): if self.workcenter: self.capacity_per_cycle = self.workcenter.capacity_per_cycle diff --git a/mrp_operations_extension/tests/test_mrp_operations_extension.py b/mrp_operations_extension/tests/test_mrp_operations_extension.py index 4c7c46abc..2e2096ad1 100644 --- a/mrp_operations_extension/tests/test_mrp_operations_extension.py +++ b/mrp_operations_extension/tests/test_mrp_operations_extension.py @@ -3,7 +3,7 @@ # For copyright and license notices, see __openerp__.py file in root directory ############################################################################## import openerp.tests.common as common -from openerp import workflow, exceptions +from openerp import workflow class TestMrpOperationsExtension(common.TransactionCase): @@ -16,7 +16,6 @@ class TestMrpOperationsExtension(common.TransactionCase): self.production = self.production_model.browse( self.env.ref('mrp_operations_extension.mrp_production_opeext').id) self.production_case1 = self.production.copy() - self.production_case2 = self.production.copy() def test_confirm_production_operation_extension_case1(self): workflow.trg_validate( @@ -51,14 +50,3 @@ class TestMrpOperationsExtension(common.TransactionCase): self.assertEqual( line.state, 'done', 'Error work center line not in done state') - - def test_confirm_production_operation_extension_case2(self): - workflow.trg_validate( - self.uid, 'mrp.production', self.production_case2.id, - 'button_confirm', self.cr) - self.production_case2.force_production() - with self.assertRaises(exceptions.Warning): - workflow.trg_validate( - self.uid, 'mrp.production.workcenter.line', - self.production_case2.workcenter_lines[1].id, - 'button_start_working', self.cr) diff --git a/mrp_operations_extension/views/mrp_production_view.xml b/mrp_operations_extension/views/mrp_production_view.xml index 4650f8260..011b30852 100644 --- a/mrp_operations_extension/views/mrp_production_view.xml +++ b/mrp_operations_extension/views/mrp_production_view.xml @@ -55,25 +55,19 @@ 2 + - - 1 - - - 1 - + + - - - @@ -105,49 +99,51 @@ - - mrp.production.operation.buttons.form - + + mrp.production.operation.buttons.form mrp.production - + draft,startworking @@ -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 6229226d8..2b87918e3 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 + + +