Browse Source

[FIX] base_comment_template: Fix tests: test_company_general_template

myc-14.0-py3o
Víctor Martínez 4 years ago
parent
commit
39d1a89ce5
  1. 1
      base_comment_template/readme/CONTRIBUTORS.rst
  2. 9
      base_comment_template/tests/test_base_comment_template.py

1
base_comment_template/readme/CONTRIBUTORS.rst

@ -19,3 +19,4 @@
* `Tecnativa <https://www.tecnativa.com>`_: * `Tecnativa <https://www.tecnativa.com>`_:
* Carlos Roca * Carlos Roca
* Víctor Martínez

9
base_comment_template/tests/test_base_comment_template.py

@ -1,4 +1,5 @@
# Copyright 2020 NextERP Romania SRL # Copyright 2020 NextERP Romania SRL
# Copyright 2021 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from lxml import etree from lxml import etree
@ -15,19 +16,20 @@ class TestCommentTemplate(common.SavepointCase):
def setUpClass(cls): def setUpClass(cls):
super().setUpClass() super().setUpClass()
setup_test_model(cls.env, ResUsers) setup_test_model(cls.env, ResUsers)
cls.user_obj = cls.env["ir.model"].search([("model", "=", "res.users")])
cls.user_obj = cls.env.ref("base.model_res_users")
cls.user = cls.env.ref("base.user_demo") cls.user = cls.env.ref("base.user_demo")
cls.user2 = cls.env.ref("base.demo_user0") cls.user2 = cls.env.ref("base.demo_user0")
cls.partner_id = cls.env.ref("base.res_partner_12") cls.partner_id = cls.env.ref("base.res_partner_12")
cls.partner2_id = cls.env.ref("base.res_partner_10") cls.partner2_id = cls.env.ref("base.res_partner_10")
cls.company = cls.env["res.company"].search([], limit=1)
cls.main_company = cls.env.ref("base.main_company")
cls.company = cls.env["res.company"].create({"name": "Test company"})
cls.before_template_id = cls.env["base.comment.template"].create( cls.before_template_id = cls.env["base.comment.template"].create(
{ {
"name": "before_lines", "name": "before_lines",
"text": "Text before lines", "text": "Text before lines",
"model_ids": [(6, 0, cls.user_obj.ids)], "model_ids": [(6, 0, cls.user_obj.ids)],
"priority": 5, "priority": 5,
"company_id": cls.main_company.id,
} }
) )
cls.after_template_id = cls.env["base.comment.template"].create( cls.after_template_id = cls.env["base.comment.template"].create(
@ -37,6 +39,7 @@ class TestCommentTemplate(common.SavepointCase):
"text": "Text after lines", "text": "Text after lines",
"model_ids": [(6, 0, cls.user_obj.ids)], "model_ids": [(6, 0, cls.user_obj.ids)],
"priority": 6, "priority": 6,
"company_id": cls.main_company.id,
} }
) )

Loading…
Cancel
Save