mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[MIG] account_banking_sepa_credit_transfer: Migration to 13.0
This commit is contained in:
committed by
Carlos Roca
parent
b506c7730f
commit
79d5b17c65
@@ -1,19 +1,19 @@
|
||||
# Copyright 2010-2016 Akretion (www.akretion.com)
|
||||
# Copyright 2016 Tecnativa - Antonio Espinosa
|
||||
# Copyright 2014-2018 Tecnativa - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html)
|
||||
|
||||
{
|
||||
"name": "Account Banking SEPA Credit Transfer",
|
||||
"summary": "Create SEPA XML files for Credit Transfers",
|
||||
"version": "12.0.1.0.0",
|
||||
"version": "13.0.1.0.0",
|
||||
"license": "AGPL-3",
|
||||
"author": "Akretion, " "Tecnativa, " "Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/bank-payment",
|
||||
"category": "Banking addons",
|
||||
"conflicts": ["account_sepa"],
|
||||
"depends": ["account_banking_pain_base"],
|
||||
"data": ["data/account_payment_method.xml",],
|
||||
"data": ["data/account_payment_method.xml"],
|
||||
"demo": ["demo/sepa_credit_transfer_demo.xml"],
|
||||
"post_init_hook": "update_bank_journals",
|
||||
"installable": True,
|
||||
|
||||
@@ -106,4 +106,3 @@ msgstr ""
|
||||
#: selection:account.payment.method,pain_version:0
|
||||
msgid "pain.008.003.02 (direct debit in Germany)"
|
||||
msgstr ""
|
||||
|
||||
|
||||
@@ -1,109 +0,0 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_banking_sepa_credit_transfer
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 12.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
"Language-Team: none\n"
|
||||
"Language: ca\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:155
|
||||
#, python-format
|
||||
msgid "Bank account is missing on the bank payment line of partner '%s' (reference '%s')."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:account.payment.line,local_instrument:0
|
||||
msgid "Instant Transfer"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: model:ir.model.fields,field_description:account_banking_sepa_credit_transfer.field_account_payment_line__local_instrument
|
||||
msgid "Local Instrument"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: model:ir.model.fields,field_description:account_banking_sepa_credit_transfer.field_account_payment_method__pain_version
|
||||
msgid "PAIN Version"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:26
|
||||
#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:60
|
||||
#, python-format
|
||||
msgid "PAIN version '%s' is not supported."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_line
|
||||
msgid "Payment Lines"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_method
|
||||
msgid "Payment Methods"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_order
|
||||
msgid "Payment Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: model:account.payment.method,name:account_banking_sepa_credit_transfer.sepa_credit_transfer
|
||||
#: model:account.payment.mode,name:account_banking_sepa_credit_transfer.payment_mode_outbound_sepa_ct1
|
||||
msgid "SEPA Credit Transfer to suppliers"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:account.payment.method,pain_version:0
|
||||
msgid "pain.001.001.02"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:account.payment.method,pain_version:0
|
||||
msgid "pain.001.001.03 (recommended for credit transfer)"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:account.payment.method,pain_version:0
|
||||
msgid "pain.001.001.04"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:account.payment.method,pain_version:0
|
||||
msgid "pain.001.001.05"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:account.payment.method,pain_version:0
|
||||
msgid "pain.001.003.03 (credit transfer in Germany)"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:account.payment.method,pain_version:0
|
||||
msgid "pain.008.001.02 (recommended for direct debit)"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:account.payment.method,pain_version:0
|
||||
msgid "pain.008.001.03"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:account.payment.method,pain_version:0
|
||||
msgid "pain.008.001.04"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:account.payment.method,pain_version:0
|
||||
msgid "pain.008.003.02 (direct debit in Germany)"
|
||||
msgstr ""
|
||||
@@ -1,109 +0,0 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_banking_sepa_credit_transfer
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 12.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"Last-Translator: Automatically generated\n"
|
||||
"Language-Team: none\n"
|
||||
"Language: ca_ES\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:155
|
||||
#, python-format
|
||||
msgid "Bank account is missing on the bank payment line of partner '%s' (reference '%s')."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:account.payment.line,local_instrument:0
|
||||
msgid "Instant Transfer"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: model:ir.model.fields,field_description:account_banking_sepa_credit_transfer.field_account_payment_line__local_instrument
|
||||
msgid "Local Instrument"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: model:ir.model.fields,field_description:account_banking_sepa_credit_transfer.field_account_payment_method__pain_version
|
||||
msgid "PAIN Version"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:26
|
||||
#: code:addons/account_banking_sepa_credit_transfer/models/account_payment_order.py:60
|
||||
#, python-format
|
||||
msgid "PAIN version '%s' is not supported."
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_line
|
||||
msgid "Payment Lines"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_method
|
||||
msgid "Payment Methods"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: model:ir.model,name:account_banking_sepa_credit_transfer.model_account_payment_order
|
||||
msgid "Payment Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: model:account.payment.method,name:account_banking_sepa_credit_transfer.sepa_credit_transfer
|
||||
#: model:account.payment.mode,name:account_banking_sepa_credit_transfer.payment_mode_outbound_sepa_ct1
|
||||
msgid "SEPA Credit Transfer to suppliers"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:account.payment.method,pain_version:0
|
||||
msgid "pain.001.001.02"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:account.payment.method,pain_version:0
|
||||
msgid "pain.001.001.03 (recommended for credit transfer)"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:account.payment.method,pain_version:0
|
||||
msgid "pain.001.001.04"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:account.payment.method,pain_version:0
|
||||
msgid "pain.001.001.05"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:account.payment.method,pain_version:0
|
||||
msgid "pain.001.003.03 (credit transfer in Germany)"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:account.payment.method,pain_version:0
|
||||
msgid "pain.008.001.02 (recommended for direct debit)"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:account.payment.method,pain_version:0
|
||||
msgid "pain.008.001.03"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:account.payment.method,pain_version:0
|
||||
msgid "pain.008.001.04"
|
||||
msgstr ""
|
||||
|
||||
#. module: account_banking_sepa_credit_transfer
|
||||
#: selection:account.payment.method,pain_version:0
|
||||
msgid "pain.008.003.02 (direct debit in Germany)"
|
||||
msgstr ""
|
||||
@@ -1,5 +1,5 @@
|
||||
# Copyright 2017 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
@@ -7,7 +7,7 @@ from odoo import fields, models
|
||||
class AccountPaymentLine(models.Model):
|
||||
_inherit = "account.payment.line"
|
||||
|
||||
# local_instrument 'INST' used for instant credit transfers
|
||||
# Local_instrument 'INST' used for instant credit transfers
|
||||
# which will begin on November 21st 2017, cf
|
||||
# https://www.europeanpaymentscouncil.eu/document-library/
|
||||
# rulebooks/2017-sepa-instant-credit-transfer-rulebook
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# 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 api, fields, models
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class AccountPaymentMethod(models.Model):
|
||||
@@ -17,7 +17,6 @@ class AccountPaymentMethod(models.Model):
|
||||
]
|
||||
)
|
||||
|
||||
@api.multi
|
||||
def get_xsd_file_path(self):
|
||||
self.ensure_one()
|
||||
if self.pain_version in [
|
||||
|
||||
@@ -4,15 +4,14 @@
|
||||
|
||||
from lxml import etree
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
from odoo import _, fields, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountPaymentOrder(models.Model):
|
||||
_inherit = "account.payment.order"
|
||||
|
||||
@api.multi
|
||||
def generate_payment_file(self):
|
||||
def generate_payment_file(self): # noqa: C901
|
||||
"""Creates the SEPA Credit Transfer file. That's the important code!"""
|
||||
self.ensure_one()
|
||||
if self.payment_method_id.code != "sepa_credit_transfer":
|
||||
@@ -72,11 +71,8 @@ class AccountPaymentOrder(models.Model):
|
||||
xml_root = etree.Element("Document", nsmap=nsmap, attrib=attrib)
|
||||
pain_root = etree.SubElement(xml_root, root_xml_tag)
|
||||
# A. Group header
|
||||
(
|
||||
group_header,
|
||||
nb_of_transactions_a,
|
||||
control_sum_a,
|
||||
) = self.generate_group_header_block(pain_root, gen_args)
|
||||
header = self.generate_group_header_block(pain_root, gen_args)
|
||||
group_header, nb_of_transactions_a, control_sum_a = header
|
||||
transactions_count_a = 0
|
||||
amount_control_sum_a = 0.0
|
||||
lines_per_group = {}
|
||||
|
||||
@@ -11,7 +11,5 @@ 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_ids": [(4, sct.id)]})
|
||||
return
|
||||
|
||||
@@ -10,3 +10,9 @@
|
||||
|
||||
* Antonio Espinosa
|
||||
* Pedro M. Baeza
|
||||
* `DynApps NV <https://www.dynapps.be>`_:
|
||||
|
||||
* Axel Priem <axel.priem@dynapps.be>
|
||||
* `Sygel Technology <https://www.sygel.es>`_:
|
||||
|
||||
* Valentin Vinagre <valentin.vinagre@sygel.es>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# Copyright 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# Copyright 2018 Tecnativa - Pedro M. Baeza
|
||||
# Copyright 2020 Sygel Technology - Valentin Vinagre
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
import base64
|
||||
@@ -8,93 +9,94 @@ import time
|
||||
from lxml import etree
|
||||
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tests import common
|
||||
from odoo.tests.common import SavepointCase
|
||||
from odoo.tools import float_compare
|
||||
|
||||
|
||||
class TestSCT(common.HttpCase):
|
||||
def setUp(self):
|
||||
super(TestSCT, self).setUp()
|
||||
self.account_model = self.env["account.account"]
|
||||
self.move_model = self.env["account.move"]
|
||||
self.journal_model = self.env["account.journal"]
|
||||
self.payment_order_model = self.env["account.payment.order"]
|
||||
self.payment_line_model = self.env["account.payment.line"]
|
||||
self.bank_line_model = self.env["bank.payment.line"]
|
||||
self.partner_bank_model = self.env["res.partner.bank"]
|
||||
self.attachment_model = self.env["ir.attachment"]
|
||||
self.invoice_model = self.env["account.invoice"]
|
||||
self.invoice_line_model = self.env["account.invoice.line"]
|
||||
self.partner_agrolait = self.env.ref("base.res_partner_2")
|
||||
self.partner_asus = self.env.ref("base.res_partner_1")
|
||||
self.partner_c2c = self.env.ref("base.res_partner_12")
|
||||
self.eur_currency = self.env.ref("base.EUR")
|
||||
self.usd_currency = self.env.ref("base.USD")
|
||||
self.main_company = self.env["res.company"].create(
|
||||
{"name": "Test EUR company", "currency_id": self.eur_currency.id,}
|
||||
class TestSCT(SavepointCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.account_model = cls.env["account.account"]
|
||||
cls.move_model = cls.env["account.move"]
|
||||
cls.journal_model = cls.env["account.journal"]
|
||||
cls.payment_order_model = cls.env["account.payment.order"]
|
||||
cls.payment_line_model = cls.env["account.payment.line"]
|
||||
cls.bank_line_model = cls.env["bank.payment.line"]
|
||||
cls.partner_bank_model = cls.env["res.partner.bank"]
|
||||
cls.attachment_model = cls.env["ir.attachment"]
|
||||
cls.invoice_model = cls.env["account.move"]
|
||||
cls.invoice_line_model = cls.env["account.move.line"]
|
||||
cls.partner_agrolait = cls.env.ref("base.res_partner_2")
|
||||
cls.partner_asus = cls.env.ref("base.res_partner_1")
|
||||
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}
|
||||
)
|
||||
self.partner_agrolait.company_id = self.main_company.id
|
||||
self.partner_asus.company_id = self.main_company.id
|
||||
self.partner_c2c.company_id = self.main_company.id
|
||||
self.env.user.write(
|
||||
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
|
||||
cls.env.user.write(
|
||||
{
|
||||
"company_ids": [(6, 0, self.main_company.ids)],
|
||||
"company_id": self.main_company.id,
|
||||
"company_ids": [(6, 0, cls.main_company.ids)],
|
||||
"company_id": cls.main_company.id,
|
||||
}
|
||||
)
|
||||
self.env.ref(
|
||||
cls.env.ref(
|
||||
"l10n_generic_coa.configurable_chart_template"
|
||||
).try_loading_for_current_company()
|
||||
self.account_expense = self.account_model.search(
|
||||
cls.account_expense = cls.account_model.search(
|
||||
[
|
||||
(
|
||||
"user_type_id",
|
||||
"=",
|
||||
self.env.ref("account.data_account_type_expenses").id,
|
||||
cls.env.ref("account.data_account_type_expenses").id,
|
||||
),
|
||||
("company_id", "=", self.main_company.id),
|
||||
("company_id", "=", cls.main_company.id),
|
||||
],
|
||||
limit=1,
|
||||
)
|
||||
self.account_payable = self.account_model.search(
|
||||
cls.account_payable = cls.account_model.search(
|
||||
[
|
||||
(
|
||||
"user_type_id",
|
||||
"=",
|
||||
self.env.ref("account.data_account_type_payable").id,
|
||||
cls.env.ref("account.data_account_type_payable").id,
|
||||
),
|
||||
("company_id", "=", self.main_company.id),
|
||||
("company_id", "=", cls.main_company.id),
|
||||
],
|
||||
limit=1,
|
||||
)
|
||||
self.partner_bank = self.env.ref("account_payment_mode.main_company_iban").copy(
|
||||
cls.partner_bank = cls.env.ref("account_payment_mode.main_company_iban").copy(
|
||||
{
|
||||
"company_id": self.main_company.id,
|
||||
"partner_id": self.main_company.partner_id.id,
|
||||
"company_id": cls.main_company.id,
|
||||
"partner_id": cls.main_company.partner_id.id,
|
||||
"bank_id": (
|
||||
self.env.ref("account_payment_mode.bank_la_banque_postale").id
|
||||
cls.env.ref("account_payment_mode.bank_la_banque_postale").id
|
||||
),
|
||||
}
|
||||
)
|
||||
# create journal
|
||||
self.bank_journal = self.journal_model.create(
|
||||
cls.bank_journal = cls.journal_model.create(
|
||||
{
|
||||
"name": "Company Bank journal",
|
||||
"type": "bank",
|
||||
"code": "BNKFB",
|
||||
"bank_account_id": self.partner_bank.id,
|
||||
"bank_id": self.partner_bank.bank_id.id,
|
||||
"bank_account_id": cls.partner_bank.id,
|
||||
"bank_id": cls.partner_bank.bank_id.id,
|
||||
}
|
||||
)
|
||||
# update payment mode
|
||||
self.payment_mode = self.env.ref(
|
||||
cls.payment_mode = cls.env.ref(
|
||||
"account_banking_sepa_credit_transfer." "payment_mode_outbound_sepa_ct1"
|
||||
).copy({"company_id": self.main_company.id,})
|
||||
self.payment_mode.write(
|
||||
{"bank_account_link": "fixed", "fixed_journal_id": self.bank_journal.id,}
|
||||
).copy({"company_id": cls.main_company.id})
|
||||
cls.payment_mode.write(
|
||||
{"bank_account_link": "fixed", "fixed_journal_id": cls.bank_journal.id}
|
||||
)
|
||||
# Trigger the recompute of account type on res.partner.bank
|
||||
self.partner_bank_model.search([])._compute_acc_type()
|
||||
cls.partner_bank_model.search([])._compute_acc_type()
|
||||
|
||||
def test_no_pain(self):
|
||||
self.payment_mode.payment_method_id.pain_version = False
|
||||
@@ -171,7 +173,9 @@ class TestSCT(common.HttpCase):
|
||||
agrolait_pay_line1 = pay_lines[0]
|
||||
accpre = self.env["decimal.precision"].precision_get("Account")
|
||||
self.assertEqual(agrolait_pay_line1.currency_id, self.eur_currency)
|
||||
self.assertEqual(agrolait_pay_line1.partner_bank_id, invoice1.partner_bank_id)
|
||||
self.assertEqual(
|
||||
agrolait_pay_line1.partner_bank_id, invoice1.invoice_partner_bank_id
|
||||
)
|
||||
self.assertEqual(
|
||||
float_compare(
|
||||
agrolait_pay_line1.amount_currency, 42, precision_digits=accpre
|
||||
@@ -197,13 +201,15 @@ class TestSCT(common.HttpCase):
|
||||
)
|
||||
self.assertEqual(agrolait_bank_line.communication_type, "normal")
|
||||
self.assertEqual(agrolait_bank_line.communication, "F1341-F1342-A1301")
|
||||
self.assertEqual(agrolait_bank_line.partner_bank_id, invoice1.partner_bank_id)
|
||||
self.assertEqual(
|
||||
agrolait_bank_line.partner_bank_id, invoice1.invoice_partner_bank_id
|
||||
)
|
||||
|
||||
action = self.payment_order.open2generated()
|
||||
self.assertEqual(self.payment_order.state, "generated")
|
||||
self.assertEqual(action["res_model"], "ir.attachment")
|
||||
attachment = self.attachment_model.browse(action["res_id"])
|
||||
self.assertEqual(attachment.datas_fname[-4:], ".xml")
|
||||
self.assertEqual(attachment.name[-4:], ".xml")
|
||||
xml_file = base64.b64decode(attachment.datas)
|
||||
xml_root = etree.fromstring(xml_file)
|
||||
namespaces = xml_root.nsmap
|
||||
@@ -225,7 +231,10 @@ class TestSCT(common.HttpCase):
|
||||
self.payment_order.generated2uploaded()
|
||||
self.assertEqual(self.payment_order.state, "uploaded")
|
||||
for inv in [invoice1, invoice2, invoice3, invoice4, invoice5]:
|
||||
self.assertEqual(inv.state, "paid")
|
||||
self.assertEqual(inv.state, "posted")
|
||||
self.assertEqual(
|
||||
float_compare(inv.amount_residual, 0.0, precision_digits=accpre), 0,
|
||||
)
|
||||
return
|
||||
|
||||
def test_usd_currency_sct(self):
|
||||
@@ -260,7 +269,9 @@ class TestSCT(common.HttpCase):
|
||||
asus_pay_line1 = pay_lines[0]
|
||||
accpre = self.env["decimal.precision"].precision_get("Account")
|
||||
self.assertEqual(asus_pay_line1.currency_id, self.usd_currency)
|
||||
self.assertEqual(asus_pay_line1.partner_bank_id, invoice1.partner_bank_id)
|
||||
self.assertEqual(
|
||||
asus_pay_line1.partner_bank_id, invoice1.invoice_partner_bank_id
|
||||
)
|
||||
self.assertEqual(
|
||||
float_compare(
|
||||
asus_pay_line1.amount_currency, 2042, precision_digits=accpre
|
||||
@@ -286,13 +297,15 @@ class TestSCT(common.HttpCase):
|
||||
)
|
||||
self.assertEqual(asus_bank_line.communication_type, "normal")
|
||||
self.assertEqual(asus_bank_line.communication, "Inv9032-Inv9033")
|
||||
self.assertEqual(asus_bank_line.partner_bank_id, invoice1.partner_bank_id)
|
||||
self.assertEqual(
|
||||
asus_bank_line.partner_bank_id, invoice1.invoice_partner_bank_id
|
||||
)
|
||||
|
||||
action = self.payment_order.open2generated()
|
||||
self.assertEqual(self.payment_order.state, "generated")
|
||||
self.assertEqual(action["res_model"], "ir.attachment")
|
||||
attachment = self.attachment_model.browse(action["res_id"])
|
||||
self.assertEqual(attachment.datas_fname[-4:], ".xml")
|
||||
self.assertEqual(attachment.name[-4:], ".xml")
|
||||
xml_file = base64.b64decode(attachment.datas)
|
||||
xml_root = etree.fromstring(xml_file)
|
||||
namespaces = xml_root.nsmap
|
||||
@@ -314,11 +327,15 @@ class TestSCT(common.HttpCase):
|
||||
self.payment_order.generated2uploaded()
|
||||
self.assertEqual(self.payment_order.state, "uploaded")
|
||||
for inv in [invoice1, invoice2]:
|
||||
self.assertEqual(inv.state, "paid")
|
||||
self.assertEqual(inv.state, "posted")
|
||||
self.assertEqual(
|
||||
float_compare(inv.amount_residual, 0.0, precision_digits=accpre), 0,
|
||||
)
|
||||
return
|
||||
|
||||
@classmethod
|
||||
def create_invoice(
|
||||
self,
|
||||
cls,
|
||||
partner_id,
|
||||
partner_bank_xmlid,
|
||||
currency_id,
|
||||
@@ -326,28 +343,24 @@ class TestSCT(common.HttpCase):
|
||||
reference,
|
||||
type="in_invoice",
|
||||
):
|
||||
invoice = self.invoice_model.create(
|
||||
{
|
||||
"partner_id": partner_id,
|
||||
"reference_type": "none",
|
||||
"reference": reference,
|
||||
"currency_id": currency_id,
|
||||
"name": "test",
|
||||
"account_id": self.account_payable.id,
|
||||
"type": type,
|
||||
"date_invoice": time.strftime("%Y-%m-%d"),
|
||||
"payment_mode_id": self.payment_mode.id,
|
||||
"partner_bank_id": self.env.ref(partner_bank_xmlid).id,
|
||||
}
|
||||
)
|
||||
self.invoice_line_model.create(
|
||||
{
|
||||
"invoice_id": invoice.id,
|
||||
"price_unit": price_unit,
|
||||
"quantity": 1,
|
||||
"name": "Great service",
|
||||
"account_id": self.account_expense.id,
|
||||
}
|
||||
)
|
||||
invoice.action_invoice_open()
|
||||
return invoice
|
||||
data = {
|
||||
"partner_id": partner_id,
|
||||
"reference_type": "none",
|
||||
"ref": reference,
|
||||
"currency_id": currency_id,
|
||||
"invoice_date": time.strftime("%Y-%m-%d"),
|
||||
"type": type,
|
||||
"payment_mode_id": cls.payment_mode.id,
|
||||
"invoice_partner_bank_id": cls.env.ref(partner_bank_xmlid).id,
|
||||
"invoice_line_ids": [],
|
||||
}
|
||||
line_data = {
|
||||
"name": "Great service",
|
||||
"account_id": cls.account_expense.id,
|
||||
"price_unit": price_unit,
|
||||
"quantity": 1,
|
||||
}
|
||||
data["invoice_line_ids"].append((0, 0, line_data))
|
||||
inv = cls.env["account.move"].create(data)
|
||||
inv.post()
|
||||
return inv
|
||||
|
||||
Reference in New Issue
Block a user