mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[FIX+IMP] mrp_operations_extension
IMP: Deleting workers info and new module <mrp_workcenter_workers_operations> IMP: Adding fields in base modules, extension updates onchange IMP: Changes in views and field names REM: Deleted <mrp_workcenter_workers> module IMP: Configuration part added
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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'))
|
||||
|
||||
27
mrp_operations_extension/models/res_config.py
Normal file
27
mrp_operations_extension/models/res_config.py
Normal file
@@ -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='')
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data noupdate="0">
|
||||
<record id="group_mrp_workers" model="res.groups">
|
||||
<field name="name">Manufacturing Operators</field>
|
||||
<field name="category_id" ref="base.module_category_hidden" />
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -22,6 +22,8 @@
|
||||
<field name="time_cycle" widget="float_time"/>
|
||||
<field name="time_start" widget="float_time" />
|
||||
<field name="time_stop" widget="float_time"/>
|
||||
<field name="op_number" />
|
||||
<field name="op_avg_cost" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<field name="inherit_id" ref="mrp.mrp_routing_workcenter_tree_view" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="before">
|
||||
<field name="operation"/>
|
||||
<field name="operation" />
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
@@ -20,33 +20,36 @@
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="before">
|
||||
<field name="operation" />
|
||||
<newline/>
|
||||
<newline />
|
||||
</field>
|
||||
<field name="workcenter_id" position="after">
|
||||
<field name="op_wc_lines" colspan="4">
|
||||
<label for="op_wc_lines" colspan="4" />
|
||||
<field name="op_wc_lines" colspan="4" nolabel="1">
|
||||
<tree editable="bottom">
|
||||
<field name="workcenter"/>
|
||||
<field name="workcenter" />
|
||||
<field name="time_efficiency" />
|
||||
<field name="capacity_per_cycle" />
|
||||
<field name="time_start" widget="float_time" />
|
||||
<field name="time_stop" widget="float_time" />
|
||||
<field name="time_cycle" widget="float_time"/>
|
||||
<field name="op_number"/>
|
||||
<field name="default"/>
|
||||
<field name="time_cycle" widget="float_time" />
|
||||
<field name="op_number" />
|
||||
<field name="op_avg_cost" />
|
||||
<field name="default" />
|
||||
</tree>
|
||||
<form string="Workcenter Info Lines">
|
||||
<group>
|
||||
<field name="workcenter"/>
|
||||
<field name="workcenter" />
|
||||
<field name="time_efficiency" />
|
||||
<field name="capacity_per_cycle" />
|
||||
<field name="time_cycle" widget="float_time"/>
|
||||
<field name="time_cycle" widget="float_time" />
|
||||
<field name="time_start" widget="float_time" />
|
||||
<field name="time_stop" widget="float_time" />
|
||||
<field name="op_number"/>
|
||||
<field name="default"/>
|
||||
<field name="op_number" />
|
||||
<field name="op_avg_cost" />
|
||||
<field name="default" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</field>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -1,21 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="mrp_workcenter_form_view_inh" model="ir.ui.view">
|
||||
<field name="name">mrp.workcenter.tree.inh</field>
|
||||
<field name="name">mrp.workcenter.form.inh</field>
|
||||
<field name="model">mrp.workcenter</field>
|
||||
<field name="inherit_id" ref="mrp.mrp_workcenter_view" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="time_start" position="after">
|
||||
<field name="pre_op_product"/>
|
||||
<field name="pre_op_product" />
|
||||
</field>
|
||||
<field name="time_stop" position="after">
|
||||
<field name="post_op_product"/>
|
||||
<field name="post_op_product" />
|
||||
</field>
|
||||
<xpath expr="//page[@string='General Information']" position="after">
|
||||
<xpath expr="//page[@string='General Information']"
|
||||
position="after">
|
||||
<page string="Operators"
|
||||
groups="mrp_operations_extension.group_mrp_workers">
|
||||
<group colspan="4">
|
||||
<field name="op_number" />
|
||||
<field name="op_avg_cost" />
|
||||
</group>
|
||||
<field name="operators" />
|
||||
</page>
|
||||
<page string="Routing Operations">
|
||||
<field name="rt_operations" nolabel="1"/>
|
||||
<field name="rt_operations" nolabel="1" />
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
|
||||
19
mrp_operations_extension/views/res_config_view.xml
Normal file
19
mrp_operations_extension/views/res_config_view.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="mrp_settings_form_view">
|
||||
<field name="name">mrp.settings.form</field>
|
||||
<field name="model">mrp.config.settings</field>
|
||||
<field name="inherit_id" ref="mrp.view_mrp_config" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//label[@string='Planning']/../div" position="inside">
|
||||
<div>
|
||||
<field name="group_mrp_workers" class="oe_inline"/>
|
||||
<label for="group_mrp_workers"/>
|
||||
</div>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user