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
Pedro M. Baeza
parent
9b3782af25
commit
8b7dca6635
@@ -1,18 +1,17 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2013-2016 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza
|
||||
# © 2016 Antiun Ingenieria S.L. - Antonio Espinosa
|
||||
# © 2014 Tecnativa - Pedro M. Baeza
|
||||
# © 2016 Tecnativa - Antonio Espinosa
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
{
|
||||
'name': 'Account Banking PAIN Base Module',
|
||||
'summary': 'Base module for PAIN file generation',
|
||||
'version': '9.0.1.0.0',
|
||||
'version': '10.0.1.0.0',
|
||||
'license': 'AGPL-3',
|
||||
'author': "Akretion, "
|
||||
"Noviat, "
|
||||
"Serv. Tecnol. Avanzados - Pedro M. Baeza, "
|
||||
"Antiun Ingeniería S.L., "
|
||||
"Tecnativa, "
|
||||
"Odoo Community Association (OCA)",
|
||||
'website': 'https://github.com/OCA/bank-payment',
|
||||
'contributors': ['Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>'],
|
||||
@@ -26,7 +25,7 @@
|
||||
'views/account_payment_order.xml',
|
||||
'views/bank_payment_line_view.xml',
|
||||
'views/account_payment_mode.xml',
|
||||
'views/res_company_view.xml',
|
||||
'views/account_config_settings.xml',
|
||||
'views/account_payment_method.xml',
|
||||
],
|
||||
'post_init_hook': 'set_default_initiating_party',
|
||||
@@ -1,15 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2015 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from openerp.addons.account_banking_pain_base.post_install\
|
||||
import set_default_initiating_party
|
||||
from openerp import pooler
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
if not version:
|
||||
return
|
||||
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
set_default_initiating_party(cr, pool)
|
||||
@@ -1,10 +1,9 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2013-2016 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import account_payment_line
|
||||
from . import account_payment_order
|
||||
from . import bank_payment_line
|
||||
from . import account_payment_mode
|
||||
from . import res_company
|
||||
from . import account_config_settings
|
||||
from . import account_payment_method
|
||||
|
||||
14
account_banking_pain_base/models/account_config_settings.py
Normal file
14
account_banking_pain_base/models/account_config_settings.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2016 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class AccountConfigSettings(models.TransientModel):
|
||||
_inherit = 'account.config.settings'
|
||||
|
||||
initiating_party_issuer = fields.Char(
|
||||
related='company_id.initiating_party_issuer')
|
||||
initiating_party_identifier = fields.Char(
|
||||
related='company_id.initiating_party_identifier')
|
||||
@@ -3,7 +3,7 @@
|
||||
# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from openerp import models, fields
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class AccountPaymentLine(models.Model):
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
# © 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 openerp.exceptions import UserError
|
||||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountPaymentMethod(models.Model):
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# © 2016 Antiun Ingenieria S.L. - Antonio Espinosa
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from openerp import models, fields
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class AccountPaymentMode(models.Model):
|
||||
|
||||
@@ -4,12 +4,11 @@
|
||||
# © 2016 Antiun Ingenieria S.L. - Antonio Espinosa
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from openerp import models, fields, api, _
|
||||
from openerp.exceptions import UserError
|
||||
from openerp.tools.safe_eval import safe_eval
|
||||
from odoo import models, fields, api, _, tools
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.tools.safe_eval import safe_eval
|
||||
from datetime import datetime
|
||||
from lxml import etree
|
||||
from openerp import tools
|
||||
import logging
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2013-2015 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# © 2013-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 BankPaymentLine(models.Model):
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2013-2015 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# © 2013-2016 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
# © 2013 Noviat (http://www.noviat.com) - Luc de Meyer
|
||||
# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza
|
||||
# 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
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -22,32 +22,31 @@ class ResCompany(models.Model):
|
||||
help="This will be used as the 'Initiating Party Identifier' in "
|
||||
"the PAIN files generated by Odoo.")
|
||||
|
||||
@api.model
|
||||
def _default_initiating_party(self, company):
|
||||
'''This method is called from post_install.py, which itself is also
|
||||
called from migrations/8.0.0.2/post-migration.py'''
|
||||
@api.one
|
||||
def _default_initiating_party(self):
|
||||
'''This method is called from post_install.py'''
|
||||
party_issuer_per_country = {
|
||||
'BE': 'KBO-BCE', # KBO-BCE = the registry of companies in Belgium
|
||||
}
|
||||
logger.debug(
|
||||
'Calling _default_initiating_party on company %s', company.name)
|
||||
country_code = company.country_id.code
|
||||
if not company.initiating_party_issuer:
|
||||
'Calling _default_initiating_party on company %s', self.name)
|
||||
country_code = self.country_id.code
|
||||
if not self.initiating_party_issuer:
|
||||
if country_code and country_code in party_issuer_per_country:
|
||||
company.write({
|
||||
self.write({
|
||||
'initiating_party_issuer':
|
||||
party_issuer_per_country[country_code]})
|
||||
logger.info(
|
||||
'Updated initiating_party_issuer on company %s',
|
||||
company.name)
|
||||
self.name)
|
||||
party_identifier = False
|
||||
if not company.initiating_party_identifier:
|
||||
if company.vat and country_code:
|
||||
if not self.initiating_party_identifier:
|
||||
if self.vat and country_code:
|
||||
if country_code == 'BE':
|
||||
party_identifier = company.vat[2:].replace(' ', '')
|
||||
party_identifier = self.vat[2:].replace(' ', '')
|
||||
if party_identifier:
|
||||
company.write({
|
||||
self.write({
|
||||
'initiating_party_identifier': party_identifier})
|
||||
logger.info(
|
||||
'Updated initiating_party_identifier on company %s',
|
||||
company.name)
|
||||
self.name)
|
||||
|
||||
@@ -3,13 +3,12 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
|
||||
from openerp import SUPERUSER_ID
|
||||
from odoo import api, SUPERUSER_ID
|
||||
|
||||
|
||||
def set_default_initiating_party(cr, pool):
|
||||
company_ids = pool['res.company'].search(cr, SUPERUSER_ID, [])
|
||||
companies = pool['res.company'].browse(cr, SUPERUSER_ID, company_ids)
|
||||
for company in companies:
|
||||
pool['res.company']._default_initiating_party(
|
||||
cr, SUPERUSER_ID, company)
|
||||
def set_default_initiating_party(cr, registry):
|
||||
with api.Environment.manage():
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
companies = env['res.company'].search([])
|
||||
companies._default_initiating_party()
|
||||
return
|
||||
|
||||
24
account_banking_pain_base/views/account_config_settings.xml
Normal file
24
account_banking_pain_base/views/account_config_settings.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
© 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="view_account_config_settings" model="ir.ui.view">
|
||||
<field name="name">pain.group.on.account.config.settings</field>
|
||||
<field name="model">account.config.settings</field>
|
||||
<field name="inherit_id" ref="account.view_account_config_settings"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//separator[@name='analytic_account']" position="before">
|
||||
<group name="pain">
|
||||
<field name="initiating_party_identifier"/>
|
||||
<field name="initiating_party_issuer"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</odoo>
|
||||
@@ -1,11 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2013-2016 Akretion (http://www.akretion.com)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
The licence is in the file __openerp__.py
|
||||
© 2013-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
<openerp>
|
||||
<data>
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="account_payment_line_form" model="ir.ui.view">
|
||||
<field name="name">pain.base.account.payment.line</field>
|
||||
@@ -19,5 +18,5 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="account_payment_method_form" model="ir.ui.view">
|
||||
@@ -28,5 +27,4 @@
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2013-2016 Akretion (http://www.akretion.com)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
Copyright (C) 2013-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
© 2015 Antiun Ingenieria S.L. - Antonio Espinosa
|
||||
The licence is in the file __openerp__.py
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
<openerp>
|
||||
<data>
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="account_payment_mode_form" model="ir.ui.view">
|
||||
@@ -23,5 +21,4 @@
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2016 Akretion (http://www.akretion.com)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
The licence is in the file __openerp__.py
|
||||
© 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
<openerp>
|
||||
<data>
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="account_payment_order_form" model="ir.ui.view">
|
||||
<field name="name">pain.base.account.payment.order.form</field>
|
||||
@@ -20,5 +19,5 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015-2016 Akretion (http://www.akretion.com)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
The licence is in the file __openerp__.py
|
||||
© 2015-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
-->
|
||||
<openerp>
|
||||
<data>
|
||||
<odoo>
|
||||
|
||||
|
||||
<record id="bank_payment_line_form" model="ir.ui.view">
|
||||
<field name="name">pain.base.bank.payment.line.form</field>
|
||||
@@ -19,5 +18,5 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
</odoo>
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2013-2015 Akretion (http://www.akretion.com)
|
||||
@author: Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
The licence is in the file __openerp__.py
|
||||
-->
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_company_form" model="ir.ui.view">
|
||||
<field name="name">pain.group.on.res.company.form</field>
|
||||
<field name="model">res.company</field>
|
||||
<field name="inherit_id" ref="base.view_company_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<group name="account_grp" position="after">
|
||||
<group name="pain" string="Payment Initiation">
|
||||
<field name="initiating_party_identifier"/>
|
||||
<field name="initiating_party_issuer"/>
|
||||
</group>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user