-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIG] mail_composer_cc_bcc_account: Migration to 18.0
- Loading branch information
Showing
10 changed files
with
150 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
The creation and migration from 16.0 to 17.0 of this module were | ||
financially supported by Camptocamp. | ||
The creation and migration of this module from 16.0 to 17.0, and then 17.0 to 18.0 were financially supported by Camptocamp. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,38 @@ | ||
# Copyright 2023 Camptocamp | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
from datetime import date | ||
|
||
from odoo.tests import Form | ||
from odoo.addons.account.tests.test_account_move_send import TestAccountMoveSendCommon | ||
from odoo.addons.mail.tests.common import MailCommon | ||
|
||
from odoo.addons.mail_composer_cc_bcc.tests.test_mail_cc_bcc import TestMailCcBcc | ||
|
||
class TestMailCcBccInvoice(TestAccountMoveSendCommon, MailCommon): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
env = cls.env | ||
cls.partner = env.ref("base.res_partner_address_31") | ||
cls.partner_cc = env.ref("base.partner_demo") | ||
cls.partner_bcc = env.ref("base.res_partner_main2") | ||
|
||
class TestMailCcBccInvoice(TestMailCcBcc): | ||
def open_invoice_mail_composer_form(self): | ||
# Use form to populate data | ||
# init invoice data | ||
self.test_invoice = test_record = self.test_account_move = self.env[ | ||
"account.move" | ||
].create( | ||
{ | ||
"invoice_date": date(2024, 3, 2), | ||
"invoice_date_due": date(2024, 3, 10), | ||
"invoice_line_ids": [ | ||
(0, 0, {"name": "Line1", "price_unit": 100.0}), | ||
(0, 0, {"name": "Line2", "price_unit": 200.0}), | ||
], | ||
"move_type": "out_invoice", | ||
"name": "invoice test", | ||
"partner_id": self.env.ref("base.res_partner_2").id, | ||
} | ||
def test_invoice_mail_cc_bcc(self): | ||
invoice = self.init_invoice( | ||
"out_invoice", partner=self.partner, amounts=[1000], post=True | ||
) | ||
|
||
self.assertTrue( | ||
self.test_invoice, | ||
"Test setup did not succeed. Invoice not found.", | ||
wizard = self.create_send_and_print( | ||
invoice, | ||
sending_methods=["email", "manual"], | ||
mail_partner_ids=self.partner, | ||
partner_cc_ids=self.partner_cc, | ||
partner_bcc_ids=self.partner_bcc, | ||
) | ||
self.test_invoice.write({"state": "posted"}) | ||
|
||
ctx = { | ||
"active_ids": test_record.ids, | ||
"default_model": "account.move", | ||
"default_res_id": test_record.id, | ||
"mail_notify_force_send": True, | ||
} | ||
form = Form(self.env["account.move.send"].with_context(**ctx)) | ||
form.mail_body = "<p>Hello</p>" | ||
return form | ||
|
||
def test_invoice_mail_cc_bcc(self): | ||
self.set_company() | ||
form = self.open_invoice_mail_composer_form() | ||
form.mail_subject = "Hello" | ||
composer = form.save() | ||
with self.mock_mail_gateway(): | ||
composer.action_send_and_print() | ||
message = self.test_invoice.message_ids[0] | ||
wizard.action_send_and_print() | ||
self.assertEqual(len(self._mails), 3) | ||
|
||
message = self._get_mail_message(invoice) | ||
self.assertEqual(len(message.mail_ids), 1) | ||
|
||
# Only 2 partners (from default_cc/bcc of company) notified | ||
self.assertEqual(len(message.notified_partner_ids), 2) | ||
self.assertEqual(len(message.notification_ids), 2) | ||
# Only 3 partners (from default_cc/bcc of company) notified | ||
self.assertEqual(len(message.notified_partner_ids), 3) | ||
self.assertEqual(len(message.notification_ids), 3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from . import account_move_send | ||
from . import account_move_send_wizard |
129 changes: 0 additions & 129 deletions
129
mail_composer_cc_bcc_account/wizards/account_move_send.py
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
mail_composer_cc_bcc_account/wizards/account_move_send.xml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.