Skip to content

Commit

Permalink
[MIG] mail_composer_cc_bcc_account: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
trisdoan committed Dec 16, 2024
1 parent bb9b092 commit 1a62f5d
Show file tree
Hide file tree
Showing 10 changed files with 150 additions and 222 deletions.
20 changes: 10 additions & 10 deletions mail_composer_cc_bcc_account/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ Email CC and BCC when sending invoice
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
:target: https://github.com/OCA/social/tree/17.0/mail_composer_cc_bcc_account
:alt: OCA/social
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmail-lightgray.png?logo=github
:target: https://github.com/OCA/mail/tree/18.0/mail_composer_cc_bcc_account
:alt: OCA/mail
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_composer_cc_bcc_account
:target: https://translation.odoo-community.org/projects/mail-18-0/mail-18-0-mail_composer_cc_bcc_account
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/mail&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -56,10 +56,10 @@ partners then the invoice contact of the customer.
Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
Bugs are tracked on `GitHub Issues <https://github.com/OCA/mail/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_composer_cc_bcc_account%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/mail/issues/new?body=module:%20mail_composer_cc_bcc_account%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Expand Down Expand Up @@ -87,8 +87,8 @@ Contributors
Other credits
-------------

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.

Maintainers
-----------
Expand All @@ -111,6 +111,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-hailangvn2023|

This module is part of the `OCA/social <https://github.com/OCA/social/tree/17.0/mail_composer_cc_bcc_account>`_ project on GitHub.
This module is part of the `OCA/mail <https://github.com/OCA/mail/tree/18.0/mail_composer_cc_bcc_account>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
6 changes: 3 additions & 3 deletions mail_composer_cc_bcc_account/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
{
"name": "Email CC and BCC when sending invoice",
"summary": "This module enables sending mail to CC and BCC partners for invoices.",
"version": "17.0.1.0.0",
"version": "18.0.1.0.0",
"development_status": "Alpha",
"category": "Social",
"website": "https://github.com/OCA/social",
"website": "https://github.com/OCA/mail",
"author": "Camptocamp SA, Odoo Community Association (OCA)",
"maintainers": ["hailangvn2023"],
"license": "AGPL-3",
Expand All @@ -19,6 +19,6 @@
"mail_composer_cc_bcc",
],
"data": [
"wizards/account_move_send.xml",
"wizards/account_move_send_wizard.xml",
],
}
3 changes: 1 addition & 2 deletions mail_composer_cc_bcc_account/readme/CREDITS.md
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.
12 changes: 6 additions & 6 deletions mail_composer_cc_bcc_account/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ <h1 class="title">Email CC and BCC when sending invoice</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:dd944995a010180b76d2bfa93b37c70a3866d21822b825cd811895aca5318ff6
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/social/tree/17.0/mail_composer_cc_bcc_account"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_composer_cc_bcc_account"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/social&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/mail/tree/18.0/mail_composer_cc_bcc_account"><img alt="OCA/mail" src="https://img.shields.io/badge/github-OCA%2Fmail-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/mail-18-0/mail-18-0-mail_composer_cc_bcc_account"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/mail&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module allows to properly separate To:, Cc:, and Bcc: fields in
when sending invoices.</p>
<div class="admonition important">
Expand Down Expand Up @@ -405,10 +405,10 @@ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/mail/issues">GitHub Issues</a>.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_composer_cc_bcc_account%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="https://github.com/OCA/mail/issues/new?body=module:%20mail_composer_cc_bcc_account%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand Down Expand Up @@ -442,8 +442,8 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#toc-entry-7">Other credits</a></h2>
<p>The creation and migration from 16.0 to 17.0 of this module were
financially supported by Camptocamp.</p>
<p>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.</p>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
Expand All @@ -456,7 +456,7 @@ <h2><a class="toc-backref" href="#toc-entry-8">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/hailangvn2023"><img alt="hailangvn2023" src="https://github.com/hailangvn2023.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/17.0/mail_composer_cc_bcc_account">OCA/social</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/mail/tree/18.0/mail_composer_cc_bcc_account">OCA/mail</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
Expand Down
72 changes: 26 additions & 46 deletions mail_composer_cc_bcc_account/tests/test_mail_cc_bcc.py
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)
2 changes: 1 addition & 1 deletion mail_composer_cc_bcc_account/wizards/__init__.py
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 mail_composer_cc_bcc_account/wizards/account_move_send.py

This file was deleted.

25 changes: 0 additions & 25 deletions mail_composer_cc_bcc_account/wizards/account_move_send.xml

This file was deleted.

Loading

0 comments on commit 1a62f5d

Please sign in to comment.