From 5837b6c32044a294cebdf85deddeba75d2264c86 Mon Sep 17 00:00:00 2001 From: Geoffroy Larue Date: Wed, 8 May 2019 08:10:24 +0000 Subject: [PATCH] [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 --- addons/hr_timesheet/views/project_views.xml | 3 +++ addons/project/models/project.py | 7 +++++++ addons/project/views/project_views.xml | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/addons/hr_timesheet/views/project_views.xml b/addons/hr_timesheet/views/project_views.xml index 738e10145f8..c8a061b5ad0 100644 --- a/addons/hr_timesheet/views/project_views.xml +++ b/addons/hr_timesheet/views/project_views.xml @@ -175,6 +175,9 @@ + + record.analytic_account_id.raw_value and !record.allow_timesheets.raw_value + diff --git a/addons/project/models/project.py b/addons/project/models/project.py index b615467e909..679a63930f2 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -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 """ diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml index 9b8840ce0b6..da0d1921500 100644 --- a/addons/project/views/project_views.xml +++ b/addons/project/views/project_views.xml @@ -304,6 +304,7 @@ +
@@ -360,6 +361,11 @@
+ +
+ Profitability +
+