[IMP] mrp, maintenance: back to basics

Modify tree view for MRP Production
Modify form view and tree view for Unbuild orders
Add group by for Bill of Materials
By default show line shart when opening MRP Production report
Modify view for Work Orders
Modify view for Work Centers
Modify view for Routings
Modify view for Maintenance Request
Modify view for Bill of Materials

task-2042304
closes - https://github.com/odoo/odoo/pull/35482
This commit is contained in:
Hetashree Chauhan
2019-08-14 12:13:27 +00:00
committed by svs-odoo
parent 699a4614ef
commit cdc8bf4bb1
13 changed files with 32 additions and 27 deletions
@@ -25,7 +25,8 @@
<field name="inherit_id" ref="maintenance.hr_equipment_request_view_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='owner_user_id']" position="replace">
<field name="employee_id" string="Created By"/>
<field name="employee_id" string="Created By"
options="{'no_create_edit': True, 'no_open': True}"/>
</xpath>
</field>
</record>
+1
View File
@@ -298,6 +298,7 @@ class MaintenanceRequest(models.Model):
schedule_date = fields.Datetime('Scheduled Date', help="Date the maintenance team plans the maintenance. It should not differ much from the Request Date. ")
maintenance_team_id = fields.Many2one('maintenance.team', string='Team', required=True, default=_get_default_team_id)
duration = fields.Float(help="Duration in hours.")
done = fields.Boolean(related='stage_id.done')
def archive_equipment_request(self):
self.write({'archive': True})
@@ -65,19 +65,19 @@
<field name="kanban_state" class="oe_inline" widget="state_selection"/>
</div>
<div class="oe_title">
<label for="name" class="oe_edit_only" string="Name"/>
<label for="name" class="oe_edit_only" string="Title"/>
<h1>
<field name="name" placeholder="Maintenance Request"/>
</h1>
</div>
<group>
<group>
<field name="owner_user_id" string="Requested By"/>
<field name="company_id" groups="base.group_multi_company" options="{'no_create': True}"/>
<field name="owner_user_id" string="Requested By" invisible="1"/>
<field name="equipment_id" context="{'default_category_id':category_id}"/>
<field name="category_id" groups="maintenance.group_equipment_manager" attrs="{'invisible': [('equipment_id', '=', False)]}"/>
<field name="request_date" readonly="True"/>
<field name="close_date" groups="base.group_no_one" readonly="True"/>
<field name="done" invisible="1"/>
<field name="close_date" attrs="{'invisible': [('done', '!=', True)]}" readonly="True"/>
<field name="archive" invisible="1"/>
<field name="maintenance_type" widget="radio"/>
</group>
+1 -2
View File
@@ -69,8 +69,7 @@ class MrpRoutingWorkcenter(models.Model):
workorder_count = fields.Integer("# Work Orders", compute="_compute_workorder_count")
batch = fields.Selection([
('no', 'Once all products are processed'),
('yes', 'Once a minimum number of products is processed')], string='Next Operation',
help="Set 'no' to schedule the next work order after the previous one. Set 'yes' to produce after the quantity set in 'Quantity To Process' has been produced.",
('yes', 'Once some products are processed')], string='Start Next Operation',
default='no', required=True)
batch_size = fields.Float('Quantity to Process', default=1.0)
workorder_ids = fields.One2many('mrp.workorder', 'operation_id', string="Work Orders")
+2
View File
@@ -80,6 +80,8 @@ class MrpUnbuild(models.Model):
if self.product_id:
self.bom_id = self.env['mrp.bom']._bom_find(product=self.product_id)
self.product_uom_id = self.product_id.uom_id.id
return {'domain': {'mo_id': [('state', '=', 'done'), ('product_id', '=', self.product_id.id)]}}
return {'domain': {'mo_id': [('state', '=', 'done')]}}
@api.constrains('product_qty')
def _check_qty(self):
+2 -2
View File
@@ -25,7 +25,7 @@ class MrpWorkcenter(models.Model):
help="Description of the Work Center.")
capacity = fields.Float(
'Capacity', default=1.0,
help="Number of pieces that can be produced in parallel.")
help="Number of pieces that can be produced in parallel. In case the work center has a capacity of 5 and you have to produce 10 units on your work order, the usual operation time will be multiplied by 2.")
sequence = fields.Integer(
'Sequence', default=1, required=True,
help="Gives the sequence order when displaying a list of work centers.")
@@ -53,7 +53,7 @@ class MrpWorkcenter(models.Model):
'Productive Time', compute='_compute_productive_time',
help='Productive hours over the last month', digits=(16, 2))
oee = fields.Float(compute='_compute_oee', help='Overall Equipment Effectiveness, based on the last month')
oee_target = fields.Float(string='OEE Target', help="OEE Target in percentage", default=90)
oee_target = fields.Float(string='OEE Target', help="Overall Effective Efficiency Target in percentage", default=90)
performance = fields.Integer('Performance', compute='_compute_performance', help='Performance over the last month')
workcenter_load = fields.Float('Work Center Load', compute='_compute_workorder_count')
alternative_workcenter_ids = fields.Many2many(
+1 -1
View File
@@ -36,7 +36,7 @@ var SetBulletStatus = AbstractField.extend({
this._super.apply(this, arguments);
var bullet_class = this.classes[this.value] || 'default';
if (this.value) {
var title = this.value === 'waiting' ? _t('Waiting Materials') : _t('Ready to produce');
var title = this.value === 'waiting' ? _t('Waiting Materials') : '';
this.$el.attr({'title': title, 'style': 'display:inline'});
this.$el.removeClass('text-success text-danger text-default');
this.$el.html($('<span>' + title + '</span>').addClass('badge badge-' + bullet_class));
+7 -6
View File
@@ -16,7 +16,7 @@
<sheet>
<div class="oe_button_box" name="button_box">
<button name="%(action_report_mrp_bom)d" type="action"
class="oe_stat_button" icon="fa-bars" string="Structure &amp; Cost" attrs="{'invisible': [('bom_line_ids', '=', [])]}"/>
class="oe_stat_button" icon="fa-bars" string="Structure &amp; Cost"/>
</div>
<widget name="web_ribbon" text="Archived" bg_color="bg-danger" attrs="{'invisible': [('active', '=', True)]}"/>
<group>
@@ -110,16 +110,16 @@
<field name="name">mrp.bom.tree</field>
<field name="model">mrp.bom</field>
<field name="arch" type="xml">
<tree string="Bill of Materials" default_order="product_tmpl_id">
<tree string="Bill of Materials">
<field name="active" invisible="1"/>
<field name="sequence" invisible="1"/>
<field name="sequence" widget="handle"/>
<field name="product_tmpl_id"/>
<field name="code" optional="show"/>
<field name="product_id" groups="product.group_product_variant" optional="show"/>
<field name="type"/>
<field name="company_id" groups="base.group_multi_company" optional="show"/>
<field name="product_qty" optional="show"/>
<field name="product_uom_id" groups="uom.group_uom" optional="show" string="Unit of Measure"/>
<field name="type" optional="hide"/>
<field name="company_id" groups="base.group_multi_company" optional="show"/>
<field name="routing_id" groups="mrp.group_mrp_routings" optional="show"/>
</tree>
</field>
@@ -164,7 +164,7 @@
<filter string="Normal" name="normal" domain="[('type', '=', 'normal')]"/>
<group expand="0" string="Group By...">
<filter string="Product" name="product" domain="[]" context="{'group_by':'product_tmpl_id'}"/>
<filter string='Default Unit of Measure' name="default_unit_of_measure" domain="[]" context="{'group_by' : 'product_uom_id'}"/>
<filter string='BoM Type' name="group_by_type" domain="[]" context="{'group_by' : 'type'}"/>
<filter string="Routings" name="routings" domain="[]" context="{'group_by':'routing_id'}"/>
</group>
</search>
@@ -177,6 +177,7 @@
<field name="domain">[]</field> <!-- force empty -->
<field name="view_mode">tree,kanban,form</field>
<field name="search_view_id" ref="view_mrp_bom_filter"/>
<field name="context">{'search_default_group_by_type': True}</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a bill of materials
+6 -4
View File
@@ -11,14 +11,14 @@
<field name="name"/>
<field name="date_planned_start" optional="show"/>
<field name="product_id" optional="show"/>
<field name="product_qty" sum="Total Qty" string="Quantity" optional="show"/>
<field name="product_uom_id" string="Unit of Measure" options="{'no_open':True,'no_create':True}" groups="uom.group_uom" optional="show"/>
<field name="bom_id" optional="hide"/>
<field name="origin" optional="show"/>
<field name="user_id" optional="hide"/>
<field name="routing_id" groups="mrp.group_mrp_routings" optional="show"/>
<field name="state" optional="show"/>
<field name="reservation_state" optional="show"/>
<field name="product_qty" sum="Total Qty" string="Quantity" optional="show"/>
<field name="state" optional="show"/>
<field name="company_id" groups="base.group_multi_company" optional="show"/>
<field name="activity_exception_decoration" widget="activity_exception"/>
</tree>
@@ -309,7 +309,7 @@
<field name="name">mrp.production.graph</field>
<field name="model">mrp.production</field>
<field name="arch" type="xml">
<graph string="Manufacturing Orders">
<graph string="Manufacturing Orders" type="line">
<field name="date_deadline"/>
</graph>
</field>
@@ -373,7 +373,9 @@
<field name="domain">[('picking_type_id.active', '=', True)]</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create a new manufacturing order
Create a new manufacturing order <br/>
</p><p>
Produce finished products and consume components based on bill of materials.
</p>
</field>
</record>
+2 -4
View File
@@ -10,8 +10,7 @@
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="workcenter_id"/>
<field name="time_cycle" widget="float_time"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
<field name="time_cycle" widget="float_time" string="Duration (minutes)" sum="Total Duration"/>
</tree>
</field>
</record>
@@ -25,7 +24,6 @@
<group name="description">
<field name="name"/>
<field name="workcenter_id"/>
<field name="company_id" options="{'no_create': True}" groups="base.group_multi_company"/>
<field name="sequence" groups="base.group_no_one"/>
</group><group name="workorder">
<field name="workorder_count" invisible="1"/>
@@ -43,7 +41,7 @@
<field name="time_cycle" invisible="1"/>
</group>
<group>
<field name="batch"/>
<field name="batch" widget="radio"/>
<field name="batch_size" attrs="{'invisible': [('batch', '=', 'no')]}"/>
</group>
</group>
+2 -1
View File
@@ -125,7 +125,7 @@
</div>
</group>
<group>
<field name="mo_id" domain="[('state','=','done')]"/>
<field name="mo_id"/>
<field name="location_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations" domain="[('usage','=','internal')]"/>
<field name="location_dest_id" options="{'no_create': True}" groups="stock.group_stock_multi_locations" domain="[('usage','=','internal')]"/>
<field name="has_tracking" invisible="1"/>
@@ -150,6 +150,7 @@
<field name="name"/>
<field name="product_id"/>
<field name="bom_id"/>
<field name="mo_id"/>
<field name="lot_id" groups="stock.group_production_lot"/>
<field name="product_qty"/>
<field name="product_uom_id" groups="uom.group_uom"/>
+1 -1
View File
@@ -52,7 +52,7 @@
<tree editable="bottom" decoration-success="product_uom_qty==qty_done" decoration-danger="(product_uom_qty &gt; 0) and (qty_done&gt;product_uom_qty)">
<field name="lot_id" attrs="{'column_invisible': [('parent.has_tracking', '=', 'none')]}" domain="[('product_id', '=', parent.product_id)]" context="{'default_product_id': parent.product_id}"/>
<field name="lot_produced_ids" widget="many2many_tags" options="{'no_open': True, 'no_create': True}" domain="[('id', 'in', parent.order_finished_lot_ids)]" invisible="not context.get('final_lots')"/>
<field name="product_uom_qty" string="Reserved" readonly="1"/>
<field name="product_uom_qty" string="Reserved" readonly="1" optional="show"/>
<field name="qty_done"/>
<field name="workorder_id" invisible="1"/>
<field name="product_id" invisible="1"/>
@@ -33,7 +33,7 @@
<field name="product_tracking" invisible="1"/>
<field name="lot_id" attrs="{'readonly': [('product_tracking', '=', 'none')]}" context="{'default_product_id': product_id, 'active_mo_id': parent.production_id}" domain="[('product_id', '=', product_id)]" groups="stock.group_production_lot"/>
<field name="qty_to_consume" readonly="1" force_save="1"/>
<field name="qty_reserved" readonly="1" force_save="1"/>
<field name="qty_reserved" readonly="1" force_save="1" optional="show"/>
<field name="qty_done"/>
<field name="product_uom_id" readonly="1" force_save="1" groups="uom.group_uom"/>
<field name="move_id" invisible="1"/>