[IMP] project, hr_timesheet: profitability link

In order to improve the tracking of costs and revenues on projects,
this commit adds a "Profitability" link on the Kanban card of the
Project which appears for analytic accounting users when the
"Timesheets" / "Overview" link does not appear.

This link brings to the  tree view of the lines from the analytic
account linked to the project.

Task-1975022
This commit is contained in:
Geoffroy Larue
2019-05-24 09:46:46 +00:00
committed by jem-odoo
parent f3999314af
commit 5837b6c320
3 changed files with 16 additions and 0 deletions
@@ -175,6 +175,9 @@
</div>
</a>
</xpath>
<xpath expr="//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>
</record>
+7
View File
@@ -376,6 +376,13 @@ class Project(models.Model):
action = self.env['ir.actions.act_window'].for_xml_id('project', 'act_project_project_2_project_task_all')
return dict(action, context=ctx)
def action_view_account_analytic_line(self):
""" return the action to see all the analytic lines of the project's analytic account """
action = self.env.ref('analytic.account_analytic_line_action').read()[0]
action['context'] = {'default_account_id': self.analytic_account_id.id}
action['domain'] = [('account_id', '=', self.analytic_account_id.id)]
return action
@api.multi
def action_view_all_rating(self):
""" return the action to see all the rating of the project, and activate default filters """
+6
View File
@@ -304,6 +304,7 @@
<field name="is_favorite"/>
<field name="rating_percentage_satisfaction"/>
<field name="rating_status"/>
<field name="analytic_account_id"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="#{kanban_color(record.color.raw_value)} oe_kanban_global_click o_has_icon">
@@ -360,6 +361,11 @@
<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>