From b8930766304e952df9ec89a3fbd9510af6d3be46 Mon Sep 17 00:00:00 2001 From: Wolfgang Pichler Date: Mon, 6 Jan 2025 09:37:51 +0100 Subject: [PATCH] [MIG] base_report_to_printer_mail: Migration to 18.0 --- base_report_to_printer_mail/models/mail_template.py | 8 ++++++-- base_report_to_printer_mail/tests/test_mail.py | 8 ++++---- .../test-requirements.txt => test-requirements.txt | 2 +- 3 files changed, 11 insertions(+), 7 deletions(-) rename base_report_to_printer_mail/test-requirements.txt => test-requirements.txt (91%) diff --git a/base_report_to_printer_mail/models/mail_template.py b/base_report_to_printer_mail/models/mail_template.py index 0a8f13a00c0..8e53b5d8b84 100644 --- a/base_report_to_printer_mail/models/mail_template.py +++ b/base_report_to_printer_mail/models/mail_template.py @@ -4,7 +4,11 @@ class MailTemplate(models.Model): _inherit = "mail.template" - def generate_email(self, res_ids, fields=None): + def _generate_template(self, res_ids, render_fields, find_or_create_partners=False): return super( MailTemplate, self.with_context(must_skip_send_to_printer=True) - ).generate_email(res_ids, fields=fields) + )._generate_template( + res_ids, + render_fields=render_fields, + find_or_create_partners=find_or_create_partners, + ) diff --git a/base_report_to_printer_mail/tests/test_mail.py b/base_report_to_printer_mail/tests/test_mail.py index e5dd65cff18..f474b78cfdb 100644 --- a/base_report_to_printer_mail/tests/test_mail.py +++ b/base_report_to_printer_mail/tests/test_mail.py @@ -56,7 +56,7 @@ def setUp(self): "body_html": "

Dear ${object.name}, " "your parent is ${object.parent_id and " 'object.parent_id.name or "False"}

', - "report_template": self.report.id, + "report_template_ids": [(4, self.report.id)], } ) @@ -89,9 +89,9 @@ def test_generate_email(self): "printing_printer.PrintingPrinter." "print_document" ) as print_document: - self.email_template.generate_email( - self.test_partner.id, - fields=[ + self.email_template._generate_template( + [self.test_partner.id], + render_fields=[ "name", "email_from", "email_to", diff --git a/base_report_to_printer_mail/test-requirements.txt b/test-requirements.txt similarity index 91% rename from base_report_to_printer_mail/test-requirements.txt rename to test-requirements.txt index 74a62cf04fb..f16443dbd9a 100644 --- a/base_report_to_printer_mail/test-requirements.txt +++ b/test-requirements.txt @@ -1 +1 @@ -odoo-addon-base_report_to_printer @ git+https://github.com/OCA/report-print-send.git@refs/pull/371/head#subdirectory=base_report_to_printer \ No newline at end of file +odoo-addon-base_report_to_printer @ git+https://github.com/OCA/report-print-send.git@refs/pull/371/head#subdirectory=base_report_to_printer