[IMP] project,{hr,sale}_timesheet: review dropdown in project kanban card

Before this commit, we add various buttons in the bottom of each card with a
certain condition, the problem is the lack of place to display more and
more information in each project kanban card.

This commit reviews the dropdown menus in each project kanban card.
Two sections is added one for another 'Views' to redirect to documents,
timesheets, sales order and planning, for instance. And the last section
for 'Reporting' like burndown chart.

task-2458017

closes #68343
This commit is contained in:
Xavier BOL (xbo)
2021-04-08 08:27:49 +02:00
parent 41a81aef24
commit 642fb2e6dd
4 changed files with 62 additions and 28 deletions
+6 -7
View File
@@ -239,15 +239,14 @@
<field name="arch" type="xml">
<field name="partner_id" position="after">
<field name="allow_timesheets" invisible="1"/>
<field name="total_timesheet_time" invisible="1"/>
</field>
<xpath expr="//div[hasclass('o_project_kanban_boxes')]" position="inside">
<a t-if="record.allow_timesheets.raw_value" class="o_project_kanban_box o_project_timesheet_box" name="%(act_hr_timesheet_line_by_project)d" type="action" groups="hr_timesheet.group_hr_timesheet_user">
<div>
<span class="o_label">Timesheets</span>
</div>
</a>
<xpath expr="//div[hasclass('o_kanban_manage_view')]" position="inside">
<div role="menuitem" t-if="record.allow_timesheets.raw_value and record.total_timesheet_time.raw_value" groups="hr_timesheet.group_hr_timesheet_user">
<a name="%(act_hr_timesheet_line_by_project)d" type="action">Timesheets</a>
</div>
</xpath>
<xpath expr="//a[@name='action_view_account_analytic_line']" position="attributes">
<xpath expr="//div[a[@name='action_view_account_analytic_line']]" position="attributes">
<attribute name="t-if">record.analytic_account_id.raw_value and !record.allow_timesheets.raw_value</attribute>
</xpath>
</field>
+7
View File
@@ -495,6 +495,13 @@ class Project(models.Model):
action_context.pop('group_by', None)
return dict(action, context=action_context)
def action_view_tasks_analysis(self):
""" return the action to see the tasks analysis report of the project """
action = self.env['ir.actions.act_window']._for_xml_id('project.action_project_task_user_tree')
action_context = ast.literal_eval(action['context']) if action['context'] else {}
action_context['search_default_project_id'] = self.id
return dict(action, context=action_context)
# ---------------------------------------------------
# Business Methods
# ---------------------------------------------------
+35 -14
View File
@@ -527,6 +527,7 @@
<field name="rating_active" />
<field name="analytic_account_id"/>
<field name="date"/>
<field name="doc_count"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="#{kanban_color(record.color.raw_value)} oe_kanban_global_click o_has_icon">
@@ -556,20 +557,45 @@
</div>
</div>
</div>
<div class="o_kanban_card_manage_pane dropdown-menu" groups="project.group_project_manager" role="menu">
<div class="o_kanban_card_manage_section o_kanban_manage_reports">
<div role="menuitem">
<a name="%(portal.portal_share_action)d" type="action">Share</a>
<div class="container o_kanban_card_manage_pane dropdown-menu" role="menu" groups="base.group_user">
<div class="row">
<div class="col-6 o_kanban_card_manage_section o_kanban_manage_view">
<div role="menuitem" class="o_kanban_card_manage_title">
<span>View</span>
</div>
<div role="menuitem">
<a name="action_view_tasks" type="object">Tasks</a>
</div>
<div role="menuitem" t-if="record.doc_count.raw_value">
<a name="attachment_tree_view" type="object">Documents</a>
</div>
</div>
<div role="menuitem">
<a type="edit">Edit</a>
<div class="col-6 o_kanban_card_manage_section o_kanban_manage_reporting" groups="project.group_project_manager">
<div role="menuitem" class="o_kanban_card_manage_title">
<span>Reporting</span>
</div>
<div role="menuitem">
<a name="action_view_tasks_analysis" type="object">Tasks Analysis</a>
</div>
<div role="menuitem">
<a name="%(action_project_task_burndown_chart_report)d" type="action">Burndown Chart</a>
</div>
<div role="menuitem" t-if="record.analytic_account_id.raw_value" groups="analytic.group_analytic_accounting">
<a name="action_view_account_analytic_line" type="object">Profitability</a>
</div>
</div>
</div>
<div role="menuitem" aria-haspopup="true" class="o_no_padding_kanban_colorpicker">
<ul class="oe_kanban_colorpicker" data-field="color" role="popup"/>
<div class="o_kanban_card_manage_settings row" groups="project.group_project_manager">
<div role="menuitem" aria-haspopup="true" class="col-8">
<ul class="oe_kanban_colorpicker" data-field="color" role="popup"/>
</div>
<div role="menuitem" class="col-4">
<a class="dropdown-item" role="menuitem" name="%(portal.portal_share_action)d" type="action">Share</a>
<a class="dropdown-item" role="menuitem" type="edit">Edit</a>
</div>
</div>
</div>
<a class="o_kanban_manage_toggle_button o_left" href="#" groups="project.group_project_manager"><i class="fa fa-ellipsis-v" role="img" aria-label="Manage" title="Manage"/></a>
<a class="o_kanban_manage_toggle_button o_left" href="#" groups="base.group_user"><i class="fa fa-ellipsis-v" role="img" aria-label="Manage" title="Manage"/></a>
<span class="o_right"><field name="is_favorite" widget="boolean_favorite" nolabel="1" force_save="1" /></span>
</div>
@@ -580,11 +606,6 @@
<span class="o_label"><t t-esc="record.label_tasks.value"/></span>
</div>
</a>
<a t-if="record.analytic_account_id.raw_value" class="o_project_kanban_box o_project_timesheet_box" name="action_view_account_analytic_line" type="object" groups="analytic.group_analytic_accounting">
<div>
<span class="o_label">Profitability</span>
</div>
</a>
</div>
</div>
</t>
@@ -91,16 +91,23 @@
<xpath expr="//field[@name='allow_timesheets']" position="after">
<field name="allow_billable"/>
<field name="warning_employee_rate" invisible="1"/>
<field name="sale_order_id" invisible="1"/>
<field name="pricing_type" invisible="1"/>
</xpath>
<xpath expr="//a[@name='action_view_account_analytic_line']" position="attributes">
<xpath expr="//div[a[@name='action_view_account_analytic_line']]" position="attributes">
<attribute name="t-if">record.analytic_account_id.raw_value and !record.allow_timesheets.raw_value and record.allow_billable.raw_value</attribute>
</xpath>
<xpath expr="//a[@t-if='record.allow_timesheets.raw_value']" position="replace">
<a t-if="record.allow_timesheets.raw_value and record.allow_billable.raw_value" name="action_view_timesheet" type="object" class="o_project_kanban_box o_project_timesheet_box" groups="project.group_project_manager">
<div>
<span class="o_label">Overview</span>
</div>
</a>
<xpath expr="//div[hasclass('o_kanban_manage_reporting')]" position="inside">
<div t-if="record.allow_timesheets.raw_value and record.allow_billable.raw_value" role="menuitem" groups="project.group_project_manager">
<a name="action_view_timesheet" type="object">Costs / Revenues</a>
</div>
</xpath>
<xpath expr="//div[hasclass('o_kanban_manage_view')]" position="inside">
<div t-if="record.allow_billable.raw_value and record.sale_order_id.raw_value and record.pricing_type.raw_value != 'task_rate'"
role="menuitem"
groups="sales_team.group_sale_salesman_all_leads">
<a name="action_view_so" type="object">Sales Order</a>
</div>
</xpath>
</field>
</record>