mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[MIG] account_banking_sepa_direct_debit: Finish migration to 12.0
* Fixed tests * Adjust code for Python dates handling * Update copyrights
This commit is contained in:
@@ -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).
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# © 2013-2016 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# © 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')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# Copyright 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import models, fields, api
|
||||
|
||||
@@ -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, _
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# Copyright 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# 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')
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# © 2015-2016 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# © 2013-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# © 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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# © 2013-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# © 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, _
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# Copyright 2016 Akretion - Alexis de Lattre
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# Copyright 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import api, SUPERUSER_ID
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# Copyright 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# 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')
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
# © 2015-2016 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user