[IMP] project,(hr,sale)_timesheet: generic improvements for project app

Purpose of the commit is to do the generic improvements for project.

So in this commit did the following changes:
- add a space between 'access to:' and the name of the course in SOL nameget.
- hide the 'remaining hours' value if the nb of 'initially planned hours' is
  equal to 0 in task list view.
- hide the 'initially planned hours' and 'hours spent' values if they are equal
  to 0 in task list view.
- hide the 'milestone' and 'assignees' fields if they are false task calendar
  popover
- hide the 'remaining hours on SO' value if there is no SOL set on the task
  list view
- use the progressbar widget for the progress field update list view

task-2949984

closes odoo/odoo#112265

Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
Rohitkumar (roku)
2023-03-29 23:36:44 +02:00
committed by Prakash Prajapati
parent 1b2ef3005c
commit 587f250858
6 changed files with 22 additions and 11 deletions
@@ -157,11 +157,12 @@
<field name="date_deadline" position="before">
<field name="allow_subtasks" invisible="1"/>
<field name="progress" invisible="1"/>
<field name="planned_hours" widget="timesheet_uom_no_toggle" sum="Initially Planned Hours" optional="hide"/>
<field name="effective_hours" widget="timesheet_uom" sum="Effective Hours" optional="show"/>
<field name="effective_hours" invisible="1"/>
<field name="planned_hours" widget="timesheet_uom_no_toggle" sum="Initially Planned Hours" attrs="{'invisible' : [('planned_hours', '=', 0)]}" optional="hide"/>
<field name="effective_hours" widget="timesheet_uom" sum="Effective Hours" optional="show" attrs="{'invisible' : [('effective_hours', '=', 0)]}"/>
<field name="subtask_effective_hours" widget="timesheet_uom" attrs="{'invisible' : [('allow_subtasks', '=', False)]}" optional="hide"/>
<field name="total_hours_spent" widget="timesheet_uom" attrs="{'invisible' : [('allow_subtasks', '=', False)]}" optional="hide"/>
<field name="remaining_hours" widget="timesheet_uom" sum="Remaining Hours" optional="hide" decoration-danger="progress &gt;= 100" decoration-warning="progress &gt;= 80 and progress &lt; 100"/>
<field name="remaining_hours" widget="timesheet_uom" sum="Remaining Hours" optional="hide" decoration-danger="progress &gt;= 100" decoration-warning="progress &gt;= 80 and progress &lt; 100" attrs="{'invisible' : [('planned_hours', '=', 0)]}"/>
<field name="progress" widget="progressbar" optional="show" groups="hr_timesheet.group_hr_timesheet_user" attrs="{'invisible' : [('planned_hours', '=', 0)]}"/>
</field>
</field>
+2 -2
View File
@@ -690,8 +690,8 @@
scales="month,year">
<field name="allow_milestones" invisible="1" />
<field name="project_id" widget="project_private_task"/>
<field name="milestone_id" attrs="{'invisible': [('allow_milestones', '=', False)]}"/>
<field name="user_ids" widget="many2many_avatar_user"/>
<field name="milestone_id" attrs="{'invisible': ['|', ('allow_milestones', '=', False), ('milestone_id', '=', False)]}"/>
<field name="user_ids" widget="many2many_avatar_user" attrs="{'invisible': [('user_ids', '=', [])]}"/>
<field name="partner_id" attrs="{'invisible': [('partner_id', '=', False)]}"/>
<field name="priority" widget="priority"/>
<field name="date_deadline"/>
@@ -108,7 +108,7 @@
<field name="name"/>
<field name="user_id" widget="many2one_avatar_user" class="fw-bold" optional="show"/>
<field name="date" optional="show"/>
<field name="progress_percentage" string="Progress" widget="percentage" optional="show"/>
<field name="progress" string="Progress" widget="progressbar" optional="show"/>
<field name="color" invisible="1"/>
<field name="status" widget="status_with_color"/>
</tree>
@@ -18,7 +18,9 @@
optional="hide"/>
</xpath>
<xpath expr="//field[@name='child_ids']/tree/field[@name='remaining_hours']" position="after">
<field name="remaining_hours_so" optional="hide" widget="timesheet_uom"/>
<field name="sale_line_id" invisible="1"/>
<field name="remaining_hours_available" invisible="1"/>
<field name="remaining_hours_so" optional="hide" widget="timesheet_uom" attrs="{'invisible': ['|', ('sale_line_id', '=', False), ('remaining_hours_available', '=', False)]}"/>
</xpath>
<xpath expr="//field[@name='remaining_hours']" position="after">
<field name="allow_billable" invisible="1" />
@@ -88,10 +88,16 @@
<field name="inherit_id" ref="hr_timesheet.view_task_form2_inherited"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='child_ids']/tree//field[@name='remaining_hours']" position="after">
<field name="remaining_hours_so" widget="timesheet_uom" optional="hide" groups="base.group_user"/>
<field name="sale_line_id" invisible="1"/>
<field name="remaining_hours_available" invisible="1"/>
<field name="remaining_hours_so" widget="timesheet_uom" optional="hide" groups="base.group_user"
attrs="{'invisible': ['|', ('sale_line_id', '=', False), ('remaining_hours_available', '=', False)]}"/>
</xpath>
<xpath expr="//field[@name='depend_on_ids']/tree//field[@name='remaining_hours']" position="after">
<field name="remaining_hours_so" widget="timesheet_uom" optional="hide" groups="base.group_user"/>
<field name="sale_line_id" invisible="1"/>
<field name="remaining_hours_available" invisible="1"/>
<field name="remaining_hours_so" widget="timesheet_uom" optional="hide" groups="base.group_user"
attrs="{'invisible': ['|', ('sale_line_id', '=', False), ('remaining_hours_available', '=', False)]}"/>
</xpath>
</field>
@@ -103,7 +109,9 @@
<field name="inherit_id" ref="hr_timesheet.view_task_tree2_inherited" />
<field name="arch" type="xml">
<xpath expr="//field[@name='remaining_hours']" position="after">
<field name="remaining_hours_so" widget="timesheet_uom" optional="hide"/>
<field name="sale_line_id" invisible="1"/>
<field name="remaining_hours_available" invisible="1"/>
<field name="remaining_hours_so" attrs="{'invisible': ['|', ('sale_line_id', '=', False), ('remaining_hours_available', '=', False)]}" widget="timesheet_uom" optional="hide"/>
</xpath>
</field>
</record>
@@ -16,4 +16,4 @@ class Product(models.Model):
return super(Product, self).get_product_multiline_description_sale()
new_line = '' if len(payment_channels) == 1 else '\n'
return _('Access to:%s%s', new_line, '\n'.join(payment_channels.mapped('name')))
return _('Access to: %s%s', new_line, '\n'.join(payment_channels.mapped('name')))