From 725e7ffae359b11b18c41a65791b9fded1d21fc5 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Dufays Date: Tue, 27 Jun 2023 12:12:14 +0200 Subject: [PATCH] [IMP] various: improve custom activity views The following summary view of the record in the activity views have been improved: - project_task: task state added - project_project: project manager added - event_event: responsible and the dates (date_begin_located and date_end_located) added - account_move: total amount, customer and state added - sale_order: total amount and the state added - purchase_order: total amount and the state added - crm_lead: customer and stage added - hr_applicant (hr_recruitment): recruiter added - survey_survey: responsible added - maintenance.request: added equipment and responsible - stock.picking: added scheduled_date - repair.order: responsible, schedule_date and product_id added - mrp.production: added responsible - hr_leave (hr_holidays): status is added and default deadline modified see below Ensures that "Schedule activity" is in one line by adding a colspan. hr_leave activity: When a time off approval activity is created as a consequence of the creation of a hr.leave, the deadline of the activity is set to the date_from of the hr.leave minus activity type delay_count (default 15) except if it leads to a date anterior to today. In that case it is set to today. That way, in the activity view, the time off approval activities are more or less sorted by related hr.leave date_from and the cell date is an indication of when the time off is planned. Technical note: on most activity view, the activity record was not occupying all the horizontal space. To solve that problem the css has been modified and the max-width (200) that was imposed on the sub div has been removed. And as it was impossible to impose a max-width for a flex div (which is the common case for the activity record), the max width is imposed on each text that might be too long using the class o_text_block. That class has been modified to impose a max-width. That's why that class has been added in most view. Alternativly, we could have modified the activity compiler to add that class when the attribute full was set (not done because not sure of the consequence). Task-3300854 Part-of: odoo/odoo#138135 --- addons/account/views/account_move_views.xml | 24 +++++++++++++++++++ addons/crm/views/crm_lead_views.xml | 14 ++++++++--- addons/event/views/event_event_views.xml | 20 ++++++++++++++++ .../fleet/views/fleet_vehicle_cost_views.xml | 6 ++--- addons/fleet/views/fleet_vehicle_views.xml | 4 ++-- addons/hr/views/hr_employee_views.xml | 4 ++-- .../hr_contract/views/hr_contract_views.xml | 4 ++-- addons/hr_expense/views/hr_expense_views.xml | 4 ++-- .../data/mail_activity_type_data.xml | 1 + addons/hr_holidays/models/hr_leave.py | 12 +++++++++- .../views/hr_leave_allocation_views.xml | 2 +- addons/hr_holidays/views/hr_leave_views.xml | 13 +++++----- .../views/hr_applicant_views.xml | 7 +++--- .../web/activity/activity_controller.scss | 12 ++-------- .../views/web/activity/activity_renderer.xml | 2 +- addons/mail/views/res_partner_views.xml | 4 ++-- .../maintenance/views/maintenance_views.xml | 21 ++++++++++++++++ addons/mrp/views/mrp_production_views.xml | 18 ++++++++++++++ .../product/views/product_template_views.xml | 4 ++-- addons/product/views/product_views.xml | 4 ++-- .../project_task_state_selection.js | 4 ++-- .../project_task_state_selection.xml | 10 ++++---- addons/project/static/src/css/project.css | 4 ++++ .../project/views/project_project_views.xml | 15 ++++++++++++ addons/project/views/project_task_views.xml | 22 +++++++++-------- .../project_todo/views/project_task_views.xml | 2 +- addons/purchase/views/purchase_views.xml | 18 ++++++++++---- addons/repair/views/repair_views.xml | 19 +++++++++++++++ addons/sale/views/sale_order_views.xml | 18 ++++++++++---- addons/stock/views/stock_picking_views.xml | 15 ++++++++++++ addons/survey/views/survey_survey_views.xml | 18 ++++++++++++++ 31 files changed, 256 insertions(+), 69 deletions(-) diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml index f58f47797a4..e2400c3cf88 100644 --- a/addons/account/views/account_move_views.xml +++ b/addons/account/views/account_move_views.xml @@ -1286,6 +1286,30 @@ + + account.move.view.activity + account.move + + + + +
+
+ +
+ +
+
+ +
+ +
+
+ + +
+ + account.move.select account.move diff --git a/addons/crm/views/crm_lead_views.xml b/addons/crm/views/crm_lead_views.xml index bca2e13778b..6dbd85964d1 100644 --- a/addons/crm/views/crm_lead_views.xml +++ b/addons/crm/views/crm_lead_views.xml @@ -513,9 +513,17 @@
-
- - +
+
+ +
+ +
+
+ +
+ +
diff --git a/addons/event/views/event_event_views.xml b/addons/event/views/event_event_views.xml index 1a8d0a2b45f..332bd852f72 100644 --- a/addons/event/views/event_event_views.xml +++ b/addons/event/views/event_event_views.xml @@ -158,6 +158,26 @@ + + event.event.view.activity + event.event + + + +
+ +
+ + + + +
+
+
+
+
+
+ event.event.form.quick_create event.event diff --git a/addons/fleet/views/fleet_vehicle_cost_views.xml b/addons/fleet/views/fleet_vehicle_cost_views.xml index 056c1e382b9..7c33302188c 100644 --- a/addons/fleet/views/fleet_vehicle_cost_views.xml +++ b/addons/fleet/views/fleet_vehicle_cost_views.xml @@ -179,7 +179,7 @@
- +
@@ -356,8 +356,8 @@
- - + +
diff --git a/addons/fleet/views/fleet_vehicle_views.xml b/addons/fleet/views/fleet_vehicle_views.xml index 84d94c60811..a736ea658d7 100644 --- a/addons/fleet/views/fleet_vehicle_views.xml +++ b/addons/fleet/views/fleet_vehicle_views.xml @@ -338,8 +338,8 @@
- - + +
diff --git a/addons/hr/views/hr_employee_views.xml b/addons/hr/views/hr_employee_views.xml index 7a61d658452..4978fd1a009 100644 --- a/addons/hr/views/hr_employee_views.xml +++ b/addons/hr/views/hr_employee_views.xml @@ -331,8 +331,8 @@
- - + +
diff --git a/addons/hr_contract/views/hr_contract_views.xml b/addons/hr_contract/views/hr_contract_views.xml index dc09d32485a..9ee2d1cdcd9 100644 --- a/addons/hr_contract/views/hr_contract_views.xml +++ b/addons/hr_contract/views/hr_contract_views.xml @@ -355,8 +355,8 @@
- - + +
diff --git a/addons/hr_expense/views/hr_expense_views.xml b/addons/hr_expense/views/hr_expense_views.xml index b6e841338b4..f8747a39284 100644 --- a/addons/hr_expense/views/hr_expense_views.xml +++ b/addons/hr_expense/views/hr_expense_views.xml @@ -396,7 +396,7 @@
- +
@@ -1025,7 +1025,7 @@
- +
diff --git a/addons/hr_holidays/data/mail_activity_type_data.xml b/addons/hr_holidays/data/mail_activity_type_data.xml index 19858334853..89a5d483f35 100644 --- a/addons/hr_holidays/data/mail_activity_type_data.xml +++ b/addons/hr_holidays/data/mail_activity_type_data.xml @@ -6,6 +6,7 @@ Time Off Approval fa-sun-o hr.leave + 15 Time Off Second Approve diff --git a/addons/hr_holidays/models/hr_leave.py b/addons/hr_holidays/models/hr_leave.py index a525720fa84..a62173d7dd8 100644 --- a/addons/hr_holidays/models/hr_leave.py +++ b/addons/hr_holidays/models/hr_leave.py @@ -9,6 +9,7 @@ import pytz from collections import namedtuple, defaultdict from datetime import datetime, timedelta, time +from dateutil.relativedelta import relativedelta from pytz import timezone, UTC from odoo.addons.base.models.ir_model import MODULE_UNINSTALL_FLAG @@ -1460,10 +1461,19 @@ class HolidaysRequest(models.Model): elif holiday.state == 'confirm': if holiday.holiday_status_id.leave_validation_type != 'no_validation': user_ids = holiday.sudo()._get_responsible_for_approval().ids or self.env.user.ids + today = fields.Date.today() + activity_type = self.env.ref('hr_holidays.mail_act_leave_approval') for user_id in user_ids: + date_deadline = ( + (holiday.date_from - + relativedelta(**{activity_type.delay_unit: activity_type.delay_count or 0})).date() + if holiday.date_from else today) + if date_deadline < today: + date_deadline = today activity_vals.append({ - 'activity_type_id': self.env.ref('hr_holidays.mail_act_leave_approval').id, + 'activity_type_id': activity_type.id, 'automated': True, + 'date_deadline': date_deadline, 'note': note, 'user_id': user_id, 'res_id': holiday.id, diff --git a/addons/hr_holidays/views/hr_leave_allocation_views.xml b/addons/hr_holidays/views/hr_leave_allocation_views.xml index 38853ca7e34..34ddcdbcc3b 100644 --- a/addons/hr_holidays/views/hr_leave_allocation_views.xml +++ b/addons/hr_holidays/views/hr_leave_allocation_views.xml @@ -431,7 +431,7 @@
- ( days) + ( days)
diff --git a/addons/hr_holidays/views/hr_leave_views.xml b/addons/hr_holidays/views/hr_leave_views.xml index 4398b0169dd..88d7bab74c2 100644 --- a/addons/hr_holidays/views/hr_leave_views.xml +++ b/addons/hr_holidays/views/hr_leave_views.xml @@ -184,15 +184,16 @@ - - -
- -
- ( days) + +
+
+ +
( days)
+
+
diff --git a/addons/hr_recruitment/views/hr_applicant_views.xml b/addons/hr_recruitment/views/hr_applicant_views.xml index d38b90fa788..c871581e0b6 100644 --- a/addons/hr_recruitment/views/hr_applicant_views.xml +++ b/addons/hr_recruitment/views/hr_applicant_views.xml @@ -407,9 +407,10 @@
-
- - + +
+ +
diff --git a/addons/mail/static/src/views/web/activity/activity_controller.scss b/addons/mail/static/src/views/web/activity/activity_controller.scss index 60efe2bc746..b75cf15dca0 100644 --- a/addons/mail/static/src/views/web/activity/activity_controller.scss +++ b/addons/mail/static/src/views/web/activity/activity_controller.scss @@ -90,20 +90,12 @@ font-size: large; } - > div { - max-width: 200px; - - .o_text_block { - @include o-text-overflow; - display: block; - } - } - .o_text_bold { - font-weight: bold; + font-weight: $font-weight-bold; } .o_text_block { + @include o-text-overflow($max-width: 15rem); display: block; } } diff --git a/addons/mail/static/src/views/web/activity/activity_renderer.xml b/addons/mail/static/src/views/web/activity/activity_renderer.xml index 6a6e64ed554..1c9ec4786cc 100644 --- a/addons/mail/static/src/views/web/activity/activity_renderer.xml +++ b/addons/mail/static/src/views/web/activity/activity_renderer.xml @@ -100,7 +100,7 @@ - + Schedule activity diff --git a/addons/mail/views/res_partner_views.xml b/addons/mail/views/res_partner_views.xml index 50ce11019bc..9a531c8cf64 100644 --- a/addons/mail/views/res_partner_views.xml +++ b/addons/mail/views/res_partner_views.xml @@ -81,8 +81,8 @@
- - + +
diff --git a/addons/maintenance/views/maintenance_views.xml b/addons/maintenance/views/maintenance_views.xml index 8ebb94a64e7..8b4136c139f 100644 --- a/addons/maintenance/views/maintenance_views.xml +++ b/addons/maintenance/views/maintenance_views.xml @@ -52,6 +52,27 @@ + + maintenance.request.view.activity + maintenance.request + + + + +
+ +
+
+ +
+ +
+
+
+
+
+
+ equipment.request.form maintenance.request diff --git a/addons/mrp/views/mrp_production_views.xml b/addons/mrp/views/mrp_production_views.xml index de8769366c1..9367bef5bf9 100644 --- a/addons/mrp/views/mrp_production_views.xml +++ b/addons/mrp/views/mrp_production_views.xml @@ -19,6 +19,24 @@ fullscreen + + mrp.production.view.activity + mrp.production + + + +
+ +
+ + +
+
+
+
+
+
+ mrp.production.tree mrp.production diff --git a/addons/product/views/product_template_views.xml b/addons/product/views/product_template_views.xml index f154b45449e..50a8ab5e877 100644 --- a/addons/product/views/product_template_views.xml +++ b/addons/product/views/product_template_views.xml @@ -131,8 +131,8 @@
- -
+ +
[]
diff --git a/addons/product/views/product_views.xml b/addons/product/views/product_views.xml index 43ecf8a1809..cb51ad41da3 100644 --- a/addons/product/views/product_views.xml +++ b/addons/product/views/product_views.xml @@ -483,8 +483,8 @@
- -
+ +
[]
diff --git a/addons/project/static/src/components/project_task_state_selection/project_task_state_selection.js b/addons/project/static/src/components/project_task_state_selection/project_task_state_selection.js index f04570d5c37..c7ed3ef40de 100644 --- a/addons/project/static/src/components/project_task_state_selection/project_task_state_selection.js +++ b/addons/project/static/src/components/project_task_state_selection/project_task_state_selection.js @@ -131,14 +131,14 @@ export class ProjectTaskStateSelection extends StateSelectionField { } getDropdownPosition() { - if (this.isView(['kanban', 'list', 'calendar']) || this.env.isSmall) { + if (this.isView(['activity', 'kanban', 'list', 'calendar']) || this.env.isSmall) { return ''; } return 'bottom-end'; } getTogglerClass(currentValue) { - if (this.isView(['kanban', 'list', 'calendar']) || this.env.isSmall) { + if (this.isView(['activity', 'kanban', 'list', 'calendar']) || this.env.isSmall) { return 'btn btn-link d-flex p-0'; } return 'o_state_button btn rounded-pill ' + this.colorButton[currentValue]; diff --git a/addons/project/static/src/components/project_task_state_selection/project_task_state_selection.xml b/addons/project/static/src/components/project_task_state_selection/project_task_state_selection.xml index 4dcd2bcdbff..b04e70db622 100644 --- a/addons/project/static/src/components/project_task_state_selection/project_task_state_selection.xml +++ b/addons/project/static/src/components/project_task_state_selection/project_task_state_selection.xml @@ -13,7 +13,7 @@ - + @@ -22,13 +22,13 @@ -