diff --git a/mrp_operations_extension/README.rst b/mrp_operations_extension/README.rst index b12ce8d5c..991538ecc 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 d34f3a86c..322dbe168 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 f8074ae68..52a72a636 100644 --- a/mrp_operations_extension/models/__init__.py +++ b/mrp_operations_extension/models/__init__.py @@ -22,3 +22,4 @@ from . import mrp_bom 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 5106eebf7..d44196eb8 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 @@ class MrpOperationWorkcenter(models.Model): 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 b1eddc7bf..31ea54a60 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 000000000..b3dc8aa16 --- /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 000000000..63df8f15e --- /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 6e75f880b..648e9145d 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 ccfb50c6e..84bae1ba5 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 2100aa0b4..45ad64174 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 000000000..1a557458e --- /dev/null +++ b/mrp_operations_extension/views/res_config_view.xml @@ -0,0 +1,19 @@ + + + + + mrp.settings.form + mrp.config.settings + + + +
+ +
+
+
+
+ +
+