From 23cf9318084c8a00f37ffcefefa3e056583d2d77 Mon Sep 17 00:00:00 2001 From: Adesh Jolhe Date: Wed, 29 Jun 2022 06:33:48 +0000 Subject: [PATCH] [IMP] hr_,sale_(timesheet, project),purchase: generic improvements for the project Purpose of the commit is to do the generic improvements for project. So in this commit did the following changes: - adding a label 'last update' to the stat button in project form view. - indicate 'my project' in the tab instead of 'project sharing view in portal' in project sharing. - set the first non-folded stage of the project as default on newly created tasks. - remove user confirming the SO as the default project manager. - hide fields service_tracking, service_upsell_threshold if sale_ok is false. - set purchase_method to purchase by default if product is of service type. - remove the : next to the totals labels and decrease the font-size for values of 'total hours' and 'remaining hours' in timesheets notebook in project task form view. task-2897867 closes odoo/odoo#96548 Related: odoo/enterprise#29774 Signed-off-by: Xavier Bol (xbo) Co-authored-by: Manisha Tulsiyani --- addons/hr_timesheet/views/project_project_views.xml | 3 +-- addons/product/views/product_views.xml | 2 +- addons/project/models/project_task.py | 2 +- .../project_status_with_color_selection_field.js | 11 +++++++++++ .../project_status_with_color_selection_field.xml | 9 +++++++-- addons/project/views/project_project_views.xml | 8 ++++---- .../views/project_sharing_project_task_templates.xml | 2 +- addons/project/views/project_task_views.xml | 2 +- addons/purchase/models/product.py | 10 ++++++++-- addons/purchase/tests/test_accrued_purchase_orders.py | 4 ++-- addons/sale_project/models/product.py | 4 ++-- addons/sale_project/models/sale_order_line.py | 1 + addons/sale_project/views/product_views.xml | 2 +- addons/sale_timesheet/models/product.py | 4 ++-- addons/sale_timesheet/views/product_views.xml | 4 ++-- 15 files changed, 45 insertions(+), 23 deletions(-) diff --git a/addons/hr_timesheet/views/project_project_views.xml b/addons/hr_timesheet/views/project_project_views.xml index bc362c4cb42..a7cb218e029 100644 --- a/addons/hr_timesheet/views/project_project_views.xml +++ b/addons/hr_timesheet/views/project_project_views.xml @@ -65,8 +65,7 @@ - - +
- + diff --git a/addons/project/models/project_task.py b/addons/project/models/project_task.py index 84a912a00f4..4a79bd6348b 100644 --- a/addons/project/models/project_task.py +++ b/addons/project/models/project_task.py @@ -87,7 +87,7 @@ class Task(models.Model): project_id = self.env.context.get('default_project_id') if not project_id: return False - return self.stage_find(project_id, [('fold', '=', False)]) + return self.stage_find(project_id, order="fold, sequence, id") @api.model def _default_personal_stage_type_id(self): diff --git a/addons/project/static/src/components/project_status_with_color_selection/project_status_with_color_selection_field.js b/addons/project/static/src/components/project_status_with_color_selection/project_status_with_color_selection_field.js index 8718c981564..c32c84e56b2 100644 --- a/addons/project/static/src/components/project_status_with_color_selection/project_status_with_color_selection_field.js +++ b/addons/project/static/src/components/project_status_with_color_selection/project_status_with_color_selection_field.js @@ -20,11 +20,22 @@ export class ProjectStatusWithColorSelectionField extends SelectionField { return this.colors[value] ? this.colorPrefix + this.colors[value] : ""; } } + +ProjectStatusWithColorSelectionField.props = { + ...SelectionField.props, + statusLabel: { type: String, optional: true }, +}; + ProjectStatusWithColorSelectionField.template = 'project.ProjectStatusWithColorSelectionField'; export const projectStatusWithColorSelectionField = { ...selectionField, component: ProjectStatusWithColorSelectionField, + extractProps: (fieldInfo, dynamicInfo) => { + const props = selectionField.extractProps(fieldInfo, dynamicInfo); + props.statusLabel = fieldInfo.attrs.status_label; + return props; + }, }; registry.category("fields").add("status_with_color", projectStatusWithColorSelectionField); diff --git a/addons/project/static/src/components/project_status_with_color_selection/project_status_with_color_selection_field.xml b/addons/project/static/src/components/project_status_with_color_selection/project_status_with_color_selection_field.xml index e6c848648e8..46f605cee97 100644 --- a/addons/project/static/src/components/project_status_with_color_selection/project_status_with_color_selection_field.xml +++ b/addons/project/static/src/components/project_status_with_color_selection/project_status_with_color_selection_field.xml @@ -4,8 +4,13 @@
- - +
+ +
+
+
+
+
diff --git a/addons/project/views/project_project_views.xml b/addons/project/views/project_project_views.xml index 86a20a1856a..ea8543ae806 100644 --- a/addons/project/views/project_project_views.xml +++ b/addons/project/views/project_project_views.xml @@ -29,15 +29,15 @@