From af42d25d4bfbab92a89e63d97ec28175de0fe9d8 Mon Sep 17 00:00:00 2001 From: User Date: Wed, 11 Aug 2021 07:54:52 +0000 Subject: [PATCH] [MIG] base_report_to_printer_mail: Migration to 14.0 --- base_report_to_printer_mail/__manifest__.py | 2 +- .../tests/test_mail.py | 36 +++++++++++++------ 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/base_report_to_printer_mail/__manifest__.py b/base_report_to_printer_mail/__manifest__.py index debffc2..c9a5f34 100644 --- a/base_report_to_printer_mail/__manifest__.py +++ b/base_report_to_printer_mail/__manifest__.py @@ -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", diff --git a/base_report_to_printer_mail/tests/test_mail.py b/base_report_to_printer_mail/tests/test_mail.py index c8bf45e..37b1ea1 100644 --- a/base_report_to_printer_mail/tests/test_mail.py +++ b/base_report_to_printer_mail/tests/test_mail.py @@ -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" -@common.at_install(False) -@common.post_install(True) -class TestMail(common.HttpCase): +class TestMail(HttpCase): + at_install = False + post_install = True + def setUp(self): super(TestMail, self).setUp() self.Model = self.env["ir.model"] @@ -23,11 +26,12 @@ class TestMail(common.HttpCase): { "name": "Test", "type": "qweb", - "xml_id": "base_report_to_printer.test", + "xml_id": test_xml_id, "model_data_id": self.report_imd.id, - "arch": """ + "arch": """
Test
-
""", +
""" + % test_xml_id, } ) self.report_imd.res_id = self.report_view.id @@ -36,7 +40,7 @@ class TestMail(common.HttpCase): "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 @@ class TestMail(common.HttpCase): 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()