From 5ed010ddb1af7a928acd00aaeae79694e915a4ac Mon Sep 17 00:00:00 2001 From: etobella Date: Tue, 17 Oct 2017 16:12:16 +0200 Subject: [PATCH] [MIG] account_banking_sepa_direct_debit --- account_banking_sepa_direct_debit/README.rst | 16 +-- .../__manifest__.py | 4 +- .../data/account_payment_method.xml | 24 ++-- .../data/mandate_expire_cron.xml | 29 +++-- .../models/account_banking_mandate.py | 25 ++-- .../models/account_payment_method.py | 2 +- .../models/account_payment_mode.py | 2 +- .../models/account_payment_order.py | 8 +- .../models/bank_payment_line.py | 4 +- .../models/common.py | 4 +- .../models/res_company.py | 2 +- .../models/res_config.py | 6 +- .../post_install.py | 2 +- .../reports/sepa_direct_debit_mandate.xml | 2 +- .../tests/__init__.py | 1 + .../tests/test_mandate.py | 47 ++++++++ .../tests/test_sdd.py | 109 ++++++++++-------- .../views/account_banking_mandate_view.xml | 2 +- .../views/account_payment_mode.xml | 2 +- .../views/res_config.xml | 28 +++-- 20 files changed, 193 insertions(+), 126 deletions(-) create mode 100644 account_banking_sepa_direct_debit/tests/test_mandate.py diff --git a/account_banking_sepa_direct_debit/README.rst b/account_banking_sepa_direct_debit/README.rst index cfbba11be..cf6f64c0e 100644 --- a/account_banking_sepa_direct_debit/README.rst +++ b/account_banking_sepa_direct_debit/README.rst @@ -35,26 +35,26 @@ Configuration For setting the SEPA creditor identifier: -#. Go to Accounting > Configuration > Settings. +#. Go to Invoicing/Accounting > Configuration > Settings. #. On the field "SEPA Creditor Identifier" in the section *SEPA/PAIN*, you can fill the corresponding identifier. If your country requires several identifiers (like Spain), you must: -#. Go to *Accounting > Configuration > Settings*. +#. Go to *Invoicing/Accounting > Configuration > Settings*. #. On the section *SEPA/PAIN*, check the mark "Multiple identifiers". -#. Now go to *Accounting > Configuration > Management > Payment Modes*. +#. Now go to *Invoicing/Accounting > Configuration > Management > Payment Modes*. #. Create a payment mode for your specific bank. #. Fill the specific identifier on the field "SEPA Creditor Identifier". For defining a payment mode that uses SEPA direct debit: -#. Go to *Accounting > Configuration > Management > Payment Modes*. +#. Go to *Invoicing/Accounting > Configuration > Management > Payment Modes*. #. Create a record. #. Select the Payment Method *SEPA Direct Debit for customers* (which is automatically created upon module installation). #. Check that this payment method uses the proper version of PAIN. -#. If not, go *Accounting > Configuration > Management > Payment Methods*. +#. If not, go *Invoicing/Accounting > Configuration > Management > Payment Methods*. #. Locate the "SEPA Direct Debit for customers" record and open it. #. Change the "PAIN version" according your needs. #. If you need to handle several PAIN versions, just duplicate the payment @@ -63,13 +63,13 @@ For defining a payment mode that uses SEPA direct debit: Usage ===== -In the menu *Accounting > Payments > Debit Order*, create a new debit +In the menu *Invoicing/Accounting > Payments > Debit Order*, create a new debit order and select the Payment Mode dedicated to SEPA Direct Debit that you created during the configuration step. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/173/10.0 + :target: https://runbot.odoo-community.org/runbot/173/11.0 Known issues / Roadmap ====================== @@ -103,7 +103,7 @@ Contributors Maintainer ---------- -.. image:: http://odoo-community.org/logo.png +.. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :target: https://odoo-community.org diff --git a/account_banking_sepa_direct_debit/__manifest__.py b/account_banking_sepa_direct_debit/__manifest__.py index 691592b72..1dd145485 100644 --- a/account_banking_sepa_direct_debit/__manifest__.py +++ b/account_banking_sepa_direct_debit/__manifest__.py @@ -2,12 +2,12 @@ # Copyright 2013-2016 Akretion (www.akretion.com) # Copyright 2014-2017 Tecnativa - Pedro M. Baeza # Copyright 2016 Tecnativa - Antonio Espinosa -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). { 'name': 'Account Banking SEPA Direct Debit', 'summary': 'Create SEPA files for Direct Debit', - 'version': '10.0.1.1.0', + 'version': '11.0.1.0.0', 'license': 'AGPL-3', 'author': "Akretion, " "Tecnativa, " diff --git a/account_banking_sepa_direct_debit/data/account_payment_method.xml b/account_banking_sepa_direct_debit/data/account_payment_method.xml index fc72788cb..c81129d70 100644 --- a/account_banking_sepa_direct_debit/data/account_payment_method.xml +++ b/account_banking_sepa_direct_debit/data/account_payment_method.xml @@ -1,17 +1,11 @@ - - - - - - SEPA Direct Debit for customers - sepa_direct_debit - inbound - - - pain.008.001.02 - - - - + + + SEPA Direct Debit for customers + sepa_direct_debit + inbound + + + pain.008.001.02 + diff --git a/account_banking_sepa_direct_debit/data/mandate_expire_cron.xml b/account_banking_sepa_direct_debit/data/mandate_expire_cron.xml index 99f9acb6e..1f4496b61 100644 --- a/account_banking_sepa_direct_debit/data/mandate_expire_cron.xml +++ b/account_banking_sepa_direct_debit/data/mandate_expire_cron.xml @@ -2,22 +2,19 @@ - - - - Set SEPA Direct Debit Mandates to Expired - - - 1 - days - -1 - - - - - - + + + Set SEPA Direct Debit Mandates to Expired + + + code + model._sdd_mandate_set_state_to_expired() + 1 + days + -1 + + diff --git a/account_banking_sepa_direct_debit/models/account_banking_mandate.py b/account_banking_sepa_direct_debit/models/account_banking_mandate.py index daabb2d41..c45550bc1 100644 --- a/account_banking_sepa_direct_debit/models/account_banking_mandate.py +++ b/account_banking_sepa_direct_debit/models/account_banking_mandate.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # © 2013-2016 Akretion - Alexis de Lattre # © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import models, fields, api, exceptions, _ from datetime import datetime @@ -20,10 +20,11 @@ class AccountBankingMandate(models.Model): format = fields.Selection( selection_add=[('sepa', 'Sepa Mandate')], default='sepa') - type = fields.Selection([('recurrent', 'Recurrent'), - ('oneoff', 'One-Off')], - string='Type of Mandate', - track_visibility='onchange') + type = fields.Selection( + selection_add=[ + ('recurrent', 'Recurrent'), + ('oneoff', 'One-Off') + ]) recurrent_sequence_type = fields.Selection( [('first', 'First'), ('recurring', 'Recurring'), @@ -66,10 +67,12 @@ class AccountBankingMandate(models.Model): for mandate in self: super(AccountBankingMandate, self).mandate_partner_bank_change() res = {} - if (mandate.state == 'valid' and - mandate.partner_bank_id and - mandate.type == 'recurrent' and - mandate.recurrent_sequence_type != 'first'): + if ( + mandate.state == 'valid' and + mandate.partner_bank_id and + mandate.type == 'recurrent' and + mandate.recurrent_sequence_type != 'first' + ): mandate.recurrent_sequence_type = 'first' res['warning'] = { 'title': _('Mandate update'), @@ -82,8 +85,8 @@ class AccountBankingMandate(models.Model): @api.model def _sdd_mandate_set_state_to_expired(self): logger.info('Searching for SDD Mandates that must be set to Expired') - expire_limit_date = datetime.today() + \ - relativedelta(months=-NUMBER_OF_UNUSED_MONTHS_BEFORE_EXPIRY) + expire_limit_date = datetime.today() + relativedelta( + months=-NUMBER_OF_UNUSED_MONTHS_BEFORE_EXPIRY) expire_limit_date_str = expire_limit_date.strftime('%Y-%m-%d') expired_mandates = self.search( ['|', diff --git a/account_banking_sepa_direct_debit/models/account_payment_method.py b/account_banking_sepa_direct_debit/models/account_payment_method.py index 0249bba37..006f923c0 100644 --- a/account_banking_sepa_direct_debit/models/account_payment_method.py +++ b/account_banking_sepa_direct_debit/models/account_payment_method.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # © 2016 Akretion (Alexis de Lattre ) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import models, fields, api diff --git a/account_banking_sepa_direct_debit/models/account_payment_mode.py b/account_banking_sepa_direct_debit/models/account_payment_mode.py index 3ef061eab..083ea5582 100644 --- a/account_banking_sepa_direct_debit/models/account_payment_mode.py +++ b/account_banking_sepa_direct_debit/models/account_payment_mode.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # © 2016 Antiun Ingenieria S.L. - Antonio Espinosa -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import models, fields, api, _ from .common import is_sepa_creditor_identifier_valid diff --git a/account_banking_sepa_direct_debit/models/account_payment_order.py b/account_banking_sepa_direct_debit/models/account_payment_order.py index 3592437fe..c759e8323 100644 --- a/account_banking_sepa_direct_debit/models/account_payment_order.py +++ b/account_banking_sepa_direct_debit/models/account_payment_order.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # © 2016 Akretion (Alexis de Lattre ) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import models, fields, api, _ from odoo.exceptions import UserError @@ -114,7 +114,7 @@ class AccountPaymentOrder(models.Model): lines_per_group[key] = [line] for (requested_date, priority, categ_purpose, sequence_type, scheme),\ - lines in lines_per_group.items(): + lines in list(lines_per_group.items()): # B. Payment info payment_info, nb_of_transactions_b, control_sum_b = \ self.generate_start_payment_info_block( @@ -218,9 +218,9 @@ class AccountPaymentOrder(models.Model): self.generate_remittance_info_block( dd_transaction_info, line, gen_args) - nb_of_transactions_b.text = unicode(transactions_count_b) + nb_of_transactions_b.text = str(transactions_count_b) control_sum_b.text = '%.2f' % amount_control_sum_b - nb_of_transactions_a.text = unicode(transactions_count_a) + nb_of_transactions_a.text = str(transactions_count_a) control_sum_a.text = '%.2f' % amount_control_sum_a return self.finalize_sepa_file_creation( diff --git a/account_banking_sepa_direct_debit/models/bank_payment_line.py b/account_banking_sepa_direct_debit/models/bank_payment_line.py index b3076feb4..4c600e24c 100644 --- a/account_banking_sepa_direct_debit/models/bank_payment_line.py +++ b/account_banking_sepa_direct_debit/models/bank_payment_line.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # © 2015-2016 Akretion - Alexis de Lattre -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import models, api @@ -19,5 +19,5 @@ class BankPaymentLine(models.Model): """ hashcode = super(BankPaymentLine, self).\ move_line_offsetting_account_hashcode() - hashcode += '-' + unicode(self.mandate_id.recurrent_sequence_type) + hashcode += '-' + str(self.mandate_id.recurrent_sequence_type) return hashcode diff --git a/account_banking_sepa_direct_debit/models/common.py b/account_banking_sepa_direct_debit/models/common.py index 33712f3b3..cf32c81c2 100644 --- a/account_banking_sepa_direct_debit/models/common.py +++ b/account_banking_sepa_direct_debit/models/common.py @@ -2,7 +2,7 @@ # © 2013-2016 Akretion (Alexis de Lattre ) # © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza # © 2016 Antiun Ingenieria S.L. - Antonio Espinosa -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). import logging @@ -15,7 +15,7 @@ def is_sepa_creditor_identifier_valid(sepa_creditor_identifier): or unicode @return: True if valid, False otherwise """ - if not isinstance(sepa_creditor_identifier, (str, unicode)): + if not isinstance(sepa_creditor_identifier, str): return False try: sci = str(sepa_creditor_identifier).lower() diff --git a/account_banking_sepa_direct_debit/models/res_company.py b/account_banking_sepa_direct_debit/models/res_company.py index 1ce9c3736..7edcde4a6 100644 --- a/account_banking_sepa_direct_debit/models/res_company.py +++ b/account_banking_sepa_direct_debit/models/res_company.py @@ -2,7 +2,7 @@ # © 2013-2016 Akretion (Alexis de Lattre ) # © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza # © 2016 Antiun Ingenieria S.L. - Antonio Espinosa -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import models, fields, api, _ from .common import is_sepa_creditor_identifier_valid diff --git a/account_banking_sepa_direct_debit/models/res_config.py b/account_banking_sepa_direct_debit/models/res_config.py index 47c311e3b..531b9ccf8 100644 --- a/account_banking_sepa_direct_debit/models/res_config.py +++ b/account_banking_sepa_direct_debit/models/res_config.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- # © 2016 Akretion (Alexis de Lattre ) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import models, fields -class AccountConfigSettings(models.TransientModel): - _inherit = 'account.config.settings' +class ResConfigSettings(models.TransientModel): + _inherit = 'res.config.settings' sepa_creditor_identifier = fields.Char( related='company_id.sepa_creditor_identifier') diff --git a/account_banking_sepa_direct_debit/post_install.py b/account_banking_sepa_direct_debit/post_install.py index 1ef07020a..b357674f3 100644 --- a/account_banking_sepa_direct_debit/post_install.py +++ b/account_banking_sepa_direct_debit/post_install.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- # © 2016 Akretion (Alexis de Lattre ) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import api, SUPERUSER_ID diff --git a/account_banking_sepa_direct_debit/reports/sepa_direct_debit_mandate.xml b/account_banking_sepa_direct_debit/reports/sepa_direct_debit_mandate.xml index 550d64227..5f84a6d30 100644 --- a/account_banking_sepa_direct_debit/reports/sepa_direct_debit_mandate.xml +++ b/account_banking_sepa_direct_debit/reports/sepa_direct_debit_mandate.xml @@ -11,7 +11,7 @@ file="account_banking_sepa_direct_debit.sepa_direct_debit_mandate" /> - + diff --git a/account_banking_sepa_direct_debit/tests/__init__.py b/account_banking_sepa_direct_debit/tests/__init__.py index 27fbb4e38..6d038500f 100644 --- a/account_banking_sepa_direct_debit/tests/__init__.py +++ b/account_banking_sepa_direct_debit/tests/__init__.py @@ -1,3 +1,4 @@ # -*- coding: utf-8 -*- from . import test_sdd +from . import test_mandate diff --git a/account_banking_sepa_direct_debit/tests/test_mandate.py b/account_banking_sepa_direct_debit/tests/test_mandate.py new file mode 100644 index 000000000..3ff0b57e8 --- /dev/null +++ b/account_banking_sepa_direct_debit/tests/test_mandate.py @@ -0,0 +1,47 @@ +# -*- coding: utf-8 -*- +# © 2016 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo.tests.common import TransactionCase +from odoo.exceptions import ValidationError +from datetime import datetime +from dateutil.relativedelta import relativedelta + + +class TestMandate(TransactionCase): + def test_contrains(self): + with self.assertRaises(ValidationError): + self.mandate.recurrent_sequence_type = False + self.mandate.type = 'recurrent' + self.mandate._check_recurring_type() + + def test_onchange_bank(self): + self.mandate.write({ + 'type': 'recurrent', 'recurrent_sequence_type': 'recurring' + }) + self.mandate.validate() + self.mandate.partner_bank_id = self.env.ref( + 'account_payment_mode.res_partner_2_iban' + ) + self.mandate.mandate_partner_bank_change() + self.assertEqual(self.mandate.recurrent_sequence_type, 'first') + + def test_expire(self): + self.mandate.signature_date = datetime.now() + relativedelta( + months=-50) + self.mandate.validate() + self.assertEqual(self.mandate.state, 'valid') + self.env['account.banking.mandate']._sdd_mandate_set_state_to_expired() + self.assertEqual(self.mandate.state, 'expired') + + def setUp(self): + res = super(TestMandate, self).setUp() + self.partner = self.env.ref('base.res_partner_12') + bank_account = self.env.ref('account_payment_mode.res_partner_12_iban') + self.mandate = self.env['account.banking.mandate'].create({ + 'partner_bank_id': bank_account.id, + 'format': 'sepa', + 'type': 'oneoff', + 'signature_date': '2015-01-01', + }) + return res diff --git a/account_banking_sepa_direct_debit/tests/test_sdd.py b/account_banking_sepa_direct_debit/tests/test_sdd.py index a61b0b27a..92c324a9f 100644 --- a/account_banking_sepa_direct_debit/tests/test_sdd.py +++ b/account_banking_sepa_direct_debit/tests/test_sdd.py @@ -1,9 +1,9 @@ # -*- coding: utf-8 -*- # © 2016 Akretion (Alexis de Lattre ) -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo.addons.account.tests.account_test_classes\ - import AccountingTestCase +import base64 +from odoo.addons.account.tests.account_test_classes import AccountingTestCase from odoo.tools import float_compare import time from lxml import etree @@ -60,72 +60,91 @@ class TestSDD(AccountingTestCase): for bank_acc in self.partner_bank_model.search([]): bank_acc.acc_number = bank_acc.acc_number - def test_sdd(self): + def test_pain_001_02(self): + self.payment_mode.payment_method_id.pain_version = 'pain.008.001.02' + self.check_sdd() + + def test_pain_003_02(self): + self.payment_mode.payment_method_id.pain_version = 'pain.008.003.02' + self.check_sdd() + + def test_pain_001_03(self): + self.payment_mode.payment_method_id.pain_version = 'pain.008.001.03' + self.check_sdd() + + def test_pain_001_04(self): + self.payment_mode.payment_method_id.pain_version = 'pain.008.001.04' + self.check_sdd() + + def check_sdd(self): self.env.ref( - 'account_banking_sepa_direct_debit.res_partner_2_mandate').\ - recurrent_sequence_type = 'first' + 'account_banking_sepa_direct_debit.res_partner_2_mandate' + ).recurrent_sequence_type = 'first' invoice1 = self.create_invoice( self.partner_agrolait.id, 'account_banking_sepa_direct_debit.res_partner_2_mandate', 42.0) + self.env.ref( + 'account_banking_sepa_direct_debit.res_partner_12_mandate' + ).type = 'oneoff' invoice2 = self.create_invoice( self.partner_c2c.id, 'account_banking_sepa_direct_debit.res_partner_12_mandate', 11.0) for inv in [invoice1, invoice2]: action = inv.create_account_payment_line() - self.assertEquals(action['res_model'], 'account.payment.order') - self.payment_order = self.payment_order_model.browse(action['res_id']) - self.assertEquals( - self.payment_order.payment_type, 'inbound') - self.assertEquals( - self.payment_order.payment_mode_id, self.payment_mode) - self.assertEquals( - self.payment_order.journal_id, self.bank_journal) + self.assertEqual(action['res_model'], 'account.payment.order') + payment_order = self.payment_order_model.browse(action['res_id']) + self.assertEqual( + payment_order.payment_type, 'inbound') + self.assertEqual( + payment_order.payment_mode_id, self.payment_mode) + self.assertEqual( + payment_order.journal_id, self.bank_journal) # Check payment line pay_lines = self.payment_line_model.search([ ('partner_id', '=', self.partner_agrolait.id), - ('order_id', '=', self.payment_order.id)]) - self.assertEquals(len(pay_lines), 1) + ('order_id', '=', payment_order.id)]) + self.assertEqual(len(pay_lines), 1) agrolait_pay_line1 = pay_lines[0] accpre = self.env['decimal.precision'].precision_get('Account') - self.assertEquals( + self.assertEqual( agrolait_pay_line1.currency_id.id, self.eur_currency_id) - self.assertEquals( + self.assertEqual( agrolait_pay_line1.mandate_id, invoice1.mandate_id) - self.assertEquals( + self.assertEqual( agrolait_pay_line1.partner_bank_id, invoice1.mandate_id.partner_bank_id) - self.assertEquals(float_compare( + self.assertEqual(float_compare( agrolait_pay_line1.amount_currency, 42, precision_digits=accpre), 0) - self.assertEquals(agrolait_pay_line1.communication_type, 'normal') - self.assertEquals(agrolait_pay_line1.communication, invoice1.number) - self.payment_order.draft2open() - self.assertEquals(self.payment_order.state, 'open') - self.assertEquals(self.payment_order.sepa, True) + self.assertEqual(agrolait_pay_line1.communication_type, 'normal') + self.assertEqual(agrolait_pay_line1.communication, invoice1.number) + payment_order.draft2open() + self.assertEqual(payment_order.state, 'open') + self.assertEqual(payment_order.sepa, True) # Check bank payment line bank_lines = self.bank_line_model.search([ ('partner_id', '=', self.partner_agrolait.id)]) - self.assertEquals(len(bank_lines), 1) + self.assertEqual(len(bank_lines), 1) agrolait_bank_line = bank_lines[0] - self.assertEquals( + self.assertEqual( agrolait_bank_line.currency_id.id, self.eur_currency_id) - self.assertEquals(float_compare( + self.assertEqual(float_compare( agrolait_bank_line.amount_currency, 42.0, precision_digits=accpre), 0) - self.assertEquals(agrolait_bank_line.communication_type, 'normal') - self.assertEquals( + self.assertEqual(agrolait_bank_line.communication_type, 'normal') + self.assertEqual( agrolait_bank_line.communication, invoice1.number) - self.assertEquals( + self.assertEqual( agrolait_bank_line.mandate_id, invoice1.mandate_id) - self.assertEquals( + self.assertEqual( agrolait_bank_line.partner_bank_id, invoice1.mandate_id.partner_bank_id) - action = self.payment_order.open2generated() - self.assertEquals(self.payment_order.state, 'generated') - self.assertEquals(action['res_model'], 'ir.attachment') + action = payment_order.open2generated() + self.assertEqual(payment_order.state, 'generated') + self.assertEqual(action['res_model'], 'ir.attachment') attachment = self.attachment_model.browse(action['res_id']) - self.assertEquals(attachment.datas_fname[-4:], '.xml') - xml_file = attachment.datas.decode('base64') + self.assertEqual(attachment.datas_fname[-4:], '.xml') + xml_file = base64.b64decode(attachment.datas) xml_root = etree.fromstring(xml_file) # print "xml_file=", etree.tostring(xml_root, pretty_print=True) namespaces = xml_root.nsmap @@ -133,20 +152,20 @@ class TestSDD(AccountingTestCase): namespaces.pop(None) pay_method_xpath = xml_root.xpath( '//p:PmtInf/p:PmtMtd', namespaces=namespaces) - self.assertEquals(pay_method_xpath[0].text, 'DD') + self.assertEqual(pay_method_xpath[0].text, 'DD') sepa_xpath = xml_root.xpath( '//p:PmtInf/p:PmtTpInf/p:SvcLvl/p:Cd', namespaces=namespaces) - self.assertEquals(sepa_xpath[0].text, 'SEPA') + self.assertEqual(sepa_xpath[0].text, 'SEPA') debtor_acc_xpath = xml_root.xpath( '//p:PmtInf/p:CdtrAcct/p:Id/p:IBAN', namespaces=namespaces) - self.assertEquals( + self.assertEqual( debtor_acc_xpath[0].text, - self.payment_order.company_partner_bank_id.sanitized_acc_number) - self.payment_order.generated2uploaded() - self.assertEquals(self.payment_order.state, 'uploaded') + payment_order.company_partner_bank_id.sanitized_acc_number) + payment_order.generated2uploaded() + self.assertEqual(payment_order.state, 'uploaded') for inv in [invoice1, invoice2]: - self.assertEquals(inv.state, 'paid') - self.assertEquals(self.env.ref( + self.assertEqual(inv.state, 'paid') + self.assertEqual(self.env.ref( 'account_banking_sepa_direct_debit.res_partner_2_mandate'). recurrent_sequence_type, 'recurring') return diff --git a/account_banking_sepa_direct_debit/views/account_banking_mandate_view.xml b/account_banking_sepa_direct_debit/views/account_banking_mandate_view.xml index 8bf7478e5..78c4285b3 100644 --- a/account_banking_sepa_direct_debit/views/account_banking_mandate_view.xml +++ b/account_banking_sepa_direct_debit/views/account_banking_mandate_view.xml @@ -1,7 +1,7 @@ + License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). --> diff --git a/account_banking_sepa_direct_debit/views/res_config.xml b/account_banking_sepa_direct_debit/views/res_config.xml index 94c8e3d77..1a297a5f3 100644 --- a/account_banking_sepa_direct_debit/views/res_config.xml +++ b/account_banking_sepa_direct_debit/views/res_config.xml @@ -2,17 +2,23 @@ - - sepa_direct_debit.account_config_settings.form - account.config.settings - - - - - - - + + sepa_direct_debit.account_config_settings.form + + res.config.settings + + + +
+
+
+
+