mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
Port almost all modules to v10 (#305)
Port almost all modules to v10 * Update to EPC Rulebook v9.2 that start to apply on 2016-11-20 (bug #300)
This commit is contained in:
committed by
Enric Tobella
parent
d22e3226af
commit
4fc963b816
@@ -49,7 +49,7 @@ Transfer that you created during the configuration step.
|
||||
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||
:alt: Try me on Runbot
|
||||
:target: https://runbot.odoo-community.org/runbot/173/9.0
|
||||
:target: https://runbot.odoo-community.org/runbot/173/10.0
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
{
|
||||
'name': 'Account Banking SEPA Credit Transfer',
|
||||
'summary': 'Create SEPA XML files for Credit Transfers',
|
||||
'version': '9.0.1.0.0',
|
||||
'version': '10.0.1.0.0',
|
||||
'license': 'AGPL-3',
|
||||
'author': "Akretion, "
|
||||
"Serv. Tecnol. Avanzados - Pedro M. Baeza, "
|
||||
"Tecnativa, "
|
||||
"Antiun Ingeniería S.L., "
|
||||
"Odoo Community Association (OCA)",
|
||||
'website': 'https://github.com/OCA/bank-payment',
|
||||
@@ -24,5 +24,5 @@
|
||||
'demo/sepa_credit_transfer_demo.xml'
|
||||
],
|
||||
'post_init_hook': 'update_bank_journals',
|
||||
'installable': False,
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
<odoo noupdate="1">
|
||||
|
||||
|
||||
<record id="sepa_credit_transfer" model="account.payment.method">
|
||||
@@ -12,5 +11,4 @@
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo noupdate="1">
|
||||
|
||||
<openerp>
|
||||
<data noupdate="1">
|
||||
|
||||
<record id="payment_mode_outbound_sepa_ct1" model="account.payment.mode">
|
||||
<field name="name">SEPA Credit Transfer to suppliers</field>
|
||||
@@ -21,5 +20,5 @@
|
||||
<field name="supplier_payment_mode_id" ref="payment_mode_outbound_sepa_ct1"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (C) 2015 Akretion (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp import pooler, SUPERUSER_ID
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
if not version:
|
||||
return
|
||||
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
cr.execute('''
|
||||
SELECT
|
||||
old_sepa.file,
|
||||
rel.account_order_id AS payment_order_id,
|
||||
payment_order.reference
|
||||
FROM migration_banking_export_sepa old_sepa
|
||||
LEFT JOIN migration_account_payment_order_sepa_rel rel
|
||||
ON old_sepa.id=rel.banking_export_sepa_id
|
||||
LEFT JOIN payment_order ON payment_order.id=rel.account_order_id
|
||||
''')
|
||||
|
||||
for sepa_file in cr.dictfetchall():
|
||||
if not sepa_file['payment_order_id']:
|
||||
continue
|
||||
filename = 'sct_%s.xml' % sepa_file['reference'].replace('/', '-')
|
||||
pool['ir.attachment'].create(
|
||||
cr, SUPERUSER_ID, {
|
||||
'name': filename,
|
||||
'res_id': sepa_file['payment_order_id'],
|
||||
'res_model': 'payment.order',
|
||||
'datas': str(sepa_file['file']),
|
||||
})
|
||||
return
|
||||
@@ -1,32 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (C) 2015 Akretion (http://www.akretion.com/)
|
||||
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
if not version:
|
||||
return
|
||||
|
||||
cr.execute(
|
||||
'ALTER TABLE banking_export_sepa '
|
||||
'RENAME TO migration_banking_export_sepa')
|
||||
cr.execute(
|
||||
'ALTER TABLE account_payment_order_sepa_rel '
|
||||
'RENAME TO migration_account_payment_order_sepa_rel')
|
||||
@@ -2,7 +2,7 @@
|
||||
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from openerp import models, fields, api
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class AccountPaymentMethod(models.Model):
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from openerp import models, api, _
|
||||
from openerp.exceptions import UserError
|
||||
from odoo import models, api, _
|
||||
from odoo.exceptions import UserError
|
||||
from lxml import etree
|
||||
|
||||
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp import SUPERUSER_ID
|
||||
from odoo import api, SUPERUSER_ID
|
||||
|
||||
|
||||
def update_bank_journals(cr, pool):
|
||||
ajo = pool['account.journal']
|
||||
journal_ids = ajo.search(
|
||||
cr, SUPERUSER_ID, [('type', '=', 'bank')])
|
||||
sct_id = pool['ir.model.data'].xmlid_to_res_id(
|
||||
cr, SUPERUSER_ID,
|
||||
'account_banking_sepa_credit_transfer.sepa_credit_transfer')
|
||||
if sct_id:
|
||||
ajo.write(cr, SUPERUSER_ID, journal_ids, {
|
||||
'outbound_payment_method_ids': [(4, sct_id)],
|
||||
})
|
||||
def update_bank_journals(cr, registry):
|
||||
with api.Environment.manage():
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
ajo = env['account.journal']
|
||||
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)],
|
||||
})
|
||||
return
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp.addons.account.tests.account_test_classes\
|
||||
from odoo.addons.account.tests.account_test_classes\
|
||||
import AccountingTestCase
|
||||
from openerp.tools import float_compare
|
||||
from odoo.tools import float_compare
|
||||
import time
|
||||
from lxml import etree
|
||||
|
||||
@@ -56,6 +56,9 @@ class TestSCT(AccountingTestCase):
|
||||
self.eur_currency = self.env.ref('base.EUR')
|
||||
self.usd_currency = self.env.ref('base.USD')
|
||||
self.main_company.currency_id = self.eur_currency.id
|
||||
# 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
|
||||
|
||||
def test_eur_currency_sct(self):
|
||||
invoice1 = self.create_invoice(
|
||||
@@ -126,7 +129,6 @@ class TestSCT(AccountingTestCase):
|
||||
self.assertEquals(attachment.datas_fname[-4:], '.xml')
|
||||
xml_file = attachment.datas.decode('base64')
|
||||
xml_root = etree.fromstring(xml_file)
|
||||
# print "xml_file=", etree.tostring(xml_root, pretty_print=True)
|
||||
namespaces = xml_root.nsmap
|
||||
namespaces['p'] = xml_root.nsmap[None]
|
||||
namespaces.pop(None)
|
||||
@@ -204,7 +206,6 @@ class TestSCT(AccountingTestCase):
|
||||
self.assertEquals(attachment.datas_fname[-4:], '.xml')
|
||||
xml_file = attachment.datas.decode('base64')
|
||||
xml_root = etree.fromstring(xml_file)
|
||||
# print "xml_file=", etree.tostring(xml_root, pretty_print=True)
|
||||
namespaces = xml_root.nsmap
|
||||
namespaces['p'] = xml_root.nsmap[None]
|
||||
namespaces.pop(None)
|
||||
@@ -247,5 +248,5 @@ class TestSCT(AccountingTestCase):
|
||||
'name': 'Great service',
|
||||
'account_id': self.account_expense.id,
|
||||
})
|
||||
invoice.signal_workflow('invoice_open')
|
||||
invoice.action_invoice_open()
|
||||
return invoice
|
||||
|
||||
Reference in New Issue
Block a user