[IMP] sale_project: hide SOL field

Before this commit SOL field on task visible when user no
sale access and field is set but SOL field is readonly when
user has no sale access there is not point showing readonly
empty field.

This commit hide SOL field when user has no sale access and
field is not set.

task-3186438

closes odoo/odoo#115474

Related: odoo/enterprise#38186
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
Kartik Chavda
2023-06-15 17:35:34 +02:00
parent 41ba2c136a
commit 6175c09724
2 changed files with 3 additions and 3 deletions
@@ -78,7 +78,7 @@
<button class="oe_stat_button"
type="object" name="action_view_so" icon="fa-dollar"
attrs="{'invisible': [('sale_order_id', '=', False)]}"
groups="sales_team.group_sale_salesman_all_leads">
groups="sales_team.group_sale_salesman">
<div class="o_stat_info">
<span class="o_stat_text">Sales Order</span>
</div>
@@ -90,7 +90,7 @@
</xpath>
<xpath expr="//field[@name='partner_id']" 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}" attrs="{'invisible': ['|', ('allow_billable', '=', False), ('project_root_id', '=', False)]}"/>
<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}" attrs="{'invisible': ['|', '|', ('allow_billable', '=', False), ('project_root_id', '=', False), ('sale_line_id', '=', 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}" placeholder="Non-billable" attrs="{'invisible': ['|', ('allow_billable', '=', False), ('project_root_id', '=', False)]}"/>
<field name="allow_billable" invisible="1"/>
</xpath>
@@ -106,7 +106,7 @@
<template id="portal_my_task_inherit" inherit_id="project.portal_my_task">
<xpath expr="//div[@name='portal_my_task_second_column']" position="inside">
<t t-if="task.project_id.allow_billable">
<t t-if="task.project_id.allow_billable and env.user.has_group('sales_team.group_sale_salesman')">
<div t-if="task.sale_order_id"><strong>Sales Order:</strong>
<span t-if="so_accessible"><a t-attf-href="{{ task.sale_order_id.access_url }}" t-field="task.sale_order_id"></a></span>
<span t-else="" t-field="task.sale_order_id"></span>