From f87d0d522641201df7539ef74801d5ccd93b521d Mon Sep 17 00:00:00 2001 From: abderraouf Date: Mon, 31 Jan 2022 11:38:33 +0000 Subject: [PATCH] [IMP] project : Add project Tree view, improve some wordings and hide uom conversion when default and selected are the same Before this commit, In the product form, when the selected uom is Hours and as Hours is the default uom, we display this conversion (1.0 Hours = 1.0 Hours) which is useless Before this commit, Kanban is the only view available for projects. With this view, we can't select a batch of projects and display optional fields Before this commit, Some wordings didn't have a significant meaning. This commit hides uom conversion when selected and default uom are the same. This commit adds the projects tree view. This commit improves some wordings according to what was mentionned in the task. task-2724965 closes odoo/odoo#82135 Related: odoo/enterprise#23206 Related: odoo/upgrade#3207 Signed-off-by: Laurent Stukkens (ltu) --- addons/hr_timesheet/__init__.py | 11 +-- addons/hr_timesheet/views/project_views.xml | 4 - addons/project/models/__init__.py | 1 - addons/project/models/ir_ui_menu.py | 14 ---- addons/project/models/project.py | 7 -- .../project/report/project_report_views.xml | 2 +- ...oject_task_burndown_chart_report_views.xml | 2 +- addons/project/static/src/js/tours/project.js | 2 +- .../views/project_project_stage_views.xml | 2 +- .../project/views/project_sharing_views.xml | 9 ++- addons/project/views/project_views.xml | 76 +++++++++---------- addons/project/views/rating_views.xml | 8 +- .../project/wizard/project_delete_wizard.py | 2 +- addons/sale_timesheet/models/product.py | 5 +- addons/sale_timesheet/views/product_views.xml | 2 +- 15 files changed, 59 insertions(+), 88 deletions(-) delete mode 100644 addons/project/models/ir_ui_menu.py diff --git a/addons/hr_timesheet/__init__.py b/addons/hr_timesheet/__init__.py index ae60708b040..e20ea226124 100644 --- a/addons/hr_timesheet/__init__.py +++ b/addons/hr_timesheet/__init__.py @@ -34,14 +34,9 @@ def create_internal_project(cr, registry): def _uninstall_hook(cr, registry): env = api.Environment(cr, SUPERUSER_ID, {}) - xml_ids = [ - 'project.open_view_project_all', - 'project.open_view_project_all_group_stage' - ] - for xml_id in xml_ids: - act_window = env.ref(xml_id, raise_if_not_found=False) - if act_window and act_window.domain and 'is_internal_project' in act_window.domain: - act_window.domain = [] + act_window = env.ref('project.open_view_project_all', raise_if_not_found=False) + if act_window and act_window.domain and 'is_internal_project' in act_window.domain: + act_window.domain = [] # archive the internal projects project_ids = env['res.company'].search([('internal_project_id', '!=', False)]).mapped('internal_project_id') diff --git a/addons/hr_timesheet/views/project_views.xml b/addons/hr_timesheet/views/project_views.xml index ebcb03fc358..c50bb6e97f2 100644 --- a/addons/hr_timesheet/views/project_views.xml +++ b/addons/hr_timesheet/views/project_views.xml @@ -404,9 +404,5 @@ [('is_internal_project', '=', False)] - - [('is_internal_project', '=', False)] - - diff --git a/addons/project/models/__init__.py b/addons/project/models/__init__.py index 4bf11751b09..46d22ba9de5 100644 --- a/addons/project/models/__init__.py +++ b/addons/project/models/__init__.py @@ -14,4 +14,3 @@ from . import project_update from . import res_config_settings from . import res_partner from . import digest -from . import ir_ui_menu diff --git a/addons/project/models/ir_ui_menu.py b/addons/project/models/ir_ui_menu.py deleted file mode 100644 index 7ff478dc6d6..00000000000 --- a/addons/project/models/ir_ui_menu.py +++ /dev/null @@ -1,14 +0,0 @@ -# -*- coding: utf-8 -*- -# Part of Odoo. See LICENSE file for full copyright and licensing details. - -from odoo import models - - -class IrUiMenu(models.Model): - _inherit = 'ir.ui.menu' - - def _load_menus_blacklist(self): - res = super()._load_menus_blacklist() - if self.env.user.has_group('project.group_project_stages'): - res.append(self.env.ref('project.menu_projects').id) - return res diff --git a/addons/project/models/project.py b/addons/project/models/project.py index 05de0ace005..8f85346d675 100644 --- a/addons/project/models/project.py +++ b/addons/project/models/project.py @@ -696,13 +696,6 @@ class Project(models.Model): action_context['search_default_project_id'] = self.id return dict(action, context=action_context) - @api.model - def _action_open_all_projects(self): - action = self.env['ir.actions.act_window']._for_xml_id( - 'project.open_view_project_all' if not self.user_has_groups('project.group_project_stages') else - 'project.open_view_project_all_group_stage') - return action - def action_view_analytic_account_entries(self): self.ensure_one() return { diff --git a/addons/project/report/project_report_views.xml b/addons/project/report/project_report_views.xml index 19f8c10827c..6f8a6255db5 100644 --- a/addons/project/report/project_report_views.xml +++ b/addons/project/report/project_report_views.xml @@ -95,7 +95,7 @@

