Skip to content

Commit

Permalink
[FIX] mail_composer_cc_bcc: replace product.template with res.part in…
Browse files Browse the repository at this point in the history
… tests
  • Loading branch information
trisdoan committed Dec 10, 2024
1 parent 32b88f1 commit fb3e3d4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions mail_composer_cc_bcc/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ Contributors

* Hai N. Le <[email protected]>
* Son Ho <[email protected]>
* Tris Doan <[email protected]>

* `Therp BV <https://therp.nl>`_:

Expand Down
1 change: 1 addition & 0 deletions mail_composer_cc_bcc/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

* Hai N. Le <[email protected]>
* Son Ho <[email protected]>
* Tris Doan <[email protected]>

* `Therp BV <https://therp.nl>`_:

Expand Down
1 change: 1 addition & 0 deletions mail_composer_cc_bcc/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ <h1>Contributors</h1>
<ul class="simple">
<li>Hai N. Le &lt;<a class="reference external" href="mailto:hailn&#64;trobz.com">hailn&#64;trobz.com</a>&gt;</li>
<li>Son Ho &lt;<a class="reference external" href="mailto:sonhd&#64;trobz.com">sonhd&#64;trobz.com</a>&gt;</li>
<li>Tris Doan &lt;<a class="reference external" href="mailto:tridm&#64;trobz.com">tridm&#64;trobz.com</a>&gt;</li>
</ul>
</blockquote>
</li>
Expand Down
16 changes: 8 additions & 8 deletions mail_composer_cc_bcc/tests/test_mail_cc_bcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ def test_template_cc_bcc(self):
# Company default values
env.company.default_partner_cc_ids = self.partner_cc3
env.company.default_partner_bcc_ids = self.partner_cc2
# Product template values
tmpl_model = env["ir.model"].search([("model", "=", "product.template")])
# Partner template values
tmpl_model = env["ir.model"].search([("model", "=", "res.partner")])
partner_cc = self.partner_cc
partner_bcc = self.partner_bcc
vals = {
"name": "Product Template: Re: [E-COM11] Cabinet with Doors",
"name": "Test Template",
"model_id": tmpl_model.id,
"subject": "Re: [E-COM11] Cabinet with Doors",
"body_html": """<p style="margin:0px 0 12px 0;box-sizing:border-box;">
Expand All @@ -106,18 +106,18 @@ def test_template_cc_bcc(self):
(partner_bcc.name or "False", partner_bcc.email or "False")
),
}
prod_tmpl = env["mail.template"].create(vals)
partner_tmpl = env["mail.template"].create(vals)
# Open mail composer form and check for default values from company
form = self.open_mail_composer_form()
composer = form.save()
self.assertEqual(composer.partner_cc_ids, self.partner_cc3)
self.assertEqual(composer.partner_bcc_ids, self.partner_cc2)
# Change email template and check for values from it
form.template_id = prod_tmpl
form.template_id = partner_tmpl
composer = form.save()
# Beside existing Cc and Bcc, add template's ones
form = Form(composer)
form.template_id = prod_tmpl
form.template_id = partner_tmpl
composer = form.save()
expecting = self.partner_cc3 + self.partner_cc
self.assertEqual(composer.partner_cc_ids, expecting)
Expand All @@ -131,8 +131,8 @@ def test_template_cc_bcc(self):
form = Form(composer)
form.template_id = env["mail.template"]
form.save()
self.assertFalse(form.template_id)
form.template_id = prod_tmpl
self.assertFalse(form.template_id) # no template
form.template_id = partner_tmpl
composer = form.save()
expecting = self.partner_cc3 + self.partner_cc
self.assertEqual(composer.partner_cc_ids, expecting)
Expand Down

0 comments on commit fb3e3d4

Please sign in to comment.