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

[IMP][16.0] Add hooks to account_invoice_pricelist #1511

Closed

Conversation

gdgellatly
Copy link

Before this change installing this module on a database with only a few million account_moves would take upwards of an hour. The vast majority of the installation time was taken by the newly enabled tracking on the pricelist_id field.

After this change we precreate the pricelist_id column and then post installation update only those moves required with tracking disabled.

@gdgellatly
Copy link
Author

Note: Leaving in Draft until I have a fresh migration to retest against.

Copy link
Member

@flotho flotho left a comment

Choose a reason for hiding this comment

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

code review LGTM

@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@gdgellatly
Copy link
Author

In testing with large data, the existing call to compute pricelist_id triggers the write method of account.move, which subsequently calls _sync_dynamic_lines. In this database, and presumably others, this causes a Readonly exception on posted moves. I have changed this PR, to purely populate pricelist_id and to do so via psql. In test, in database with around 7m account.moves installation took around 2-3 minutes.

@gdgellatly
Copy link
Author

I have now tested this with a load of production data successfully in a migration

@gdgellatly gdgellatly marked this pull request as ready for review September 22, 2023 04:34
@max3903 max3903 added this to the 16.0 milestone Sep 22, 2023
Copy link

@ACheung-FactorLibre ACheung-FactorLibre left a comment

Choose a reason for hiding this comment

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

Hi @gdgellatly, please squash your commits.
The changes made LGTM.

@gdgellatly
Copy link
Author

Hi @gdgellatly, please squash your commits. The changes made LGTM.

Do we not squash on merge?

@ACheung-FactorLibre
Copy link

Hi @gdgellatly,

Can you please rebase and merge?

Thank you

@gdgellatly
Copy link
Author

/ocabot rebase

@OCA-git-bot
Copy link
Contributor

Congratulations, PR rebased to 16.0.

@OCA-git-bot OCA-git-bot force-pushed the gdg-account_invoice_pricelist_hooks branch from 95e33e8 to 70926ee Compare August 30, 2024 04:43
@gdgellatly
Copy link
Author

Closing as on review, not multicompany safe and no time to correct.

@gdgellatly gdgellatly closed this Aug 30, 2024
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.

7 participants