[MIG]account_banking_sepa_credit_transfer: Migration to 15.0

This commit is contained in:
manu
2022-04-08 16:57:13 +02:00
committed by trisdoan
parent 19c17760ff
commit da569b2135
6 changed files with 41 additions and 8 deletions

View File

@@ -5,7 +5,7 @@
{
"name": "Account Banking SEPA Credit Transfer",
"summary": "Create SEPA XML files for Credit Transfers",
"version": "14.0.1.2.0",
"version": "15.0.1.0.0",
"license": "AGPL-3",
"author": "Akretion, " "Tecnativa, " "Odoo Community Association (OCA)",
"website": "https://github.com/OCA/bank-payment",

View File

@@ -1,7 +1,7 @@
# Copyright 2016-2020 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import fields, models
from odoo import api, fields, models
class AccountPaymentMethod(models.Model):
@@ -38,3 +38,12 @@ class AccountPaymentMethod(models.Model):
)
return path
return super().get_xsd_file_path()
@api.model
def _get_payment_method_information(self):
res = super()._get_payment_method_information()
res["sepa_credit_transfer"] = {
"mode": "multi",
"domain": [("type", "=", "bank")],
}
return res

View File

@@ -178,10 +178,10 @@ class AccountPaymentOrder(models.Model):
raise UserError(
_(
"Bank account is missing on the bank payment line "
"of partner '%s' (reference '%s')."
)
% (line.partner_id.name, line.name)
"of partner '{partner}' (reference '{reference}')."
).format(partner=line.partner_id.name, reference=line.name)
)
self.generate_party_block(
credit_transfer_transaction_info,
"Cdtr",

View File

@@ -11,5 +11,15 @@ def update_bank_journals(cr, registry):
journals = ajo.search([("type", "=", "bank")])
sct = env.ref("account_banking_sepa_credit_transfer.sepa_credit_transfer")
if sct:
journals.write({"outbound_payment_method_ids": [(4, sct.id)]})
journals.write(
{
"outbound_payment_method_line_ids": [
(
0,
0,
{"payment_method_id": sct.id, "name": "SEPA Direct Credit"},
)
]
}
)
return

View File

@@ -17,3 +17,4 @@
* `Sygel Technology <https://www.sygel.es>`_:
* Valentin Vinagre <valentin.vinagre@sygel.es>
* Manuel Regidor <manuel.regidor@sygel.es>

View File

@@ -9,10 +9,10 @@ import time
from lxml import etree
from odoo.exceptions import UserError
from odoo.tests.common import SavepointCase
from odoo.tests.common import TransactionCase
class TestSCT(SavepointCase):
class TestSCT(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
@@ -96,8 +96,21 @@ class TestSCT(SavepointCase):
"bank_account_id": cls.partner_bank.id,
"bank_id": cls.partner_bank.bank_id.id,
"company_id": cls.main_company.id,
"outbound_payment_method_line_ids": [
(
0,
0,
{
"payment_method_id": cls.env.ref(
"account_banking_sepa_credit_transfer.sepa_credit_transfer"
).id,
"payment_account_id": cls.account_payable.id,
},
)
],
}
)
# update payment mode
cls.payment_mode = cls.env.ref(
"account_banking_sepa_credit_transfer.payment_mode_outbound_sepa_ct1"