From 3931e4ef79dc60198aea5534f7d1ae8006adb012 Mon Sep 17 00:00:00 2001 From: utag-odoo Date: Thu, 18 May 2023 11:18:14 +0000 Subject: [PATCH] [FIX] hr_work_entry_contract: traceback issue during work entry regeneration In this commit, 1. Adding a safeguard to ensure date_from is not empty before calculating the time delta in the wizard.date_to. 2. Both classes disabled="1" and disabled="true" are not working so we add a disabled class on the button. I don't know why disabled="1" is not working. task-3328601 closes odoo/odoo#123148 X-original-commit: 97b8d59a88e78afbeae1dc6447a3d9629635524f Signed-off-by: Kevin Baptiste --- .../wizard/hr_work_entry_regeneration_wizard.py | 2 +- .../wizard/hr_work_entry_regeneration_wizard_views.xml | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/addons/hr_work_entry_contract/wizard/hr_work_entry_regeneration_wizard.py b/addons/hr_work_entry_contract/wizard/hr_work_entry_regeneration_wizard.py index cc6928d15b1..62e48f7ff5d 100644 --- a/addons/hr_work_entry_contract/wizard/hr_work_entry_regeneration_wizard.py +++ b/addons/hr_work_entry_contract/wizard/hr_work_entry_regeneration_wizard.py @@ -26,7 +26,7 @@ class HrWorkEntryRegenerationWizard(models.TransientModel): @api.depends('date_from') def _compute_date_to(self): for wizard in self: - wizard.date_to = wizard.date_from + relativedelta(months=+1, day=1, days=-1) + wizard.date_to = wizard.date_from and wizard.date_from + relativedelta(months=+1, day=1, days=-1) @api.depends('employee_ids') def _compute_earliest_available_date(self): diff --git a/addons/hr_work_entry_contract/wizard/hr_work_entry_regeneration_wizard_views.xml b/addons/hr_work_entry_contract/wizard/hr_work_entry_regeneration_wizard_views.xml index 6540e6d71f8..7d76fc6aa2d 100644 --- a/addons/hr_work_entry_contract/wizard/hr_work_entry_regeneration_wizard_views.xml +++ b/addons/hr_work_entry_contract/wizard/hr_work_entry_regeneration_wizard_views.xml @@ -55,8 +55,7 @@ attrs="{'invisible': ['|', ('search_criteria_completed', '=', False), ('valid', '=', False)]}"/>