-
-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] printing_auto_base: don't print twice
Fix same record printed multiple times
- Loading branch information
Showing
4 changed files
with
111 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
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" | ||
|
||
name = fields.Char() | ||
|
||
|
||
class PrintingAutoTester(models.Model): | ||
_name = "printingauto.tester" | ||
_inherit = "printing.auto.mixin" | ||
|
||
name = fields.Char() | ||
child_ids = fields.Many2many("printingauto.tester.child") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters