Skip to content

Commit

Permalink
Port almost all modules to v10 (OCA#305)
Browse files Browse the repository at this point in the history
Port almost all modules to v10

* Update to EPC Rulebook v9.2 that start to apply on 2016-11-20 (bug OCA#300)
  • Loading branch information
Alexis de Lattre authored and trisdoan committed Mar 6, 2024
1 parent b73560d commit 9b07f39
Show file tree
Hide file tree
Showing 18 changed files with 98 additions and 113 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
# -*- coding: utf-8 -*-
# © 2013-2016 Akretion - Alexis de Lattre <[email protected]>
# © 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 <[email protected]>'],
Expand All @@ -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',
Expand Down
15 changes: 0 additions & 15 deletions account_banking_pain_base/migrations/8.0.0.2/post-migration.py

This file was deleted.

3 changes: 1 addition & 2 deletions account_banking_pain_base/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# -*- coding: utf-8 -*-
# © 2013-2016 Akretion - Alexis de Lattre <[email protected]>
# 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 changes: 14 additions & 0 deletions account_banking_pain_base/models/account_config_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
# © 2016 Akretion - Alexis de Lattre <[email protected]>
# 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')
2 changes: 1 addition & 1 deletion account_banking_pain_base/models/account_payment_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions account_banking_pain_base/models/account_payment_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# © 2016 Akretion (Alexis de Lattre <[email protected]>)
# 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):
Expand Down
2 changes: 1 addition & 1 deletion account_banking_pain_base/models/account_payment_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
7 changes: 3 additions & 4 deletions account_banking_pain_base/models/account_payment_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
4 changes: 2 additions & 2 deletions account_banking_pain_base/models/bank_payment_line.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
# © 2013-2015 Akretion - Alexis de Lattre <[email protected]>
# © 2013-2016 Akretion - Alexis de Lattre <[email protected]>
# 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):
Expand Down
31 changes: 15 additions & 16 deletions account_banking_pain_base/models/res_company.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
# © 2013-2015 Akretion - Alexis de Lattre <[email protected]>
# © 2013-2016 Akretion - Alexis de Lattre <[email protected]>
# © 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__)
Expand All @@ -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)
13 changes: 6 additions & 7 deletions account_banking_pain_base/post_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 24 additions & 0 deletions account_banking_pain_base/views/account_config_settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
© 2016 Akretion (Alexis de Lattre <[email protected]>)
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>
13 changes: 6 additions & 7 deletions account_banking_pain_base/views/account_payment_line.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2013-2016 Akretion (http://www.akretion.com)
@author: Alexis de Lattre <[email protected]>
The licence is in the file __openerp__.py
© 2013-2016 Akretion (Alexis de Lattre <[email protected]>)
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>
Expand All @@ -19,5 +18,5 @@
</field>
</record>

</data>
</openerp>

</odoo>
6 changes: 2 additions & 4 deletions account_banking_pain_base/views/account_payment_method.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<odoo>


<record id="account_payment_method_form" model="ir.ui.view">
Expand Down Expand Up @@ -28,5 +27,4 @@
</record>


</data>
</openerp>
</odoo>
11 changes: 4 additions & 7 deletions account_banking_pain_base/views/account_payment_mode.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2013-2016 Akretion (http://www.akretion.com)
@author: Alexis de Lattre <[email protected]>
Copyright (C) 2013-2016 Akretion (Alexis de Lattre <[email protected]>)
© 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">
Expand All @@ -23,5 +21,4 @@
</record>


</data>
</openerp>
</odoo>
13 changes: 6 additions & 7 deletions account_banking_pain_base/views/account_payment_order.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2016 Akretion (http://www.akretion.com)
@author: Alexis de Lattre <[email protected]>
The licence is in the file __openerp__.py
© 2016 Akretion (Alexis de Lattre <[email protected]>)
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>
Expand All @@ -20,5 +19,5 @@
</field>
</record>

</data>
</openerp>

</odoo>
13 changes: 6 additions & 7 deletions account_banking_pain_base/views/bank_payment_line_view.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015-2016 Akretion (http://www.akretion.com)
@author: Alexis de Lattre <[email protected]>
The licence is in the file __openerp__.py
© 2015-2016 Akretion (Alexis de Lattre <[email protected]>)
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>
Expand All @@ -19,5 +18,5 @@
</field>
</record>

</data>
</openerp>

</odoo>
25 changes: 0 additions & 25 deletions account_banking_pain_base/views/res_company_view.xml

This file was deleted.

0 comments on commit 9b07f39

Please sign in to comment.