Skip to content

[19.0][OU-FIX] hr_expense: Compute expense state by SQL - #5909

Open
pedrobaeza wants to merge 1 commit into
OCA:19.0from
Tecnativa:19.0-ou_fix-hr_expense
Open

[19.0][OU-FIX] hr_expense: Compute expense state by SQL#5909
pedrobaeza wants to merge 1 commit into
OCA:19.0from
Tecnativa:19.0-ou_fix-hr_expense

Conversation

@pedrobaeza

Copy link
Copy Markdown
Member

Doing it by ORM is not advised due to performance, but also because some business constraints can be triggered, like in this case _check_can_approve, provoking a crash in the migration.

There's also a problem in executing it in post-migration instead of end-migration: if the extra modules changing
_get_invoice_in_payment_state are not yet loaded, you won't get in_payment state, so the logic has been converted to SQL, and move to end-migration.

@Tecnativa TT61992

@pedrobaeza pedrobaeza added this to the 19.0 milestone Aug 13, 2026
@OCA-git-bot OCA-git-bot added mod:openupgrade_scripts Module openupgrade_scripts series:19.0 labels Aug 13, 2026
@pedrobaeza
pedrobaeza force-pushed the 19.0-ou_fix-hr_expense branch 3 times, most recently from 0fa5e50 to 22fffa3 Compare August 13, 2026 22:13
@pedrobaeza

pedrobaeza commented Aug 14, 2026

Copy link
Copy Markdown
Member Author

@hbrunn I have moved the script to end-migration, but the test is performed in post. Is there a way to perform the test at the end instead?

Doing it by ORM is not advised due to performance, but also because some
business constraints can be triggered, like in this case
`_check_can_approve`, provoking a crash in the migration.

There's also a problem in executing it in post-migration instead of
end-migration: if the extra modules changing
`_get_invoice_in_payment_state` are not yet loaded, you won't get
`in_payment` state, so the logic has been converted to SQL, and move to
end-migration.

TT61992
@pedrobaeza
pedrobaeza force-pushed the 19.0-ou_fix-hr_expense branch from 22fffa3 to 3cd9133 Compare August 14, 2026 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:openupgrade_scripts Module openupgrade_scripts series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants