From 95091a1d88b291dbce343a653d9aa4f3fa66dd3c Mon Sep 17 00:00:00 2001 From: Mitali Patel Date: Tue, 23 Feb 2021 13:55:53 +0000 Subject: [PATCH] [IMP] (hr,sale)_timesheet, (sale_)project: generic improvements in view Purpose of the commit is to do the generic improvement for the refactoring of some module's view. So in this commit, done the following changes: - Reporting > Tasks Analysis , average progress of each task display correctly - In project overview: - state button is fit correctly in report view - In task quick create, added placeholder for name field - In Product form view: - service_tarcking field: rename 'don't create task' into 'don't create a task' - display the share button if privacy_visibility should be portal - remove the 'Documents' stat button - In Tasks list view, allow users to edit the stage of the task in batch if the project is in the context - In project kanban view, remove the 'profitability' link and the corresponding stat button on sale.order task-2458123 closes odoo/odoo#68146 Related: odoo/enterprise#17201 Signed-off-by: LTU-Odoo --- addons/hr_timesheet/report/project_report.py | 5 ++--- addons/hr_timesheet/views/project_views.xml | 3 --- addons/project/models/project.py | 7 ------- addons/project/views/project_views.xml | 16 ++++++---------- addons/sale_project/models/product.py | 2 +- addons/sale_project/models/sale_order.py | 3 --- .../static/src/scss/sale_timesheet.scss | 8 ++++++++ .../views/hr_timesheet_templates.xml | 2 +- .../sale_timesheet/views/project_task_views.xml | 3 --- 9 files changed, 18 insertions(+), 31 deletions(-) diff --git a/addons/hr_timesheet/report/project_report.py b/addons/hr_timesheet/report/project_report.py index 85a5e43351d..367a0a59436 100644 --- a/addons/hr_timesheet/report/project_report.py +++ b/addons/hr_timesheet/report/project_report.py @@ -14,15 +14,14 @@ class ReportProjectTaskUser(models.Model): def _select(self): return super(ReportProjectTaskUser, self)._select() + """, - progress as progress, + (t.effective_hours * 100) / NULLIF(planned_hours, 0) as progress, t.effective_hours as hours_effective, t.planned_hours - t.effective_hours - t.subtask_effective_hours as remaining_hours, - planned_hours as hours_planned""" + NULLIF(planned_hours, 0) as hours_planned""" def _group_by(self): return super(ReportProjectTaskUser, self)._group_by() + """, remaining_hours, t.effective_hours, - progress, planned_hours """ diff --git a/addons/hr_timesheet/views/project_views.xml b/addons/hr_timesheet/views/project_views.xml index 58ec4745345..d4896b7c0e7 100644 --- a/addons/hr_timesheet/views/project_views.xml +++ b/addons/hr_timesheet/views/project_views.xml @@ -246,9 +246,6 @@ Timesheets - - 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 05807fd78b1..9cb0c47efcf 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -450,13 +450,6 @@ class Project(models.Model): action['display_name'] = self.name return action - 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["ir.actions.actions"]._for_xml_id("analytic.account_analytic_line_action") - action['context'] = {'default_account_id': self.analytic_account_id.id} - action['domain'] = [('account_id', '=', self.analytic_account_id.id)] - return action - def action_view_all_rating(self): """ return the action to see all the rating of the project and activate default filters""" action = self.env['ir.actions.act_window']._for_xml_id('project.rating_rating_action_view_project_rating') diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml index b0124f4c1bd..53cd3d72dd2 100644 --- a/addons/project/views/project_views.xml +++ b/addons/project/views/project_views.xml @@ -232,13 +232,11 @@
-
-
@@ -579,7 +575,7 @@
@@ -852,7 +848,7 @@ - + @@ -982,7 +978,7 @@ - + diff --git a/addons/sale_project/models/product.py b/addons/sale_project/models/product.py index e4f6318684b..da3811f9104 100644 --- a/addons/sale_project/models/product.py +++ b/addons/sale_project/models/product.py @@ -9,7 +9,7 @@ class ProductTemplate(models.Model): _inherit = 'product.template' service_tracking = fields.Selection([ - ('no', 'Don\'t create task'), + ('no', 'Don\'t create a task'), ('task_global_project', 'Create a task in an existing project'), ('task_in_project', 'Create a task in sales order\'s project'), ('project_only', 'Create a new project but no task')], diff --git a/addons/sale_project/models/sale_order.py b/addons/sale_project/models/sale_order.py index 6652df26f1d..017195ad257 100644 --- a/addons/sale_project/models/sale_order.py +++ b/addons/sale_project/models/sale_order.py @@ -102,9 +102,6 @@ class SaleOrder(models.Model): def action_view_project_ids(self): self.ensure_one() - if len(self.project_ids) == 1 and self.project_overview: - return self.project_id.action_view_account_analytic_line() - view_form_id = self.env.ref('project.edit_project').id view_kanban_id = self.env.ref('project.view_project_kanban').id action = { diff --git a/addons/sale_timesheet/static/src/scss/sale_timesheet.scss b/addons/sale_timesheet/static/src/scss/sale_timesheet.scss index c23f7459eaa..ecdc4696e0c 100644 --- a/addons/sale_timesheet/static/src/scss/sale_timesheet.scss +++ b/addons/sale_timesheet/static/src/scss/sale_timesheet.scss @@ -17,6 +17,14 @@ $canceled-color: gray; text-align: right; float: none; width: auto; + box-shadow: unset; + margin-left: -$o-horizontal-padding - 1; + @include media-breakpoint-between(lg, xl, $o-extra-grid-breakpoints) { + margin-left: (-$o-horizontal-padding*2) - 1; + } + > .btn.oe_stat_button { + border-bottom: 1px solid #ced4da; + } } .o_profitability_wrapper { diff --git a/addons/sale_timesheet/views/hr_timesheet_templates.xml b/addons/sale_timesheet/views/hr_timesheet_templates.xml index 4da13d0bdae..ac8598b161a 100644 --- a/addons/sale_timesheet/views/hr_timesheet_templates.xml +++ b/addons/sale_timesheet/views/hr_timesheet_templates.xml @@ -22,7 +22,7 @@