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:
Alexis de Lattre
2016-06-16 16:51:03 +02:00
committed by Enric Tobella
parent 3f09465750
commit 981a76bf24
3 changed files with 21 additions and 0 deletions

View File

@@ -2,3 +2,4 @@
# © 2010-2013 Akretion (www.akretion.com)
from . import models
from .post_install import update_bank_journals

View File

@@ -23,5 +23,6 @@
'demo': [
'demo/sepa_credit_transfer_demo.xml'
],
'post_init_hook': 'update_bank_journals',
'installable': True,
}

View File

@@ -0,0 +1,19 @@
# -*- 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')])
sct_id = pool['ir.model.data'].xmlid_to_res_id(
cr, SUPERUSER_ID,
'account_banking_sepa_credit_transfer.sepa_credit_transfer')
if sct_id:
ajo.write(cr, SUPERUSER_ID, journal_ids, {
'outbound_payment_method_ids': [(4, sct_id)],
})
return