[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 <kba@odoo.com>
This commit is contained in:
utag-odoo
2023-06-01 09:14:07 +02:00
parent 75ecaa48e6
commit 3931e4ef79
2 changed files with 2 additions and 3 deletions
@@ -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):
@@ -55,8 +55,7 @@
attrs="{'invisible': ['|', ('search_criteria_completed', '=', False), ('valid', '=', False)]}"/>
<button name="regenerate_work_entries_disabled"
string="Regenerate Work Entries"
class="btn btn-primary"
disabled="1"
class="btn btn-primary disabled"
attrs="{'invisible': [('search_criteria_completed', '=', True), ('valid', '=', True)]}"/>
<button name="cancel_button" string="Cancel" class="btn-secondary" special="cancel"/>
</footer>