[MIG] account_banking_pain_base

This commit is contained in:
etobella
2017-10-16 17:20:40 +02:00
committed by Enric Tobella
parent f10ac25634
commit 1fabf8ca23
23 changed files with 89 additions and 71 deletions

View File

@@ -25,15 +25,15 @@ This module is part of the OCA/bank-payment suite.
Configuration
=============
#. Go to Accounting > Configuration > Settings.
#. Go to Invoicing/Accounting > Configuration > Settings.
#. On the fields "Initiating Party Issuer" and "Initiating Party Identifier",
in the section *SEPA/PAIN*, you can fill the corresponding identifiers.
If your country requires several identifiers (like Spain), you must:
#. Go to *Accounting > Configuration > Settings*.
#. Go to *Invoicing/Accounting > Configuration > Settings*.
#. On the section *SEPA/PAIN*, check the mark "Multiple identifiers".
#. Now go to *Accounting > Configuration > Management > Payment Modes*.
#. Now go to *Invoicing/Accounting > Configuration > Management > Payment Modes*.
#. Create a payment mode for your specific bank.
#. Fill the specific identifiers on the fields "Initiating Party Identifier"
and "Initiating Party Issuer".
@@ -45,7 +45,7 @@ See 'readme' files of the OCA/bank-payment suite.
.. 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/10.0
:target: https://runbot.odoo-community.org/runbot/173/11.0
Known issues / Roadmap
======================
@@ -79,7 +79,7 @@ Contributors
Maintainer
----------
.. image:: http://odoo-community.org/logo.png
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# © 2013 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import models
from .post_install import set_default_initiating_party

View File

@@ -1,13 +1,12 @@
# -*- coding: utf-8 -*-
# Copyright 2013-2016 Akretion - Alexis de Lattre
# Copyright 2014-2017 Tecnativa - Pedro M. Baeza
# Copyright 2016 Tecnativa - Antonio Espinosa
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
'name': 'Account Banking PAIN Base Module',
'summary': 'Base module for PAIN file generation',
'version': '10.0.1.1.0',
'version': '11.0.1.0.0',
'license': 'AGPL-3',
'author': "Akretion, "
"Noviat, "
@@ -25,7 +24,7 @@
'views/account_payment_order.xml',
'views/bank_payment_line_view.xml',
'views/account_payment_mode.xml',
'views/account_config_settings.xml',
'views/res_config_settings.xml',
'views/account_payment_method.xml',
],
'post_init_hook': 'set_default_initiating_party',

View File

@@ -1,9 +1,7 @@
# -*- coding: utf-8 -*-
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 res_config_settings
from . import account_payment_method

View File

@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
# © 2013-2016 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models, fields

View File

@@ -1,6 +1,5 @@
# -*- 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).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api, _
from odoo.exceptions import UserError

View File

@@ -1,8 +1,7 @@
# -*- 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
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models, fields

View File

