Skip to content
New issue

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

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

Already on GitHub? # to your account

[13.0][OU-IMP] base: vacuum of transient models #4374

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

MiquelRForgeFlow
Copy link
Contributor

Selection_2936
Selection_2937

@MiquelRForgeFlow MiquelRForgeFlow added this to the 13.0 milestone Apr 4, 2024
@StefanRijnhart
Copy link
Member

For my curiousity, what problem does this solve?

@pedrobaeza
Copy link
Member

Hi @StefanRijnhart doing this, the same as enterprise migration scripts seems to be doing, we preventively avoid possible issues due to chained data. Imagine for example a many2one with ondelete="restrict" defined on a transient model, and you try to delete the linked record on your migration scripts.

@MiquelRForgeFlow I'm thinking that you should add specific code like this for assuring everything is deleted, as if not, there may be some row not older than 5 minutes:

    for mname in env:
        model = env[mname]
        if model.is_transient():
            try:
                with env._cr.savepoint():
                    model._transient_clean_rows_older_than(0)
                env._cr.commit()
            except Exception as e:
                _logger.warning("Failed to clean transient model %s\n%s", model, str(e))

This may be put in openupgradelib as a method clean_transient_models.

@MiquelRForgeFlow MiquelRForgeFlow force-pushed the 13.0-base-imp-autovacuum branch from c3d2098 to 94ceaac Compare April 5, 2024 10:44
@MiquelRForgeFlow
Copy link
Contributor Author

It's ok now?

@StefanRijnhart StefanRijnhart merged commit 3850ffc into OCA:13.0 Apr 5, 2024
3 checks passed
@MiquelRForgeFlow MiquelRForgeFlow deleted the 13.0-base-imp-autovacuum branch April 5, 2024 12:59
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants