Skip to content

Commit 66a4b18

Browse files
Alexis de Lattreetobella
Alexis de Lattre
authored andcommitted
Port almost all modules to v10 (OCA#305)
Port almost all modules to v10 * Update to EPC Rulebook v9.2 that start to apply on 2016-11-20 (bug OCA#300)
1 parent b3045d2 commit 66a4b18

23 files changed

+101
-244
lines changed

account_banking_sepa_direct_debit/README.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ you created during the configuration step.
4747

4848
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
4949
:alt: Try me on Runbot
50-
:target: https://runbot.odoo-community.org/runbot/173/9.0
50+
:target: https://runbot.odoo-community.org/runbot/173/10.0
5151

5252
Known issues / Roadmap
5353
======================

account_banking_sepa_direct_debit/__manifest__.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
{
88
'name': 'Account Banking SEPA Direct Debit',
99
'summary': 'Create SEPA files for Direct Debit',
10-
'version': '9.0.1.0.0',
10+
'version': '10.0.1.0.0',
1111
'license': 'AGPL-3',
1212
'author': "Akretion, "
13-
"Serv. Tecnol. Avanzados - Pedro M. Baeza, "
13+
"Tecnativa, "
1414
"Antiun Ingeniería S.L., "
1515
"Odoo Community Association (OCA)",
1616
'website': 'https://github.com/OCA/bank-payment',
@@ -21,7 +21,6 @@
2121
],
2222
'data': [
2323
'views/account_banking_mandate_view.xml',
24-
'views/res_company_view.xml',
2524
'views/res_config.xml',
2625
'views/account_payment_mode.xml',
2726
'data/mandate_expire_cron.xml',
@@ -32,5 +31,5 @@
3231
],
3332
'demo': ['demo/sepa_direct_debit_demo.xml'],
3433
'post_init_hook': 'update_bank_journals',
35-
'installable': False,
34+
'installable': True,
3635
}

account_banking_sepa_direct_debit/data/account_payment_method.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<openerp>
2+
<odoo>
33
<data noupdate="1">
44

55

@@ -14,4 +14,4 @@
1414

1515

1616
</data>
17-
</openerp>
17+
</odoo>
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22

33
<!--
4-
Copyright (C) 2013-2016 Akretion (http://www.akretion.com/)
5-
@author Alexis de Lattre <[email protected]>
6-
The licence is in the file __openerp__.py
4+
© 2013-2016 Akretion (Alexis de Lattre <[email protected]>)
5+
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
76
-->
87

9-
<openerp>
8+
<odoo>
109
<data noupdate="1">
1110
<record id="sdd_mandate_expire_cron" model="ir.cron">
1211
<field name="name">Set SEPA Direct Debit Mandates to Expired</field>
@@ -18,7 +17,7 @@
1817
<field name="doall" eval="False"/>
1918
<field name="model" eval="'account.banking.mandate'"/>
2019
<field name="function" eval="'_sdd_mandate_set_state_to_expired'" />
21-
<field name="args" eval="'(None, )'"/>
20+
<field name="args" eval="'()'"/>
2221
</record>
2322
</data>
24-
</openerp>
23+
</odoo>

account_banking_sepa_direct_debit/data/report_paperformat.xml

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<openerp>
3-
<data>
2+
<odoo>
43

54
<record id="paperformat_euro_sepa_lowmargin" model="report.paperformat">
65
<field name="name">European A4 low margin for SEPA</field>
@@ -18,5 +17,4 @@
1817
<field name="dpi">80</field>
1918
</record>
2019

21-
</data>
22-
</openerp>
20+
</odoo>

account_banking_sepa_direct_debit/demo/sepa_direct_debit_demo.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22

3-
<openerp>
3+
<odoo>
44
<data noupdate="1">
55

66
<record id="payment_mode_inbound_sepa_dd1" model="account.payment.mode">
@@ -46,4 +46,4 @@
4646

4747

4848
</data>
49-
</openerp>
49+
</odoo>

account_banking_sepa_direct_debit/migrations/8.0.0.2/post-migration.py

-50
This file was deleted.

account_banking_sepa_direct_debit/migrations/8.0.0.2/pre-migration.py

-32
This file was deleted.

account_banking_sepa_direct_debit/migrations/8.0.0.5/post-migration.py

-13
This file was deleted.

account_banking_sepa_direct_debit/models/account_banking_mandate.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza
44
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
55

6-
from openerp import models, fields, api, exceptions, _
6+
from odoo import models, fields, api, exceptions, _
77
from datetime import datetime
88
from dateutil.relativedelta import relativedelta
99
import logging

account_banking_sepa_direct_debit/models/account_payment_method.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# © 2016 Akretion (Alexis de Lattre <[email protected]>)
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
44

5-
from openerp import models, fields, api
5+
from odoo import models, fields, api
66

77

88
class AccountPaymentMethod(models.Model):

account_banking_sepa_direct_debit/models/account_payment_mode.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# © 2016 Antiun Ingenieria S.L. - Antonio Espinosa
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
44

5-
from openerp import models, fields, api, _
5+
from odoo import models, fields, api, _
66
from .common import is_sepa_creditor_identifier_valid
7-
from openerp.exceptions import ValidationError
7+
from odoo.exceptions import ValidationError
88

99

1010
class AccountPaymentMode(models.Model):

account_banking_sepa_direct_debit/models/account_payment_order.py

+20-42
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# © 2016 Akretion (Alexis de Lattre <[email protected]>)
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
44

5-
from openerp import models, fields, api, _
6-
from openerp.exceptions import UserError
5+
from odoo import models, fields, api, _
6+
from odoo.exceptions import UserError
77
from lxml import etree
88

99

@@ -210,46 +210,24 @@ def generate_payment_file(self):
210210
'line.mandate_id.signature_date',
211211
{'line': line}, 10, gen_args=gen_args)
212212
if sequence_type == 'FRST' and line.mandate_id.last_debit_date:
213-
previous_bank = self._get_previous_bank(line)
214-
if previous_bank:
215-
amendment_indicator = etree.SubElement(
216-
mandate_related_info, 'AmdmntInd')
217-
amendment_indicator.text = 'true'
218-
amendment_info_details = etree.SubElement(
219-
mandate_related_info, 'AmdmntInfDtls')
220-
if (
221-
previous_bank.bank_bic ==
222-
line.partner_bank_id.bank_bic):
223-
ori_debtor_account = etree.SubElement(
224-
amendment_info_details, 'OrgnlDbtrAcct')
225-
ori_debtor_account_id = etree.SubElement(
226-
ori_debtor_account, 'Id')
227-
ori_debtor_account_iban = etree.SubElement(
228-
ori_debtor_account_id, 'IBAN')
229-
ori_debtor_account_iban.text = self._validate_iban(
230-
self._prepare_field(
231-
'Original Debtor Account',
232-
'previous_bank.sanitized_acc_number',
233-
{'previous_bank': previous_bank},
234-
gen_args=gen_args))
235-
else:
236-
ori_debtor_agent = etree.SubElement(
237-
amendment_info_details, 'OrgnlDbtrAgt')
238-
ori_debtor_agent_institution = etree.SubElement(
239-
ori_debtor_agent, 'FinInstnId')
240-
ori_debtor_agent_bic = etree.SubElement(
241-
ori_debtor_agent_institution, bic_xml_tag)
242-
ori_debtor_agent_bic.text = self._prepare_field(
243-
'Original Debtor Agent',
244-
'previous_bank.bank_bic',
245-
{'previous_bank': previous_bank},
246-
gen_args=gen_args)
247-
ori_debtor_agent_other = etree.SubElement(
248-
ori_debtor_agent_institution, 'Othr')
249-
ori_debtor_agent_other_id = etree.SubElement(
250-
ori_debtor_agent_other, 'Id')
251-
ori_debtor_agent_other_id.text = 'SMNDA'
252-
# SMNDA = Same Mandate New Debtor Agent
213+
amendment_indicator = etree.SubElement(
214+
mandate_related_info, 'AmdmntInd')
215+
amendment_indicator.text = 'true'
216+
amendment_info_details = etree.SubElement(
217+
mandate_related_info, 'AmdmntInfDtls')
218+
ori_debtor_account = etree.SubElement(
219+
amendment_info_details, 'OrgnlDbtrAcct')
220+
ori_debtor_account_id = etree.SubElement(
221+
ori_debtor_account, 'Id')
222+
ori_debtor_agent_other = etree.SubElement(
223+
ori_debtor_account_id, 'Othr')
224+
ori_debtor_agent_other_id = etree.SubElement(
225+
ori_debtor_agent_other, 'Id')
226+
ori_debtor_agent_other_id.text = 'SMNDA'
227+
# Until 20/11/2016, SMNDA meant
228+
# "Same Mandate New Debtor Agent"
229+
# After 20/11/2016, SMNDA means
230+
# "Same Mandate New Debtor Account"
253231

254232
self.generate_party_block(
255233
dd_transaction_info, 'Dbtr', 'C',

account_banking_sepa_direct_debit/models/bank_payment_line.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# © 2015-2016 Akretion - Alexis de Lattre <[email protected]>
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
44

5-
from openerp import models, api
5+
from odoo import models, api
66

77

88
class BankPaymentLine(models.Model):

account_banking_sepa_direct_debit/models/res_company.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
# © 2016 Antiun Ingenieria S.L. - Antonio Espinosa
55
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
66

7-
from openerp import models, fields, api, _
7+
from odoo import models, fields, api, _
88
from .common import is_sepa_creditor_identifier_valid
9-
from openerp.exceptions import ValidationError
9+
from odoo.exceptions import ValidationError
1010

1111

1212
class ResCompany(models.Model):
@@ -19,8 +19,6 @@ class ResCompany(models.Model):
1919
"of :\n- your country ISO code (2 letters)\n- a 2-digits "
2020
"checkum\n- a 3-letters business code\n- a country-specific "
2121
"identifier")
22-
original_creditor_identifier = fields.Char(
23-
string='Original Creditor Identifier', size=70)
2422

2523
@api.multi
2624
@api.constrains('sepa_creditor_identifier')

account_banking_sepa_direct_debit/models/res_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# © 2016 Akretion (Alexis de Lattre <[email protected]>)
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
44

5-
from openerp import models, fields
5+
from odoo import models, fields
66

77

88
class AccountConfigSettings(models.TransientModel):

account_banking_sepa_direct_debit/post_install.py

+12-11
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
# © 2016 Akretion (Alexis de Lattre <[email protected]>)
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
44

5-
from openerp import SUPERUSER_ID
5+
from odoo import api, SUPERUSER_ID
66

77

8-
def update_bank_journals(cr, pool):
9-
ajo = pool['account.journal']
10-
journal_ids = ajo.search(cr, SUPERUSER_ID, [('type', '=', 'bank')])
11-
sdd_id = pool['ir.model.data'].xmlid_to_res_id(
12-
cr, SUPERUSER_ID,
13-
'account_banking_sepa_direct_debit.sepa_direct_debit')
14-
if sdd_id:
15-
ajo.write(cr, SUPERUSER_ID, journal_ids, {
16-
'inbound_payment_method_ids': [(4, sdd_id)],
17-
})
8+
def update_bank_journals(cr, registry):
9+
with api.Environment.manage():
10+
env = api.Environment(cr, SUPERUSER_ID, {})
11+
ajo = env['account.journal']
12+
journals = ajo.search([('type', '=', 'bank')])
13+
sdd = env.ref(
14+
'account_banking_sepa_direct_debit.sepa_direct_debit')
15+
if sdd:
16+
journals.write({
17+
'inbound_payment_method_ids': [(4, sdd.id)],
18+
})
1819
return

0 commit comments

Comments
 (0)