From 4a8f31e25fb182eb78540536832475b9bb626ec7 Mon Sep 17 00:00:00 2001 From: "Rohitkumar (roku)" Date: Tue, 29 Mar 2022 12:41:33 +0000 Subject: [PATCH] [IMP] project,sale_timesheet: generic UX improvement for project Purpose of this commit to improve generic usage of project app. So, in this commit done following changes: - change the placeholder of the name to 'e.g. Monthly review' in project_update_view_form - set the 'analytic account' of the project on the tasks by default - change the placeholder to 'e.g. Product Launch' in project_milestone_view_form - the 'cabinets' milestone should be linked to a milestone service, not a manual one so change data to milestone in demo data - rename the 'rating' stat button into 'last rating' in view_task_form2 - set another employee than Mitchell for the 'customer care (prepaid hours)' SOL field in sale_service_demo_data - display a separator on the right of the stat button so remove unwanted properties in project_rightpanel.scss - add the 'name' field to the 'fields to export' when 'i want to update data' is set to true - remove the 'Getting Things Done (GTD)' example from kanban examples wizard - add a 'tasks due today' filter that should return tasks whose deadline falls on today's date in view_task_search_form task-2809188 closes odoo/odoo#88271 Signed-off-by: Laurent Stukkens (ltu) --- addons/project/models/project.py | 17 +++++++++++++++-- .../src/js/project_task_kanban_examples.js | 6 ------ .../static/src/scss/project_rightpanel.scss | 2 +- addons/project/views/project_update_views.xml | 4 ++-- addons/project/views/project_views.xml | 4 +++- .../sale_timesheet/data/sale_service_demo.xml | 4 ++-- 6 files changed, 23 insertions(+), 14 deletions(-) diff --git a/addons/project/models/project.py b/addons/project/models/project.py index 8d170ca994a..ebf80dbcb29 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -227,7 +227,7 @@ class Project(models.Model): def _read_group_stage_ids(self, stages, domain, order): return self.env['project.project.stage'].search([], order=order) - name = fields.Char("Name", index='trigram', required=True, tracking=True, translate=True) + name = fields.Char("Name", index='trigram', required=True, tracking=True, translate=True, default_export_compatible=True) description = fields.Html() active = fields.Boolean(default=True, help="If the active field is set to False, it will allow you to hide the project without removing it.") @@ -1187,11 +1187,12 @@ class Task(models.Model): repeat_show_month = fields.Boolean(compute='_compute_repeat_visibility') # Account analytic - analytic_account_id = fields.Many2one('account.analytic.account', ondelete='set null', + analytic_account_id = fields.Many2one('account.analytic.account', ondelete='set null', compute='_compute_analytic_account_id', store=True, readonly=False, domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", check_company=True, help="Analytic account to which this task is linked for financial management. " "Use an analytic account to record cost and revenue on your task. " "If empty, the analytic account of the project will be used.") + is_analytic_account_id_changed = fields.Boolean('Is Analytic Account Manually Changed', compute='_compute_is_analytic_account_id_changed', store=True) project_analytic_account_id = fields.Many2one('account.analytic.account', string='Project Analytic Account', related='project_id.analytic_account_id') analytic_tag_ids = fields.Many2many('account.analytic.tag', string="Analytic Tags", domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", check_company=True) @@ -1204,6 +1205,18 @@ class Task(models.Model): def SELF_WRITABLE_FIELDS(self): return PROJECT_TASK_WRITABLE_FIELDS + @api.depends('project_id.analytic_account_id') + def _compute_analytic_account_id(self): + self.env.remove_to_compute(self._fields['is_analytic_account_id_changed'], self) + for task in self: + if not task.is_analytic_account_id_changed: + task.analytic_account_id = task.project_id.analytic_account_id + + @api.depends('analytic_account_id') + def _compute_is_analytic_account_id_changed(self): + for task in self: + task.is_analytic_account_id_changed = task.project_id and task.analytic_account_id != task.project_id.analytic_account_id + @api.depends('project_id', 'parent_id') def _compute_is_private(self): # Modify accordingly, this field is used to display the lock on the task's kanban card diff --git a/addons/project/static/src/js/project_task_kanban_examples.js b/addons/project/static/src/js/project_task_kanban_examples.js index 00de928f19a..7882dbd0514 100644 --- a/addons/project/static/src/js/project_task_kanban_examples.js +++ b/addons/project/static/src/js/project_task_kanban_examples.js @@ -66,12 +66,6 @@ kanbanExamplesRegistry.add('project', { 'automatically, and you can communicate on the task directly. Your managers decide which ' + 'feedback is accepted %s and which feedback is moved to the %s column. %s'), greenBullet, _lt('"Refused"'), descriptionActivities), bullets: [greenBullet, redBullet], - }, { - name: _lt('Getting Things Done (GTD)'), - columns: [_lt('Inbox'), _lt('Today'), _lt('This Week'), _lt('This Month'), _lt('Long Term')], - description: escFormat(_lt('Fill your Inbox easily with the email gateway. Periodically review your ' + - 'Inbox and schedule tasks by moving them to other columns. Every day, you review the ' + - '%s column to move important tasks %s. Every Monday, you review the %s column. %s'), _lt('"This Week"'), _lt('"Today"'), _lt('"This Month"'), descriptionActivities), }, { name: _lt('Consulting'), columns: [_lt('New Projects'), _lt('Resources Allocation'), _lt('In Progress'), _lt('Done')], diff --git a/addons/project/static/src/scss/project_rightpanel.scss b/addons/project/static/src/scss/project_rightpanel.scss index c1b139f9b3f..1bb5610a510 100644 --- a/addons/project/static/src/scss/project_rightpanel.scss +++ b/addons/project/static/src/scss/project_rightpanel.scss @@ -186,7 +186,7 @@ html .o_web_client > .o_action_manager > .o_action > .o_content > .o_controller_ margin-left: -1px; height: 57.5px; - &:nth-child(3n){ + &:nth-child(3n):not(:last-child){ border-right-width: 0px; } diff --git a/addons/project/views/project_update_views.xml b/addons/project/views/project_update_views.xml index e61c0c8ea24..9c1805ea4ed 100644 --- a/addons/project/views/project_update_views.xml +++ b/addons/project/views/project_update_views.xml @@ -19,7 +19,7 @@

- +

@@ -128,7 +128,7 @@ - + diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml index 6508ca8d784..3f7562122e4 100644 --- a/addons/project/views/project_views.xml +++ b/addons/project/views/project_views.xml @@ -34,6 +34,7 @@ + @@ -1002,7 +1003,7 @@
- Rating + Last Rating
@@ -1159,6 +1160,7 @@ + diff --git a/addons/sale_timesheet/data/sale_service_demo.xml b/addons/sale_timesheet/data/sale_service_demo.xml index 66532b53668..6d4e7e42eae 100644 --- a/addons/sale_timesheet/data/sale_service_demo.xml +++ b/addons/sale_timesheet/data/sale_service_demo.xml @@ -262,7 +262,7 @@ Cabinets True - + 0.25 @@ -433,7 +433,7 @@