From 8f793707c51a08d62f0f988c757fe7a42ed935c7 Mon Sep 17 00:00:00 2001 From: Kartik Chavda <kcv@odoo.com> Date: Fri, 14 Oct 2022 09:58:21 +0000 Subject: [PATCH] [FIX] sale_{project,timesheet}: hide SOL field when task is not billable This commit hide SOL field for project task form view and hide it's value from tree view when task is not billable and give correct xpath on SOL field attributes to display remaining hour and price unit in name_search. task-3018123 Part-of: odoo/odoo#103183 --- addons/sale_project/views/project_task_views.xml | 2 +- addons/sale_timesheet/views/project_task_views.xml | 8 +++----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/addons/sale_project/views/project_task_views.xml b/addons/sale_project/views/project_task_views.xml index b85b5c41178d..25cd61c1a7f7 100644 --- a/addons/sale_project/views/project_task_views.xml +++ b/addons/sale_project/views/project_task_views.xml @@ -79,7 +79,7 @@ <xpath expr="//field[@name='partner_phone']" position="after"> <field name="sale_order_id" attrs="{'invisible': True}" groups="sales_team.group_sale_salesman"/> <field name="sale_line_id" groups="!sales_team.group_sale_salesman" string="Sales Order Item" options='{"no_open": True}' readonly="1" context="{'create': False, 'edit': False, 'delete': False}"/> - <field name="sale_line_id" groups="sales_team.group_sale_salesman" string="Sales Order Item" options='{"no_create": True}' readonly="0" context="{'create': False, 'edit': False, 'delete': False}"/> + <field name="sale_line_id" groups="sales_team.group_sale_salesman" string="Sales Order Item" options='{"no_create": True}' readonly="0" context="{'create': False, 'edit': False, 'delete': False, 'with_price_unit': True}"/> <field name="commercial_partner_id" invisible="1" /> </xpath> </field> diff --git a/addons/sale_timesheet/views/project_task_views.xml b/addons/sale_timesheet/views/project_task_views.xml index 2830d97593fd..483606e6b4e1 100644 --- a/addons/sale_timesheet/views/project_task_views.xml +++ b/addons/sale_timesheet/views/project_task_views.xml @@ -188,15 +188,13 @@ <field name="model">project.task</field> <field name="inherit_id" ref="sale_project.view_sale_project_inherit_form"/> <field name="arch" type="xml"> - <xpath expr="//field[@name='sale_line_id']" position="attributes"> - <attribute name="context">{'with_remaining_hours': True, 'with_price_unit': True}</attribute> + <xpath expr="//field[@name='sale_line_id'][2]" position="attributes"> + <attribute name="context">{'create': False, 'edit': False, 'delete': False, 'with_price_unit': True, 'with_remaining_hours': True}</attribute> + <!-- To do: move allow_billable field in sale_project and add attrs directly on field in master --> <attribute name="attrs"> {'invisible': [('allow_billable', '=', False)]} </attribute> </xpath> - <xpath expr="//field[@name='sale_order_id']" position="attributes"> - <attribute name="invisible">1</attribute> - </xpath> </field> </record> </odoo> -- GitLab