@@ -1,8 +1,7 @@
# -*- 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
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api, _, tools
from odoo.exceptions import UserError
@@ -108,7 +107,7 @@ class AccountPaymentOrder(models.Model):
else:
raise UserError(
_("Cannot compute the '%s'.") % field_name)
if not isinstance(value, (str, unicode)):
if not isinstance(value, str):
raise UserError(
_("The type of the field '%s' is %s. It should be a string "
"or unicode.")
@@ -130,7 +129,7 @@ class AccountPaymentOrder(models.Model):
try:
root_to_validate = etree.fromstring(xml_string)
official_pain_schema.assertValid(root_to_validate)
except Exception, e:
except Exception as e:
logger.warning(
"The XML file is invalid against the XML Schema Definition")
logger.warning(xml_string)
@@ -141,7 +140,7 @@ class AccountPaymentOrder(models.Model):
"full error have been written in the server logs. Here "
"is the error, which may give you an idea on the cause "
"of the problem : %s")
% unicode(e))
% str(e))
return True
@api.multi
@@ -189,7 +188,7 @@ class AccountPaymentOrder(models.Model):
# batch_booking is in "Group header" with pain.001.001.02
# and in "Payment info" in pain.001.001.03/04
batch_booking = etree.SubElement(group_header, 'BtchBookg')
batch_booking.text = unicode(self.batch_booking).lower()
batch_booking.text = str(self.batch_booking).lower()
nb_of_transactions = etree.SubElement(
group_header, 'NbOfTxs')
control_sum = etree.SubElement(group_header, 'CtrlSum')
@@ -217,7 +216,7 @@ class AccountPaymentOrder(models.Model):
control_sum = False
if gen_args.get('pain_flavor') != 'pain.001.001.02':
batch_booking = etree.SubElement(payment_info, 'BtchBookg')
batch_booking.text = unicode(self.batch_booking).lower()
batch_booking.text = str(self.batch_booking).lower()
# The "SEPA Customer-to-bank
# Implementation guidelines" for SCT and SDD says that control sum
# and nb_of_transactions should be present

View File

@@ -1,6 +1,5 @@
# -*- 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).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api

View File

@@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
# © 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).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models, fields, api
from odoo import models, fields
import logging
logger = logging.getLogger(__name__)
@@ -22,9 +21,9 @@ class ResCompany(models.Model):
help="This will be used as the 'Initiating Party Identifier' in "
"the PAIN files generated by Odoo.")
@api.one
def _default_initiating_party(self):
'''This method is called from post_install.py'''
self.ensure_one()
party_issuer_per_country = {
'BE': 'KBO-BCE', # KBO-BCE = the registry of companies in Belgium
}

View File

@@ -1,13 +1,12 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
# Copyright 2017 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models, fields
from odoo import fields, models
class AccountConfigSettings(models.TransientModel):
_inherit = 'account.config.settings'
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
initiating_party_issuer = fields.Char(
related='company_id.initiating_party_issuer')

View File

@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
# © 2015-2016 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, SUPERUSER_ID
@@ -9,6 +8,6 @@ from odoo import api, SUPERUSER_ID
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()
for company in env['res.company'].search([]):
company._default_initiating_party()
return

View File

@@ -1,25 +0,0 @@
<?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" string="SEPA/PAIN">
<field name="initiating_party_identifier"/>
<field name="initiating_party_issuer"/>
<field name="group_pain_multiple_identifier"/>
</group>
</xpath>
</field>
</record>
</odoo>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
© 2013-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
-->
<odoo>

View File

@@ -2,7 +2,7 @@
<!--
Copyright (C) 2013-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
Copyright 2015-2017 Tecnativa
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
-->
<odoo>

View File

@@ -1,7 +1,7 @@
<?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).
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
-->
<odoo>

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
© 2015-2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
-->
<odoo>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
© 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
License AGPL-3.0 or later (https://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">res.config.settings</field>
<field name="inherit_id" ref="account.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@id='analytic']" position="after">
<h2>SEPA/PAIN</h2>
<div class="row mt16 o_settings_container"
id="pain">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_right_pane">
<div class="content-group">
<div class="row mt16">
<label for="initiating_party_identifier"
class="col-md-3 o_light_label"/>
<field name="initiating_party_identifier"/>
</div>
<div class="row mt16">
<label for="initiating_party_issuer"
class="col-md-3 o_light_label"/>
<field name="initiating_party_issuer"/>
</div>
<div class="row mt16">
<label for="group_pain_multiple_identifier"
class="col-md-3 o_light_label"/>
<field name="group_pain_multiple_identifier"/>
</div>
</div>
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>

View File

@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

View File

@@ -0,0 +1 @@
__import__('pkg_resources').declare_namespace(__name__)

View File

@@ -0,0 +1 @@
../../../../account_banking_pain_base

View File

@@ -0,0 +1,2 @@
[bdist_wheel]
universal=1

View File

@@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)