mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
Enable the payment methods by default on bank journals (including existing bank journals via post_install scripts)
Enable "Generate Accounting Entries On File Upload" by default
This commit is contained in:
committed by
Enric Tobella
parent
e85b79b5d1
commit
4d3e723202
@@ -1,3 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from . import models
|
||||
from .post_install import update_bank_journals
|
||||
|
||||
@@ -31,5 +31,6 @@
|
||||
'views/report_sepa_direct_debit_mandate.xml',
|
||||
],
|
||||
'demo': ['demo/sepa_direct_debit_demo.xml'],
|
||||
'post_init_hook': 'update_bank_journals',
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
18
account_banking_sepa_direct_debit/post_install.py
Normal file
18
account_banking_sepa_direct_debit/post_install.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 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
|
||||
|
||||
|
||||
def update_bank_journals(cr, pool):
|
||||
ajo = pool['account.journal']
|
||||
journal_ids = ajo.search(cr, SUPERUSER_ID, [('type', '=', 'bank')])
|
||||
sdd_id = pool['ir.model.data'].xmlid_to_res_id(
|
||||
cr, SUPERUSER_ID,
|
||||
'account_banking_sepa_direct_debit.sepa_direct_debit')
|
||||
if sdd_id:
|
||||
ajo.write(cr, SUPERUSER_ID, journal_ids, {
|
||||
'inbound_payment_method_ids': [(4, sdd_id)],
|
||||
})
|
||||
return
|
||||
Reference in New Issue
Block a user