Skip to content

Conversation

@etobella
Copy link
Member

@etobella etobella commented Dec 1, 2025

Otherwise, an error might be rise if we have hr_holidays_natural_period installed because the option might have not been selected yet.

@etobella
Copy link
Member Author

@MiquelRForgeFlow May I ask for your opinion? 🙏

@MiquelRForgeFlow
Copy link
Contributor

Hehe An alternative should be adding migration scripts in hr_holidays_natural_period, by recomputing those fields...

@etobella
Copy link
Member Author

The problem is that the compute is failing because it has a value that doesn't exist yet

Copy link
Contributor

@MiquelRForgeFlow MiquelRForgeFlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pedrobaeza pedrobaeza added this to the 17.0 milestone Dec 10, 2025
@pedrobaeza pedrobaeza changed the title [OU-IMP]hr: Add computation of some fields [17.0][OU-IMP]hr: Add computation of some fields Dec 10, 2025
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern on this is the increase of time on the execution, or to have different data in past leaves. Why are you recomputing the duration? Remember that you may adjust manually the duration. I don't think it should be recomputed.

@etobella
Copy link
Member Author

After a full review of the error I found that the problem comes from the fact that number_of_hours was not stored in v16, but stored in v17. If we don't apply something, the function is executed no matter what, and it might raise errors if we have other modules like natural_days.

Options I see:

  • Create the field and leave it blank (reexecute only for the leaves needed?)
  • Reexecute for everyone as we did it before but on the end-migration, to ensure that other changes will work.

Leaving as it is will not work if you are using an OCA module and there is no natural way to solve it.

@pedrobaeza
Copy link
Member

I agree on pre-adding the field, but we shouldn't trigger the regular computation, as that one computes both number_of_days and number_of_hours, overwriting manual changes done on number_of_days field.

@etobella
Copy link
Member Author

legit for me. I will manage it

@pedrobaeza
Copy link
Member

@etobella do you plan to add anything more?

@etobella
Copy link
Member Author

@pedrobaeza no, I think I made all the changes that you asked for.

hr_holidays / hr.leave / number_of_days (float) : now a function
hr_holidays / hr.leave / number_of_hours (float) : NEW isfunction: function, stored
# NOTHING TO DO: computed fields
# Pre-migration script and end-migration script to recompute
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Pre-migration script and end-migration script to recompute
# DONE: pre-migration: add column for avoiding the computation

@pedrobaeza pedrobaeza merged commit 78e3767 into OCA:17.0 Dec 12, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants