diff --git a/account_banking_sepa_direct_debit/__manifest__.py b/account_banking_sepa_direct_debit/__manifest__.py index a3ac5a53b..f88745391 100644 --- a/account_banking_sepa_direct_debit/__manifest__.py +++ b/account_banking_sepa_direct_debit/__manifest__.py @@ -1,5 +1,5 @@ # Copyright 2013-2016 Akretion (www.akretion.com) -# Copyright 2014-2017 Tecnativa - Pedro M. Baeza +# Copyright 2014-2018 Tecnativa - Pedro M. Baeza # Copyright 2016 Tecnativa - Antonio Espinosa # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). 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 71c3a24d4..15636cbaa 100644 --- a/account_banking_sepa_direct_debit/models/account_banking_mandate.py +++ b/account_banking_sepa_direct_debit/models/account_banking_mandate.py @@ -1,5 +1,5 @@ -# © 2013-2016 Akretion - Alexis de Lattre -# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza +# Copyright 2013-2016 Akretion - Alexis de Lattre +# Copyright 2014 Tecnativa - Pedro M. Baeza # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import models, fields, api, exceptions, _ from datetime import datetime @@ -35,7 +35,7 @@ class AccountBankingMandate(models.Model): ('B2B', 'Enterprise (B2B)')], string='Scheme', default="CORE", track_visibility='onchange') unique_mandate_reference = fields.Char(size=35) # cf ISO 20022 - display_name = fields.Char(compute='compute_display_name', store=True) + display_name = fields.Char(compute='_compute_display_name2', store=True) @api.multi @api.constrains('type', 'recurrent_sequence_type') @@ -49,15 +49,14 @@ class AccountBankingMandate(models.Model): @api.multi @api.depends('unique_mandate_reference', 'recurrent_sequence_type') - def compute_display_name(self): + def _compute_display_name2(self): for mandate in self: if mandate.format == 'sepa': - name = '%s (%s)' % ( + mandate.display_name = '%s (%s)' % ( mandate.unique_mandate_reference, mandate.recurrent_sequence_type) else: - name = mandate.unique_mandate_reference - mandate.display_name = name + mandate.display_name = mandate.unique_mandate_reference @api.multi @api.onchange('partner_bank_id') 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 4d6f5751a..91344929e 100644 --- a/account_banking_sepa_direct_debit/models/account_payment_method.py +++ b/account_banking_sepa_direct_debit/models/account_payment_method.py @@ -1,4 +1,4 @@ -# © 2016 Akretion (Alexis de Lattre ) +# Copyright 2016 Akretion (Alexis de Lattre ) # 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 f56116652..d294fe200 100644 --- a/account_banking_sepa_direct_debit/models/account_payment_mode.py +++ b/account_banking_sepa_direct_debit/models/account_payment_mode.py @@ -1,4 +1,4 @@ -# © 2016 Antiun Ingenieria S.L. - Antonio Espinosa +# Copyright 2016 Tecnativa - Antonio Espinosa # 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_order.py b/account_banking_sepa_direct_debit/models/account_payment_order.py index 28b8cfc0e..b43936aee 100644 --- a/account_banking_sepa_direct_debit/models/account_payment_order.py +++ b/account_banking_sepa_direct_debit/models/account_payment_order.py @@ -1,7 +1,8 @@ -# © 2016 Akretion (Alexis de Lattre ) +# Copyright 2016 Akretion (Alexis de Lattre ) +# Copyright 2018 Tecnativa - Pedro M. Baeza # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -from odoo import api, models, _ +from odoo import _, api, fields, models from odoo.exceptions import UserError from lxml import etree @@ -114,6 +115,7 @@ class AccountPaymentOrder(models.Model): for (requested_date, priority, categ_purpose, sequence_type, scheme),\ lines in list(lines_per_group.items()): + requested_date = fields.Date.to_string(requested_date) # B. Payment info payment_info, nb_of_transactions_b, control_sum_b = \ self.generate_start_payment_info_block( @@ -187,8 +189,13 @@ class AccountPaymentOrder(models.Model): mandate_related_info, 'DtOfSgntr') mandate_signature_date.text = self._prepare_field( 'Mandate Signature Date', - 'line.mandate_id.signature_date', - {'line': line}, 10, gen_args=gen_args) + 'signature_date', + { + 'line': line, + 'signature_date': fields.Date.to_string( + line.mandate_id.signature_date, + ), + }, 10, gen_args=gen_args) if sequence_type == 'FRST' and line.mandate_id.last_debit_date: amendment_indicator = etree.SubElement( mandate_related_info, 'AmdmntInd') 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 3f737f71f..ed51f6126 100644 --- a/account_banking_sepa_direct_debit/models/bank_payment_line.py +++ b/account_banking_sepa_direct_debit/models/bank_payment_line.py @@ -1,4 +1,4 @@ -# © 2015-2016 Akretion - Alexis de Lattre +# Copyright 2015-2016 Akretion - Alexis de Lattre # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import models, api diff --git a/account_banking_sepa_direct_debit/models/common.py b/account_banking_sepa_direct_debit/models/common.py index 9db8bec81..5395e30de 100644 --- a/account_banking_sepa_direct_debit/models/common.py +++ b/account_banking_sepa_direct_debit/models/common.py @@ -1,6 +1,6 @@ -# © 2013-2016 Akretion (Alexis de Lattre ) -# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza -# © 2016 Antiun Ingenieria S.L. - Antonio Espinosa +# Copyright 2013-2016 Akretion - Alexis de Lattre +# Copyright 2014 Tecnativa - Pedro M. Baeza +# Copyright 2016 Tecnativa - Antonio Espinosa # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). import logging @@ -18,7 +18,7 @@ def is_sepa_creditor_identifier_valid(sepa_creditor_identifier): return False try: sci = str(sepa_creditor_identifier).lower() - except: + except Exception: logger.warning( "SEPA Creditor ID should contain only ASCII characters.") return False diff --git a/account_banking_sepa_direct_debit/models/res_company.py b/account_banking_sepa_direct_debit/models/res_company.py index 46df0cb1c..f708e4006 100644 --- a/account_banking_sepa_direct_debit/models/res_company.py +++ b/account_banking_sepa_direct_debit/models/res_company.py @@ -1,6 +1,6 @@ -# © 2013-2016 Akretion (Alexis de Lattre ) -# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza -# © 2016 Antiun Ingenieria S.L. - Antonio Espinosa +# Copyright 2013-2016 Akretion - Alexis de Lattre +# Copyright 2014 Tecnativa - Pedro M. Baeza +# Copyright 2016 Tecnativa - Antonio Espinosa # 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/res_config.py b/account_banking_sepa_direct_debit/models/res_config.py index 162d30d7e..1875dfee9 100644 --- a/account_banking_sepa_direct_debit/models/res_config.py +++ b/account_banking_sepa_direct_debit/models/res_config.py @@ -1,4 +1,4 @@ -# © 2016 Akretion (Alexis de Lattre ) +# Copyright 2016 Akretion - Alexis de Lattre # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import models, fields diff --git a/account_banking_sepa_direct_debit/post_install.py b/account_banking_sepa_direct_debit/post_install.py index 88bc1c277..7fc58e37b 100644 --- a/account_banking_sepa_direct_debit/post_install.py +++ b/account_banking_sepa_direct_debit/post_install.py @@ -1,4 +1,4 @@ -# © 2016 Akretion (Alexis de Lattre ) +# Copyright 2016 Akretion (Alexis de Lattre ) # 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/tests/test_mandate.py b/account_banking_sepa_direct_debit/tests/test_mandate.py index c07f8b2c0..7ed17c421 100644 --- a/account_banking_sepa_direct_debit/tests/test_mandate.py +++ b/account_banking_sepa_direct_debit/tests/test_mandate.py @@ -1,9 +1,9 @@ -# © 2016 Akretion (Alexis de Lattre ) +# Copyright 2016 Akretion (Alexis de Lattre ) # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import fields from odoo.tests.common import TransactionCase from odoo.exceptions import ValidationError -from datetime import datetime from dateutil.relativedelta import relativedelta @@ -26,7 +26,7 @@ class TestMandate(TransactionCase): self.assertEqual(self.mandate.recurrent_sequence_type, 'first') def test_expire(self): - self.mandate.signature_date = datetime.now() + relativedelta( + self.mandate.signature_date = fields.Date.today() + relativedelta( months=-50) self.mandate.validate() self.assertEqual(self.mandate.state, 'valid') diff --git a/account_banking_sepa_direct_debit/tests/test_sdd.py b/account_banking_sepa_direct_debit/tests/test_sdd.py index bace1e4e8..bf468284e 100644 --- a/account_banking_sepa_direct_debit/tests/test_sdd.py +++ b/account_banking_sepa_direct_debit/tests/test_sdd.py @@ -10,9 +10,6 @@ from lxml import etree class TestSDD(common.HttpCase): - post_install = True - at_install = False - def setUp(self): super(TestSDD, self).setUp() self.company = self.env['res.company'] @@ -106,8 +103,7 @@ class TestSDD(common.HttpCase): 'unique_mandate_reference': 'BMTEST2', }) # Trigger the recompute of account type on res.partner.bank - for bank_acc in self.partner_bank_model.search([]): - bank_acc.acc_number = bank_acc.acc_number + self.partner_bank_model.search([])._compute_acc_type() def test_pain_001_02(self): self.payment_mode.payment_method_id.pain_version = 'pain.008.001.02' diff --git a/account_payment_order/models/account_move_line.py b/account_payment_order/models/account_move_line.py index 8211c6a74..1afc8b470 100644 --- a/account_payment_order/models/account_move_line.py +++ b/account_payment_order/models/account_move_line.py @@ -43,6 +43,9 @@ class AccountMoveLine(models.Model): self.invoice_id.type in ('in_invoice', 'in_refund') and self.invoice_id.reference): communication = self.invoice_id.reference + elif 'out' in self.invoice_id.type: + # Force to only put invoice number here + communication = self.invoice_id.number if self.currency_id: currency_id = self.currency_id.id amount_currency = self.amount_residual_currency diff --git a/account_payment_order/models/bank_payment_line.py b/account_payment_order/models/bank_payment_line.py index 5061adf5d..573dcba15 100644 --- a/account_payment_order/models/bank_payment_line.py +++ b/account_payment_order/models/bank_payment_line.py @@ -1,4 +1,5 @@ -# © 2015-2016 Akretion - Alexis de Lattre +# Copyright 2015-2016 Akretion - Alexis de Lattre +# Copyright 2018 Tecnativa - Pedro M. Baeza # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). from odoo import models, fields, api, _ @@ -101,7 +102,7 @@ class BankPaymentLine(models.Model): """ self.ensure_one() if self.order_id.payment_mode_id.move_option == 'date': - hashcode = self.date + hashcode = fields.Date.to_string(self.date) else: hashcode = str(self.id) return hashcode