No data yet!

- Analyze the performance of your tasks and your workers. + Analyze the progress of your projects and the performance of your employees.

diff --git a/addons/project/report/project_task_burndown_chart_report_views.xml b/addons/project/report/project_task_burndown_chart_report_views.xml index 2d463204a66..a2e47916439 100644 --- a/addons/project/report/project_task_burndown_chart_report_views.xml +++ b/addons/project/report/project_task_burndown_chart_report_views.xml @@ -60,7 +60,7 @@

No data yet!

-

Analyze how quickly your team is completing your project's tasks and check if everything is going according to plan.

+

Analyze how quickly your team is completing your project's tasks and check if everything is progressing according to plan.

diff --git a/addons/project/static/src/js/tours/project.js b/addons/project/static/src/js/tours/project.js index c9eb6cc0465..e80ced8533a 100644 --- a/addons/project/static/src/js/tours/project.js +++ b/addons/project/static/src/js/tours/project.js @@ -100,7 +100,7 @@ tour.register('project_tour', { position: "bottom" }, { trigger: ".o_ChatterTopbar_buttonScheduleActivity", - content: Markup(_t("Use activities to organize your daily work.")), + content: Markup(_t("Create activities to set yourself to-dos or to schedule meetings.")), }, { trigger: ".modal-dialog .btn-primary", content: "Schedule your activity once it is ready.", diff --git a/addons/project/views/project_project_stage_views.xml b/addons/project/views/project_project_stage_views.xml index a761e849f17..0aabf904ee5 100644 --- a/addons/project/views/project_project_stage_views.xml +++ b/addons/project/views/project_project_stage_views.xml @@ -94,7 +94,7 @@

No stages found. Let's create one!

- Track the progress of your projects from their creation to their closing. + Define the steps your projects move through from creation to completion.

diff --git a/addons/project/views/project_sharing_views.xml b/addons/project/views/project_sharing_views.xml index 0f6076d18e0..1f63d8b31bc 100644 --- a/addons/project/views/project_sharing_views.xml +++ b/addons/project/views/project_sharing_views.xml @@ -9,7 +9,7 @@
- +
@@ -290,9 +290,10 @@

No tasks found. Let's create one! -

- To get things done, use activities and status on tasks.
- Chat in real time or by email to collaborate efficiently. +

+

+ Keep track of the progress of your tasks from creation to completion.
+ Collaborate efficiently by chatting in real-time or via email.

diff --git a/addons/project/views/project_views.xml b/addons/project/views/project_views.xml index eef7b75f9c4..ce68cc09f1b 100644 --- a/addons/project/views/project_views.xml +++ b/addons/project/views/project_views.xml @@ -94,9 +94,10 @@

No tasks found. Let's create one! -

- To get things done, use activities and status on tasks.
- Chat in real-time or by email to collaborate efficiently. +

+

+ Keep track of the progress of your tasks from creation to completion.
+ Collaborate efficiently by chatting in real-time or via email.

@@ -111,9 +112,10 @@

No tasks found. Let's create one! -

- To get things done, use activities and status on tasks.
- Chat in real time or by email to collaborate efficiently. +

+

+ Keep track of the progress of your tasks from creation to completion.
+ Collaborate efficiently by chatting in real-time or via email.

@@ -254,7 +256,7 @@

No stages found. Let's create one!

- Track the progress of your tasks from their creation to their closing. + Define the steps your tasks move through from creation to completion.

@@ -761,38 +763,32 @@ - + + project.kanban.inherit.project + project.project + + + + + stage_id + + + + Projects project.project [] - kanban,form - + kanban,tree,form + main

No projects found. Let's create one! -

- Projects regroup tasks on the same topic, and each has its dashboard.

-
-
- - - Projects - project.project - [] - kanban,form - - - main - {'search_default_groupby_stage': 1} - -

- No projects found. Let's create one! -

- Projects regroup tasks on the same topic, and each has its dashboard. +

+ Projects contain tasks on the same topic, and each has its own dashboard.

@@ -810,8 +806,9 @@

No projects found. Let's create one! -

- Projects regroup tasks on the same topic, and each has its dashboard. +

+

+ Projects contain tasks on the same topic, and each has its own dashboard.

@@ -1073,7 +1070,7 @@
- + @@ -1323,9 +1320,10 @@

No tasks found. Let's create one! -

- To get things done, use activities and status on tasks.
- Chat in real-time or by email to collaborate efficiently. +

+

+ Keep track of the progress of your tasks from creation to completion.
+ Collaborate efficiently by chatting in real-time or via email.

@@ -1339,9 +1337,10 @@

No tasks found. Let's create one! -

- To get things done, use activities and status on tasks.
- Chat in real-time or by email to collaborate efficiently. +

+

+ Organize your tasks by dispatching them across the pipeline.
+ Collaborate efficiently by chatting in real-time or via email.

@@ -1393,7 +1392,6 @@ - diff --git a/addons/project/views/rating_views.xml b/addons/project/views/rating_views.xml index d349da24c71..d46f92050c4 100644 --- a/addons/project/views/rating_views.xml +++ b/addons/project/views/rating_views.xml @@ -204,7 +204,8 @@

No customer ratings yet -

+

+

Let's wait for your customers to manifest themselves.

@@ -254,8 +255,9 @@

No customer ratings yet -

- Let's wait for your customers to manifest themselves. +

+

+ Measure your customer satisfaction by sending rating requests when your tasks reach a certain stage.

{ diff --git a/addons/project/wizard/project_delete_wizard.py b/addons/project/wizard/project_delete_wizard.py index 33c3a3040ea..9b7d93c1031 100644 --- a/addons/project/wizard/project_delete_wizard.py +++ b/addons/project/wizard/project_delete_wizard.py @@ -25,4 +25,4 @@ class ProjectDelete(models.TransientModel): def confirm_delete(self): self.with_context(active_test=False).project_ids.unlink() - return self.env["project.project"]._action_open_all_projects() + return self.env['ir.actions.act_window']._for_xml_id('project.open_view_project_all') diff --git a/addons/sale_timesheet/models/product.py b/addons/sale_timesheet/models/product.py index 2e6cdcbba7a..ce0eff95383 100644 --- a/addons/sale_timesheet/models/product.py +++ b/addons/sale_timesheet/models/product.py @@ -29,10 +29,11 @@ class ProductTemplate(models.Model): def _compute_service_upsell_threshold_ratio(self): product_uom_hour = self.env.ref('uom.product_uom_hour') for record in self: - if not record.uom_id: + if not record.uom_id or product_uom_hour.factor == record.uom_id.factor: record.service_upsell_threshold_ratio = False continue - record.service_upsell_threshold_ratio = f"1 {record.uom_id.name} = {product_uom_hour.factor / record.uom_id.factor:.2f} Hours" + if product_uom_hour.factor != record.uom_id.factor: + record.service_upsell_threshold_ratio = f"(1 {record.uom_id.name} = {product_uom_hour.factor / record.uom_id.factor:.2f} Hours)" def _compute_visible_expense_policy(self): visibility = self.user_has_groups('project.group_project_user') diff --git a/addons/sale_timesheet/views/product_views.xml b/addons/sale_timesheet/views/product_views.xml index f3c8a0ed8bd..e717286c16c 100644 --- a/addons/sale_timesheet/views/product_views.xml +++ b/addons/sale_timesheet/views/product_views.xml @@ -10,7 +10,7 @@
Warn the salesperson for an upsell when work done exceeds - of hours sold. () + of hours sold.