Skip to content

Commit

Permalink
[12.0][MIG] account_invoice_ubl_email_attachment
Browse files Browse the repository at this point in the history
  • Loading branch information
astirpe authored and OCA-git-bot committed Aug 21, 2019
1 parent 299732a commit 0fcb887
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 12 deletions.
10 changes: 5 additions & 5 deletions account_invoice_ubl_email_attachment/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Account Invoice UBL Email Attachment
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github
:target: https://github.com/OCA/edi/tree/11.0/account_invoice_ubl_email_attachment
:target: https://github.com/OCA/edi/tree/12.0/account_invoice_ubl_email_attachment
:alt: OCA/edi
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/edi-11-0/edi-11-0-account_invoice_ubl_email_attachment
:target: https://translation.odoo-community.org/projects/edi-12-0/edi-12-0-account_invoice_ubl_email_attachment
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/226/11.0
:target: https://runbot.odoo-community.org/runbot/226/12.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -54,7 +54,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/edi/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/edi/issues/new?body=module:%20account_invoice_ubl_email_attachment%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/edi/issues/new?body=module:%20account_invoice_ubl_email_attachment%0Aversion:%2012.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 @@ -84,6 +84,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/edi <https://github.com/OCA/edi/tree/11.0/account_invoice_ubl_email_attachment>`_ project on GitHub.
This module is part of the `OCA/edi <https://github.com/OCA/edi/tree/12.0/account_invoice_ubl_email_attachment>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion account_invoice_ubl_email_attachment/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
'name': 'Account Invoice UBL Email Attachment',
'summary': 'Automatically adds the UBL file to the email.',
'version': '11.0.1.0.0',
'version': '12.0.1.0.0',
'category': 'Accounting & Finance',
'author': 'Onestein, Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/edi/',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class AccountInvoice(models.Model):
_inherit = 'account.invoice'

def action_invoice_sent(self):
action = super(AccountInvoice, self).action_invoice_sent()
action = super().action_invoice_sent()
if self.company_id.include_ubl_attachment_in_invoice_email:
action['context']['attach_ubl_xml_file'] = True
return action
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def generate_email(self, res_ids, fields=None):
if not ubl_attachments:
ubl_attachments = invoice._generate_email_ubl_attachment()
if len(ubl_attachments) == 1 and template.report_name:
report_name = self.render_template(
report_name = self._render_template(
template.report_name, template.model, res_id)
ext = '.xml'
if not report_name.endswith(ext):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
class TestUblInvoiceEmailAttachment(HttpCase):

def setUp(self):
super(TestUblInvoiceEmailAttachment, self).setUp()
super().setUp()

partner = self.env.ref('base.res_partner_3')
product = self.env.ref('product.product_product_5')
Expand Down Expand Up @@ -71,7 +71,9 @@ def test_02_ubl_invoice_email_no_attachment(self):
composer = self.env['mail.compose.message'].with_context(
self.composer_ctx).create(self.composer_vals)
self.assertFalse(composer.attachment_ids)
composer.onchange_template_id_wrapper()
composer.with_context(
force_report_rendering=True
).onchange_template_id_wrapper()
self.assertTrue(composer.attachment_ids)
self.assertEqual(len(composer.attachment_ids), 1)

Expand All @@ -84,7 +86,9 @@ def test_03_ubl_invoice_email_no_attachment(self):
composer = self.env['mail.compose.message'].with_context(
self.composer_ctx).create(self.composer_vals)
self.assertFalse(composer.attachment_ids)
composer.onchange_template_id_wrapper()
composer.with_context(
force_report_rendering=True
).onchange_template_id_wrapper()
self.assertTrue(composer.attachment_ids)
self.assertEqual(len(composer.attachment_ids), 1)

Expand All @@ -98,6 +102,8 @@ def test_04_ubl_invoice_email_with_attachment(self):
composer = self.env['mail.compose.message'].with_context(
self.composer_ctx).create(self.composer_vals)
self.assertFalse(composer.attachment_ids)
composer.onchange_template_id_wrapper()
composer.with_context(
force_report_rendering=True
).onchange_template_id_wrapper()
self.assertTrue(composer.attachment_ids)
self.assertEqual(len(composer.attachment_ids), 2)

0 comments on commit 0fcb887

Please sign in to comment.