-
-
Notifications
You must be signed in to change notification settings - Fork 868
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
partner_identification: fix/imp tests on res.partner
- Loading branch information
Showing
11 changed files
with
81 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
# -*- coding: utf-8 -*- | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import models |
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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
# -*- coding: utf-8 -*- | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import res_partner_id_number | ||
from . import res_partner_id_category | ||
from . import res_partner |
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
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 |
---|---|---|
@@ -1,5 +1,2 @@ | ||
# -*- coding: utf-8 -*- | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from . import test_partner_identification | ||
from . import test_res_partner |
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,47 @@ | ||
# Copyright 2017 LasLabs Inc. | ||
# Copyright 2018 ACSONE | ||
# Copyright 2018 Camptocamp | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). | ||
|
||
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 ResPartner(models.Model): | ||
_name = 'res.partner' | ||
_inherit = 'res.partner' | ||
_teardown_no_delete = True | ||
|
||
social_security = fields.Char( | ||
compute=lambda s: s._compute_identification( | ||
'social_security', 'SSN', | ||
), | ||
inverse=lambda s: s._inverse_identification( | ||
'social_security', 'SSN', | ||
), | ||
search=lambda s, *a: s._search_identification( | ||
'SSN', *a | ||
), | ||
) |
19 changes: 13 additions & 6 deletions
19
partner_identification/tests/test_partner_identification.py
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