Files
odoo_source/addons/project/views/rating_views.xml
T
Mitali Patel 8ccba2ce15 [IMP] project, hr_timesheet: improve customer rating on project
Purpose of the commit is to improve the customer rating report
of the project app.

So in this commit, done the below changes:

- remove the project and task measures
- switch the rating value and the count from place in pivot view
- remove the default group by rated operator, keep it fot grap view
- reorder the some fields on form and list view
- use the badge widget for the rating field and the color code is applied to the form view
- add some demo data for the feedback field in list view
- center the information vertically in kanban view
- move the 'customer ratings' menu item below the 'project costs and revenues' one
- add the following filters: My Projects, My Team
  - reorder the group bys and rename 'Resource' into 'Task'
  - reorder the search fields
- project kanban card
  - the ratings % is represent the average satisfaction rate of the ratings submitted in the last 30 days (including today)
  - change the tooltip to: Average satisfaction rate for the last 30 days
- the 'customer satisfaction' stat button display the last 30 days rating on the project.project
and this stat button should open the kanban view by default instead of the list view

task-2531428
closes #73581
2021-11-15 17:29:37 +00:00

282 lines
13 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="rating_rating_view_tree_project" model="ir.ui.view">
<field name="name">rating.rating.tree.project</field>
<field name="model">rating.rating</field>
<field name="inherit_id" ref="rating.rating_rating_view_tree"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<field name="res_name" position="attributes">
<attribute name="string">Task</attribute>
</field>
<field name="parent_res_name" position="attributes">
<attribute name="string">Project</attribute>
</field>
<field name="rated_partner_id" position="attributes">
<attribute name="string">Assigned to</attribute>
</field>
</field>
</record>
<record id="rating_rating_view_form_project" model="ir.ui.view">
<field name="name">rating.rating.form.project</field>
<field name="model">rating.rating</field>
<field name="inherit_id" ref="rating.rating_rating_view_form"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//form" position="attributes">
<attribute name="edit">0</attribute>
</xpath>
<field name="resource_ref" position="before">
<field name="rated_partner_id" position="move"/>
<field name="parent_ref" position="move"/>
</field>
<field name="res_name" position="attributes">
<attribute name="string">Task</attribute>
</field>
<field name="resource_ref" position="attributes">
<attribute name="string">Task</attribute>
</field>
<field name="parent_ref" position="attributes">
<attribute name="string">Project</attribute>
</field>
<field name="parent_res_name" position="attributes">
<attribute name="string">Project</attribute>
</field>
<field name="rated_partner_id" position="attributes">
<attribute name="string">Assigned to</attribute>
</field>
<field name="create_date" position="attributes">
<attribute name="readonly">1</attribute>
</field>
<field name="feedback" position="attributes">
<attribute name="readonly">1</attribute>
</field>
<div name="rating_image_container" position="replace">
<field name="rating_text" string="Rating" decoration-danger="rating_text == 'ko'" decoration-warning="rating_text == 'ok'" decoration-success="rating_text == 'top'" widget='badge'/>
</div>
<field name="create_date" position="after">
<field name="partner_id" position="move"/>
</field>
<xpath expr="//field[@name='is_internal']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</field>
</record>
<record id="rating_rating_view_pivot" model="ir.ui.view">
<field name="name">rating.rating.view.pivot.project</field>
<field name="model">rating.rating</field>
<field name="inherit_id" ref="rating.rating_rating_view_pivot"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//pivot" position="attributes">
<attribute name="js_class">project_rating_pivot</attribute>
</xpath>
<xpath expr="//field[@name='create_date']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</field>
</record>
<record id="rating_rating_view_graph" model="ir.ui.view">
<field name="name">rating.rating.view.graph.project</field>
<field name="model">rating.rating</field>
<field name="inherit_id" ref="rating.rating_rating_view_graph"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//graph" position="attributes">
<attribute name="js_class">project_rating_graph</attribute>
</xpath>
</field>
</record>
<record id="rating_rating_view_search_project" model="ir.ui.view">
<field name="name">rating.rating.search.project</field>
<field name="model">rating.rating</field>
<field name="inherit_id" ref="rating.rating_rating_view_search"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<xpath expr="//field[@name='rated_partner_id']" position="after">
<field name="parent_res_name" position="move"/>
<field name="res_name" position="move"/>
</xpath>
<xpath expr="//field[@name='parent_res_name']" position="attributes">
<attribute name="string">Project</attribute>
</xpath>
<xpath expr="//field[@name='res_name']" position="attributes">
<attribute name="string">Task</attribute>
</xpath>
<xpath expr="//filter[@name='responsible']" position="after">
<filter name="rating_text" position="move"/>
<filter string="Project" name="groupby_project" context="{'group_by': 'parent_res_name'}"/>
<filter name="resource" position="move"/>
<filter name="customer" position="move"/>
</xpath>
<xpath expr="//filter[@name='resource']" position="attributes">
<attribute name="string">Task</attribute>
</xpath>
<xpath expr="//filter[@name='responsible']" position="replace"></xpath>
<xpath expr="/search" position="inside">
<filter string="Last 30 Days" name="rating_last_30_days" domain="[
('write_date', '>=', (datetime.datetime.combine(context_today() + relativedelta(days=-30), datetime.time(0,0,0)).to_utc()).strftime('%Y-%m-%d %H:%M:%S'))]"
/>
<separator/>
</xpath>
</field>
</record>
<record id="rating_rating_action_view_project_rating" model="ir.actions.act_window">
<field name="name">Ratings</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')]</field>
<field name="search_view_id" ref="rating_rating_view_search_project"/>
<field name="help" type="html">
<p class="o_view_nocontent_empty_folder">
There are no ratings for this project at the moment
</p>
</field>
</record>
<record id="rating_rating_action_view_project_rating_kanban" model="ir.actions.act_window.view">
<field name="sequence" eval="5"/>
<field name="view_mode">kanban</field>
<field name="act_window_id" ref="rating_rating_action_view_project_rating"/>
<field name="view_id" ref="rating.rating_rating_view_kanban"/>
</record>
<record id="rating_rating_action_view_project_rating_tree" model="ir.actions.act_window.view">
<field name="sequence" eval="10"/>
<field name="view_mode">tree</field>
<field name="act_window_id" ref="rating_rating_action_view_project_rating"/>
<field name="view_id" ref="rating_rating_view_tree_project"/>
</record>
<record id="rating_rating_action_view_project_rating_form" model="ir.actions.act_window.view">
<field name="sequence" eval="40"/>
<field name="view_mode">form</field>
<field name="act_window_id" ref="rating_rating_action_view_project_rating"/>
<field name="view_id" ref="rating_rating_view_form_project"/>
</record>
<record id="rating_rating_action_view_project_rating_pivot" model="ir.actions.act_window.view">
<field name="sequence" eval="40"/>
<field name="view_mode">pivot</field>
<field name="act_window_id" ref="rating_rating_action_view_project_rating"/>
<field name="view_id" ref="rating_rating_view_pivot"/>
</record>
<record id="rating_rating_action_view_project_rating_graph" model="ir.actions.act_window.view">
<field name="sequence" eval="40"/>
<field name="view_mode">graph</field>
<field name="act_window_id" ref="rating_rating_action_view_project_rating"/>
<field name="view_id" ref="rating_rating_view_graph"/>
</record>
<record id="rating_rating_action_task" model="ir.actions.act_window">
<field name="name">Ratings</field>
<field name="res_model">rating.rating</field>
<field name="view_mode">kanban,tree,pivot,graph,form</field>
<field name="domain">[('res_model', '=', 'project.task'), ('res_id', '=', active_id), ('consumed', '=', True)]</field>
<field name="search_view_id" ref="rating_rating_view_search_project"/>
<field name="help" type="html">
<p class="o_view_nocontent_empty_folder">
No customer ratings yet
</p><p>
Let's wait for your customers to manifest themselves.
</p>
</field>
</record>
<record id="rating_rating_action_task_kanban" model="ir.actions.act_window.view">
<field name="sequence" eval="5"/>
<field name="view_mode">kanban</field>
<field name="act_window_id" ref="rating_rating_action_task"/>
<field name="view_id" ref="rating.rating_rating_view_kanban"/>
</record>
<record id="rating_rating_action_task_tree" model="ir.actions.act_window.view">
<field name="sequence" eval="10"/>
<field name="view_mode">tree</field>
<field name="act_window_id" ref="rating_rating_action_task"/>
<field name="view_id" ref="rating_rating_view_tree_project"/>
</record>
<record id="rating_rating_action_task_form" model="ir.actions.act_window.view">
<field name="sequence" eval="40"/>
<field name="view_mode">form</field>
<field name="act_window_id" ref="rating_rating_action_task"/>
<field name="view_id" ref="rating_rating_view_form_project"/>
</record>
<record id="rating_rating_action_task_pivot" model="ir.actions.act_window.view">
<field name="sequence" eval="40"/>
<field name="view_mode">pivot</field>
<field name="act_window_id" ref="rating_rating_action_task"/>
<field name="view_id" ref="rating_rating_view_pivot"/>
</record>
<record id="rating_rating_action_task_graph" model="ir.actions.act_window.view">
<field name="sequence" eval="40"/>
<field name="view_mode">graph</field>
<field name="act_window_id" ref="rating_rating_action_task"/>
<field name="view_id" ref="rating_rating_view_graph"/>
</record>
<record id="rating_rating_action_project_report" model="ir.actions.act_window">
<field name="name">Customer Ratings</field>
<field name="res_model">rating.rating</field>
<field name="view_mode">kanban,tree,pivot,graph,form</field>
<field name="domain">[('parent_res_model','=','project.project'), ('consumed', '=', True)]</field>
<field name="search_view_id" ref="rating_rating_view_search_project"/>
<field name="help" type="html">
<p class="o_view_nocontent_empty_folder">
No customer ratings yet
</p><p>
Let's wait for your customers to manifest themselves.
</p>
</field>
<field name="context">{
'search_default_rating_last_30_days': 1,
'graph_groupbys': ['rated_partner_id'],
}</field>
</record>
<record id="rating_rating_action_project_report_kanban" model="ir.actions.act_window.view">
<field name="sequence" eval="5"/>
<field name="view_mode">kanban</field>
<field name="act_window_id" ref="rating_rating_action_project_report"/>
<field name="view_id" ref="rating.rating_rating_view_kanban"/>
</record>
<record id="rating_rating_action_project_report_tree" model="ir.actions.act_window.view">
<field name="sequence" eval="10"/>
<field name="view_mode">tree</field>
<field name="act_window_id" ref="rating_rating_action_project_report"/>
<field name="view_id" ref="rating_rating_view_tree_project"/>
</record>
<record id="rating_rating_action_project_report_form" model="ir.actions.act_window.view">
<field name="sequence" eval="40"/>
<field name="view_mode">form</field>
<field name="act_window_id" ref="rating_rating_action_project_report"/>
<field name="view_id" ref="rating_rating_view_form_project"/>
</record>
<record id="rating_rating_action_project_report_pivot" model="ir.actions.act_window.view">
<field name="sequence" eval="40"/>
<field name="view_mode">pivot</field>
<field name="act_window_id" ref="rating_rating_action_project_report"/>
<field name="view_id" ref="rating_rating_view_pivot"/>
</record>
<record id="rating_rating_action_project_report_graph" model="ir.actions.act_window.view">
<field name="sequence" eval="40"/>
<field name="view_mode">graph</field>
<field name="act_window_id" ref="rating_rating_action_project_report"/>
<field name="view_id" ref="rating_rating_view_graph"/>
</record>
</odoo>