From 67ad4632a1910198b42c212799a2b8cce54148f1 Mon Sep 17 00:00:00 2001 From: Prakash Prajapati <ppr@odoo.com> Date: Wed, 5 Jun 2019 10:31:22 +0000 Subject: [PATCH] [IMP] mrp: set optional field to simplify the tree view Purpose of the commit is to set the new attribute OPTIONAL = SHOW/Hide on tree view so the user can easily hide/show the optional fields on the tree view. Update string date_start_wo field from mrp.production model. task-1997453 Closes: #33888 --- addons/mrp/models/mrp_production.py | 2 +- addons/mrp/views/mrp_bom_views.xml | 13 +++++++------ addons/mrp/views/mrp_production_views.xml | 21 ++++++++++++--------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/addons/mrp/models/mrp_production.py b/addons/mrp/models/mrp_production.py index 5131ad30b2d8..930ce953948d 100644 --- a/addons/mrp/models/mrp_production.py +++ b/addons/mrp/models/mrp_production.py @@ -106,7 +106,7 @@ class MrpProduction(models.Model): date_start = fields.Datetime('Start Date', copy=False, index=True, readonly=True) date_finished = fields.Datetime('End Date', copy=False, index=True, readonly=True) date_start_wo = fields.Datetime( - 'Planning Start Date', copy=False, readonly=True, + 'Planned Start Date', copy=False, readonly=True, states={'draft': [('readonly', False)], 'confirmed': [('readonly', False)]}, help="The work orders will be planned based on the availability of the work centers starting from " "this date. If emtpy, the work orders are planned as soon as possible.") diff --git a/addons/mrp/views/mrp_bom_views.xml b/addons/mrp/views/mrp_bom_views.xml index ef1d696ab5ca..6a66e7f82e69 100644 --- a/addons/mrp/views/mrp_bom_views.xml +++ b/addons/mrp/views/mrp_bom_views.xml @@ -114,12 +114,13 @@ <field name="active" invisible="1"/> <field name="sequence" invisible="1"/> <field name="product_tmpl_id"/> - <field name="code"/> - <field name="product_id" groups="product.group_product_variant"/> - <field name="product_qty"/> - <field name="product_uom_id" groups="uom.group_uom"/> - <field name="routing_id" groups="mrp.group_mrp_routings"/> - <field name="company_id" groups="base.group_multi_company"/> + <field name="code" optional="show"/> + <field name="product_id" groups="product.group_product_variant" 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> </record> diff --git a/addons/mrp/views/mrp_production_views.xml b/addons/mrp/views/mrp_production_views.xml index 507aa9ab1e16..2324f76389da 100644 --- a/addons/mrp/views/mrp_production_views.xml +++ b/addons/mrp/views/mrp_production_views.xml @@ -9,15 +9,18 @@ <tree decoration-bf="message_needaction==True" default_order="date_planned_start desc" decoration-info="state=='confirmed'" decoration-danger="date_planned_start<current_date and state not in ('done','cancel')" decoration-muted="state in ('done','cancel')" string="Manufacturing Orders"> <field name="message_needaction" invisible="1"/> <field name="name"/> - <field name="date_planned_start"/> - <field name="product_id"/> - <field name="origin"/> - <field name="product_qty" sum="Total Qty" string="Quantity"/> - <field name="product_uom_id" string="Unit of Measure" options="{'no_open':True,'no_create':True}" groups="uom.group_uom"/> - <field name="routing_id" groups="mrp.group_mrp_routings"/> - <field name="state"/> - <field name="reservation_state"/> - <field name="company_id" groups="base.group_multi_company"/> + <field name="date_start_wo" optional="hide"/> + <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="company_id" groups="base.group_multi_company" optional="show"/> </tree> </field> </record> -- GitLab