[IMP] project: simplify filters for rating
Since rating in on project directly, and task and issue are merged, we can simplify some domain and replaced them by default filters. The search domain will be less complex and the performance will be better.
This commit is contained in:
@@ -409,7 +409,7 @@ class Project(models.Model):
|
||||
action['name'] = _('Ratings of %s') % (self.name,)
|
||||
action_context = safe_eval(action['context']) if action['context'] else {}
|
||||
action_context.update(self._context)
|
||||
action_context['search_default_rating_tasks'] = 1
|
||||
action_context['search_default_parent_res_name'] = self.name
|
||||
return dict(action, context=action_context)
|
||||
|
||||
# ---------------------------------------------------
|
||||
|
||||
@@ -124,9 +124,6 @@
|
||||
<field name="active" widget="boolean_button"
|
||||
options='{"terminology": "archive"}'/>
|
||||
</button>
|
||||
<button name="%(project.rating_rating_action_view_project_rating_task)d" attrs="{'invisible': ['|', '|', ('rating_status', '=', 'no'), ('use_tasks','=', False), ('percentage_satisfaction_task', '=', -1)]}" class="oe_stat_button oe_percent" type="action" icon="fa-smile-o" groups="project.group_project_rating">
|
||||
<field string="% On tasks" name="percentage_satisfaction_task" widget="statinfo"/>
|
||||
</button>
|
||||
</div>
|
||||
<div class="oe_title">
|
||||
<h1>
|
||||
@@ -320,7 +317,7 @@
|
||||
<div t-if="record.alias_name.value and record.alias_domain.value">
|
||||
<span><i class="fa fa-envelope"></i> <t t-esc="record.alias_id.value"/></span>
|
||||
</div>
|
||||
<div t-if="record.rating_status.raw_value != 'no'" class="mt8 text-primary" title="Percentage of happy ratings over the past 30 days. Get rating details from the More menu.">
|
||||
<div t-if="record.rating_status.raw_value != 'no'" class="mt8 text-primary" title="Percentage of happy ratings over the past 30 days. Get rating details from the More menu." groups="project.group_project_rating">
|
||||
<b>
|
||||
<t t-if="record.percentage_satisfaction_project.value == -1">
|
||||
<i class="fa fa-smile-o"/> No rating yet
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<field name="name">Rating</field>
|
||||
<field name="res_model">rating.rating</field>
|
||||
<field name="view_mode">kanban,tree,graph,pivot,form</field>
|
||||
<field name="domain">[('consumed','=',True), ('parent_res_model','=','project.project'), ('parent_res_id','=',active_id)]</field>
|
||||
<field name="domain">[('consumed','=',True), ('parent_res_model','=','project.project')]</field>
|
||||
<field name="search_view_id" ref="rating_rating_view_search_project"/>
|
||||
<field name="help" type="html">
|
||||
<p>
|
||||
@@ -31,19 +31,6 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="rating_rating_action_view_project_rating_task" model="ir.actions.act_window">
|
||||
<field name="name">Ratings for tasks</field>
|
||||
<field name="res_model">rating.rating</field>
|
||||
<field name="view_mode">kanban,tree,graph,pivot,form</field>
|
||||
<field name="domain">[('consumed','=',True), ('parent_res_model','=','project.project'), ('parent_res_id','=',active_id), ('res_model','=','project.task')]</field>
|
||||
<field name="search_view_id" ref="rating_rating_view_search_project"/>
|
||||
<field name="help" type="html">
|
||||
<p>
|
||||
There is no rating for tasks of this project at the moment.
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="rating_rating_action_task" model="ir.actions.act_window">
|
||||
<field name="name">Customer Ratings</field>
|
||||
<field name="res_model">rating.rating</field>
|
||||
|
||||
@@ -134,9 +134,9 @@
|
||||
<field name="rated_partner_id"/>
|
||||
<field name="rating"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="res_name"/>
|
||||
<field name="res_name" filter_domain="[('res_name','ilike',self)]"/>
|
||||
<field name="res_id"/>
|
||||
<field name="parent_res_name"/>
|
||||
<field name="parent_res_name" filter_domain="[('parent_res_name','ilike',self)]"/>
|
||||
<filter string="Satisfied" name="rating_happy" domain="[('rating_text', '=', 'satisfied')]"/>
|
||||
<filter string="Not satisfied" name="rating_okay" domain="[('rating_text', '=', 'not_satisfied')]"/>
|
||||
<filter string="Highly dissatisfied" name="rating_unhappy" domain="[('rating_text', '=', 'highly_dissatisfied')]"/>
|
||||
|
||||
Reference in New Issue
Block a user