From da868d28e2f1268acf0ee413f04ebf3554182249 Mon Sep 17 00:00:00 2001 From: "Adesh Jolhe (adjo)" Date: Fri, 6 May 2022 07:04:01 +0000 Subject: [PATCH] [IMP] hr_timesheet,sale_(project): bring generic improvements for project Purpose of this PR to improve generic usage of project app. So, in this PR done following changes: - In project.project form view : - Divided settings into sections - In project.update.search.view : - Added author, description and status in quick search - Added ancestor task in group by and replaced parent task with ancestor task in search view - In project.task search View: - the filter for unread messages should be visible only if the current user managing his notifications in Odoo - Added my private task filter - In project_task_view_graph - Added a default project > stages group. - In project.task form view: - If stage is_closed added decoration-muted - Replace/Add parent task with ancestor task' in group by and quick search - analytic-tags set on project should be automatically applied to it's tasks task-2844212 Part-of: odoo/odoo#93676 --- addons/hr_timesheet/views/project_views.xml | 19 ++- addons/project/models/project.py | 13 ++ .../project/report/project_report_views.xml | 4 +- addons/project/views/project_update_views.xml | 3 + addons/project/views/project_views.xml | 160 ++++++++++-------- .../static/src/scss/rating_templates.scss | 2 +- .../sale_project/views/project_task_views.xml | 24 +-- 7 files changed, 133 insertions(+), 92 deletions(-) diff --git a/addons/hr_timesheet/views/project_views.xml b/addons/hr_timesheet/views/project_views.xml index f974055d5ac..6484315235d 100644 --- a/addons/hr_timesheet/views/project_views.xml +++ b/addons/hr_timesheet/views/project_views.xml @@ -84,8 +84,11 @@ - -
+ + 0 + + +
@@ -394,12 +397,12 @@ hr_timesheet_graphview - - - - - - + + + + + + diff --git a/addons/project/models/project.py b/addons/project/models/project.py index 7abffa31fa0..ab6204a2f21 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -364,6 +364,7 @@ class Project(models.Model): # rating fields rating_request_deadline = fields.Datetime(compute='_compute_rating_request_deadline', store=True) rating_active = fields.Boolean('Customer Ratings', default=lambda self: self.env.user.has_group('project.group_project_rating')) + allow_rating = fields.Boolean('Allow Customer Ratings', compute="_compute_allow_rating", default=lambda self: self.env.user.has_group('project.group_project_rating')) rating_status = fields.Selection( [('stage', 'Rating when changing stage'), ('periodic', 'Periodic rating') @@ -445,6 +446,10 @@ class Project(models.Model): project.access_warning = _( "The project cannot be shared with the recipient(s) because the privacy of the project is too restricted. Set the privacy to 'Visible by following customers' in order to make it accessible by the recipient(s).") + @api.depends_context('uid') + def _compute_allow_rating(self): + self.allow_rating = self.env.user.has_group('project.group_project_rating') + @api.depends('rating_status', 'rating_status_period') def _compute_rating_request_deadline(self): periods = {'daily': 1, 'weekly': 7, 'bimonthly': 15, 'monthly': 30, 'quarterly': 90, 'yearly': 365} @@ -1341,6 +1346,14 @@ class Task(models.Model): else: return [('project_id', '!=', False)] + @api.model + def _get_view(self, view_id=None, view_type='form', **options): + arch, view = super()._get_view(view_id, view_type, **options) + if view_type == 'search' and self.env.user.notification_type == 'email': + for node in arch.xpath("//filter[@name='message_needaction']"): + node.set('invisible', '1') + return arch, view + @api.depends('parent_id.ancestor_id') def _compute_ancestor_id(self): for task in self: diff --git a/addons/project/report/project_report_views.xml b/addons/project/report/project_report_views.xml index e2e57c5f0a8..ba99ba96f3d 100644 --- a/addons/project/report/project_report_views.xml +++ b/addons/project/report/project_report_views.xml @@ -48,10 +48,10 @@ + - @@ -93,7 +93,7 @@ - + diff --git a/addons/project/views/project_update_views.xml b/addons/project/views/project_update_views.xml index cdf2206bb99..e152f750817 100644 --- a/addons/project/views/project_update_views.xml +++ b/addons/project/views/project_update_views.xml @@ -7,6 +7,9 @@ + + + diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml index fc61e38ac91..9f8fb12bb60 100644 --- a/addons/project/views/project_views.xml +++ b/addons/project/views/project_views.xml @@ -19,11 +19,10 @@ - + - @@ -69,7 +68,7 @@ - + @@ -86,11 +85,20 @@ primary - + + + + + + + + + + @@ -539,75 +547,85 @@ -
-
-
- -
-
-