Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0][MIG] base_report_to_printer_mail: Migration to 16.0 #333

Merged
Merged
Prev Previous commit
Next Next commit
[MIG] base_report_to_printer_mail: Migration to 14.0
pablo-lp authored and duongtq committed Jul 13, 2023
commit e724a4d0d8306f8f0079bfcf8de25e60270e101d
2 changes: 1 addition & 1 deletion base_report_to_printer_mail/__manifest__.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

{
"name": "Report to printer - Mail extension",
"version": "13.0.1.0.0",
"version": "14.0.1.0.0",
"category": "Generic Modules/Base",
"author": "DynApps NV, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/report-print-send",
36 changes: 26 additions & 10 deletions base_report_to_printer_mail/tests/test_mail.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

import mock
from unittest import mock

from odoo.tests import common
from odoo.tests.common import HttpCase

test_xml_id = "base_report_to_printer.test"


class TestMail(HttpCase):
at_install = False
post_install = True

@common.at_install(False)
@common.post_install(True)
class TestMail(common.HttpCase):
def setUp(self):
super(TestMail, self).setUp()
self.Model = self.env["ir.model"]
@@ -23,11 +26,12 @@ def setUp(self):
{
"name": "Test",
"type": "qweb",
"xml_id": "base_report_to_printer.test",
"xml_id": test_xml_id,
"model_data_id": self.report_imd.id,
"arch": """<t t-name="base_report_to_printer.test">
"arch": """<t t-name="%s">
<div>Test</div>
</t>""",
</t>"""
% test_xml_id,
}
)
self.report_imd.res_id = self.report_view.id
@@ -36,7 +40,7 @@ def setUp(self):
"name": "Test",
"report_type": "qweb-pdf",
"model": "res.partner",
"report_name": "base_report_to_printer.test",
"report_name": test_xml_id,
}
)
self.test_partner = self.partner_obj.create(
@@ -77,12 +81,24 @@ def test_generate_email(self):
It should NOT print the report,
regardless of the defined behaviour
"""
self.assertEqual(self.report_view.xml_id, test_xml_id)
self.report.property_printing_action_id.action_type = "server"
self.report.printing_printer_id = self.new_printer()

with mock.patch(
"odoo.addons.base_report_to_printer.models."
"printing_printer.PrintingPrinter."
"print_document"
) as print_document:
self.email_template.generate_email(self.test_partner.id)
self.email_template.generate_email(
self.test_partner.id,
fields=[
"name",
"email_from",
"email_to",
"partner_to",
"subject",
"body_html",
],
)
print_document.assert_not_called()