[IMP] project, rating: add rating field to task tree and search view

In this commit, we add the 'rating' field to the list view of 'project.task'.
Also, make the field optional and hidden by default.

rating_text field will be used to search tasks and tickets by rating text.

closes #78973
task-2667754

Related: odoo/upgrade#3031
Related: odoo/enterprise#21880
Signed-off-by: Laurent Stukkens (ltu) <ltu@odoo.com>
This commit is contained in:
Nidhi Patel
2021-12-16 08:10:08 +00:00
committed by Kamlesh Pathekar
parent 271c6223cb
commit 16f63fa55b
2 changed files with 6 additions and 0 deletions
+5
View File
@@ -23,6 +23,7 @@
<field name="stage_id"/>
<field name="partner_id" operator="child_of"/>
<field name="parent_id"/>
<field name="rating_last_text"/>
<filter string="My Tasks" name="my_tasks" domain="[('user_ids', 'in', uid)]"/>
<filter string="Unassigned" name="unassigned" domain="[('user_ids', '=', False)]"/>
<separator/>
@@ -1224,6 +1225,10 @@
<field name="activity_ids" widget="list_activity" optional="show"/>
<field name="date_deadline" optional="hide" widget="remaining_days" attrs="{'invisible': [('is_closed', '=', True)]}"/>
<field name="tag_ids" widget="many2many_tags" options="{'color_field': 'color'}" optional="show"/>
<field name="rating_last_text" string="Rating" decoration-danger="rating_last_text == 'ko'"
decoration-warning="rating_last_text == 'ok'" decoration-success="rating_last_text == 'top'"
attrs="{'invisible': [('rating_last_text', '=', 'none')]}"
class="font-weight-bold" widget="badge" optional="hide"/>
<field name="kanban_state" widget="state_selection" optional="show" options="{'hide_label': True}" nolabel="1"/>
<field name="stage_id" invisible="context.get('set_visible',False)" optional="show" readonly="not context.get('default_project_id')"/>
<field name="recurrence_id" invisible="1" />
+1
View File
@@ -61,6 +61,7 @@ class RatingMixin(models.AbstractModel):
rating_count = fields.Integer('Rating count', compute="_compute_rating_stats", compute_sudo=True)
rating_avg = fields.Float("Rating Average", compute='_compute_rating_stats', compute_sudo=True)
rating_percentage_satisfaction = fields.Float("Rating Satisfaction", compute='_compute_rating_satisfaction', compute_sudo=True)
rating_last_text = fields.Selection(string="Rating Text", groups='base.group_user', related="rating_ids.rating_text")
@api.depends('rating_ids.rating', 'rating_ids.consumed')
def _compute_rating_last_value(self):