[FIX] printing_auto_base: use odoo_test_helper

This commit is contained in:
Jacques-Etienne Baudoux
2024-12-06 15:40:43 +01:00
parent 221d2f8e6b
commit 98218b0462
3 changed files with 14 additions and 26 deletions

View File

@@ -1,28 +1,9 @@
# Copyright 2023 Camptocamp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import fields, models
def setup_test_model(env, model_cls):
"""Pass a test model class and initialize it.
Courtesy of SBidoul from https://github.com/OCA/mis-builder :)
"""
model_cls._build_model(env.registry, env.cr)
env.registry.setup_models(env.cr)
env.registry.init_models(
env.cr, [model_cls._name], dict(env.context, update_custom_fields=True)
)
def teardown_test_model(env, model_cls):
"""Pass a test model class and deinitialize it.
Courtesy of SBidoul from https://github.com/OCA/mis-builder :)
"""
if not getattr(model_cls, "_teardown_no_delete", False):
del env.registry.models[model_cls._name]
env.registry.setup_models(env.cr)
class PrintingAutoTesterChild(models.Model):
_name = "printingauto.tester.child"