Skip to content

Commit

Permalink
[18.0][FIX] web_pivot_computed_measure: fix fake fields in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kobros-tech committed Dec 24, 2024
1 parent 48dc591 commit 2c27331
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 19 deletions.
4 changes: 4 additions & 0 deletions web_pivot_computed_measure/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ Contributors
- Ernesto Tejeda
- Carlos Roca

- `Kencove <https://www.kencove.com/>`__:

- Mohamed Alkobrosli

Maintainers
-----------

Expand Down
4 changes: 4 additions & 0 deletions web_pivot_computed_measure/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@
- Pedro M. Baeza
- Ernesto Tejeda
- Carlos Roca

- [Kencove](https://www.kencove.com/):
- Mohamed Alkobrosli

4 changes: 4 additions & 0 deletions web_pivot_computed_measure/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,10 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<li>Carlos Roca</li>
</ul>
</li>
<li><a class="reference external" href="https://www.kencove.com/">Kencove</a>:<ul>
<li>Mohamed Alkobrosli</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
12 changes: 0 additions & 12 deletions web_pivot_computed_measure/tests/res_users_fake.py

This file was deleted.

36 changes: 29 additions & 7 deletions web_pivot_computed_measure/tests/test_ui_pivot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Copyright 2022 Tecnativa - Carlos Roca
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html)
from odoo_test_helper import FakeModelLoader

from odoo.tests import common, tagged

Expand All @@ -10,18 +9,41 @@ class TestUIPivot(common.HttpCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.loader = FakeModelLoader(cls.env, cls.__module__)
cls.loader.backup_registry()
from .res_users_fake import ResUsersFake

cls.loader.update_registry((ResUsersFake,))
res_users_model_id = (
cls.env["ir.model"].search([("model", "=", "res.users")]).id
)
cls.env["ir.model.fields"].create(
{
"name": "x_user_year_born",
"model": "res.users",
"field_description": "Year Born",
"ttype": "integer",
"store": False,
"model_id": res_users_model_id,
}
)
cls.env["ir.model.fields"].create(
{
"name": "x_user_year_now",
"model": "res.users",
"field_description": "Year Born",
"ttype": "integer",
"store": False,
"model_id": res_users_model_id,
}
)
cls.env.registry.setup_models(cls.env.cr)
cls.env.registry.init_models(
cls.env.cr, ["res.users"], {"update_custom_fields": True}
)
cls.env["res.users"].create(
{
"name": "User 1",
"login": "us_1",
# Fake fields
"user_year_born": 1998,
"user_year_now": 2022,
"x_user_year_born": 1998,
"x_user_year_now": 2022,
}
)
# Set pivot view to company action
Expand Down

0 comments on commit 2c27331

Please sign in to comment.