Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[14 -> 15] HR leave error #3714

Closed
BastienDurel opened this issue Feb 8, 2023 · 2 comments
Closed

[14 -> 15] HR leave error #3714

BastienDurel opened this issue Feb 8, 2023 · 2 comments
Labels

Comments

@BastienDurel
Copy link

When trying to migrate a v14 Db to v15, it fails during hr_holidays handling.

Module

hr_holidays

2023-02-08 17:08:00,004 30571 INFO DATA odoo.modules.loading: Loading module hr_holidays (33/63) 
2023-02-08 17:08:00,173 30571 INFO DATA odoo.modules.registry: module hr_holidays: creating or updating database tables 
2023-02-08 17:08:00,328 30571 INFO DATA odoo.models: Storing computed values of hr.leave.holiday_allocation_id 
2023-02-08 17:08:00,329 30571 INFO DATA odoo.models: Storing computed values of hr.leave.employee_company_id 
2023-02-08 17:08:00,329 30571 INFO DATA odoo.models: Storing computed values of hr.leave.employee_ids 
2023-02-08 17:08:00,329 30571 INFO DATA odoo.models: Storing computed values of hr.leave.multi_employee 
2023-02-08 17:08:00,331 30571 INFO DATA odoo.models: Storing computed values of hr.leave.allocation.employee_company_id 
2023-02-08 17:08:00,331 30571 INFO DATA odoo.models: Storing computed values of hr.leave.allocation.employee_ids 
2023-02-08 17:08:00,331 30571 INFO DATA odoo.models: Storing computed values of hr.leave.allocation.multi_employee 
2023-02-08 17:08:00,331 30571 INFO DATA odoo.models: Storing computed values of hr.leave.allocation.accrual_plan_id 
2023-02-08 17:08:00,459 30571 WARNING DATA odoo.modules.loading: Transient module states were reset 
2023-02-08 17:08:00,460 30571 ERROR DATA odoo.modules.registry: Failed to load registry 
2023-02-08 17:08:00,460 30571 CRITICAL DATA odoo.service.server: Failed to initialize database `DATA`. 
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/service/server.py", line 1260, in preload_registries
    registry = Registry.new(dbname, update_module=update_module)
  File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 87, in new
    odoo.modules.load_modules(registry, force_demo, status, update_module)
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 472, in load_modules
    force, status, report, loaded_modules, update_module, models_to_check)
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 365, in load_marked_modules
    perform_checks=perform_checks, models_to_check=models_to_check
  File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 199, in load_module_graph
    registry.init_models(cr, model_names, {'module': package.name}, new_install)
  File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 445, in init_models
    env['base'].flush()
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 5658, in flush
    self.recompute()
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 6131, in recompute
    process(field)
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 6115, in process
    field.recompute(recs)
  File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1247, in recompute
    self.compute_value(recs)
  File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1269, in compute_value
    records._compute_field_value(self)
  File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 411, in _compute_field_value
    return super()._compute_field_value(field)
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 4271, in _compute_field_value
    self.filtered('id')._validate_fields(fnames)
  File "/usr/lib/python3/dist-packages/odoo/models.py", line 1367, in _validate_fields
    check(self)
  File "/usr/lib/python3/dist-packages/odoo/addons/hr_holidays/models/hr_leave.py", line 718, in _check_date_state
    raise ValidationError(_("This modification is not allowed in the current state."))
odoo.exceptions.ValidationError: Cette modification n'est pas autorisée dans l'état actuel.
2023-02-08 17:08:00,462 30571 INFO DATA odoo.service.server: Initiating shutdown 
2023-02-08 17:08:00,462 30571 INFO DATA odoo.service.server: Hit CTRL-C again or send a second signal to force the shutdown. 
2023-02-08 17:08:00,462 30571 INFO DATA odoo.sql_db: ConnectionPool(used=0/count=0/max=64): Closed 1 connections  

The affected record is this one :

 id |   name   |  state   | payslip_status | report_note | user_id |      date_from      |       date_to       | holiday_status_id | employee_id | manager_id | notes | number_of_days | openupgrade_legacy_12_0_number_of_days | meeting_id | openupgrade_legacy_12_0_type | parent_id | department_id | category_id | holiday_type | first_approver_id | second_approver_id | message_last_post | create_uid |        create_date         | write_uid |         write_date         
----+----------+----------+----------------+-------------+---------+---------------------+---------------------+-------------------+-------------+------------+-------+----------------+----------------------------------------+------------+------------------------------+-----------+---------------+-------------+--------------+-------------------+--------------------+-------------------+------------+----------------------------+-----------+----------------------------
 13 | vacances | validate | f              |             |       7 | 2018-07-22 22:00:00 | 2018-08-10 21:55:55 |                 1 |           3 |          2 |       |             15 |                                    -15 |          6 | remove     

It is, indeed, in validate mode, which is one of the state that triggers this error (to prevent date change, I guess)

I guess the migration script should not try to change dates of past leaves ? (I don´t know if it tries to)

Environment

  • Debian 10
  • Python 3.7.3
  • Odoo 15.0.20230208
  • Postgresql 11.18
@pedrobaeza
Copy link
Member

That's normal, as the module is not yet covered. #3336

@BastienDurel
Copy link
Author

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants