Skip to content

Commit

Permalink
[MIG] account_banking_sepa_credit_transfer: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AnizR committed Feb 16, 2023
1 parent 6627c4a commit 8a62fb9
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 32 deletions.
1 change: 0 additions & 1 deletion account_banking_sepa_credit_transfer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
from . import models
from .post_install import update_bank_journals
3 changes: 1 addition & 2 deletions account_banking_sepa_credit_transfer/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"name": "Account Banking SEPA Credit Transfer",
"summary": "Create SEPA XML files for Credit Transfers",
"version": "14.0.2.0.0",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Akretion, Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/bank-payment",
Expand All @@ -15,6 +15,5 @@
"depends": ["account_banking_pain_base"],
"data": ["data/account_payment_method.xml"],
"demo": ["demo/sepa_credit_transfer_demo.xml"],
"post_init_hook": "update_bank_journals",
"installable": True,
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2016-2020 Akretion (Alexis de Lattre <[email protected]>)
# 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):
Expand Down Expand Up @@ -38,3 +38,12 @@ def get_xsd_file_path(self):
)
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
15 changes: 0 additions & 15 deletions account_banking_sepa_credit_transfer/post_install.py

This file was deleted.

38 changes: 25 additions & 13 deletions account_banking_sepa_credit_transfer/tests/test_sct.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@

from lxml import etree

from odoo.exceptions import UserError
from odoo.tests.common import SavepointCase
from odoo import _
from odoo.exceptions import UserError, ValidationError
from odoo.tests.common import TransactionCase


class TestSCT(SavepointCase):
class TestSCT(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
Expand All @@ -30,9 +31,7 @@ def setUpClass(cls):
cls.partner_c2c = cls.env.ref("base.res_partner_12")
cls.eur_currency = cls.env.ref("base.EUR")
cls.usd_currency = cls.env.ref("base.USD")
cls.main_company = cls.env["res.company"].create(
{"name": "Test EUR company", "currency_id": cls.eur_currency.id}
)
cls.main_company = cls.env["res.company"].create({"name": "Test EUR company"})
cls.partner_agrolait.company_id = cls.main_company.id
cls.partner_asus.company_id = cls.main_company.id
cls.partner_c2c.company_id = cls.main_company.id
Expand All @@ -42,21 +41,28 @@ def setUpClass(cls):
"company_id": cls.main_company.id,
}
)

charts = cls.env["account.chart.template"].search([])
if charts:
cls.chart = charts[0]
else:
raise ValidationError(_("No Chart of Account Template has been defined !"))
cls.chart.try_loading()

cls.account_expense = cls.account_model.create(
{
"user_type_id": cls.env.ref("account.data_account_type_expenses").id,
"name": "Test expense account",
"code": "TEA",
"account_type": "expense",
"company_id": cls.main_company.id,
"name": "Test expense",
"code": "TE.1",
}
)
cls.account_payable = cls.account_model.create(
{
"user_type_id": cls.env.ref("account.data_account_type_payable").id,
"name": "Test payable account",
"code": "TTA",
"account_type": "liability_payable",
"company_id": cls.main_company.id,
"reconcile": True,
"name": "Test payable",
"code": "TP.1",
}
)
(cls.partner_asus + cls.partner_c2c + cls.partner_agrolait).with_company(
Expand Down Expand Up @@ -107,6 +113,11 @@ def setUpClass(cls):
# Trigger the recompute of account type on res.partner.bank
cls.partner_bank_model.search([])._compute_acc_type()

# cls.main_company.write({
# 'account_journal_payment_debit_account_id': cls.payment_debit_account_id.id,
# 'account_journal_payment_credit_account_id': cls.payment_credit_account_id.id
# })

def test_no_pain(self):
self.payment_mode.payment_method_id.pain_version = False
with self.assertRaises(UserError):
Expand Down Expand Up @@ -353,6 +364,7 @@ def create_invoice(
"account_id": cls.account_expense.id,
"price_unit": price_unit,
"quantity": 1,
"tax_ids": [], # no tax
}
data["invoice_line_ids"].append((0, 0, line_data))
inv = cls.env["account.move"].create(data)
Expand Down

0 comments on commit 8a62fb9

Please sign in to comment.