Newer
Older
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import models
from . import wizard
from odoo import api, SUPERUSER_ID
def _configure_journals(cr, registry):
"""Setting journal and property field (if needed)"""
env = api.Environment(cr, SUPERUSER_ID, {})
# if we already have a coa installed, create journal and set property field
company_ids = env['res.company'].search([('chart_template_id', '!=', False)])
for company_id in company_ids:
journal_id = env['account.journal'].search([
('name', '=', 'Cotisations'),
('company_id', '=', company_id.id),
('type', '=', 'sale')], limit=1).id
if not journal_id:
env['account.journal'].create({
'name': 'Cotisations',
'type': 'sale',
'code': 'COT',
'company_id': company_id.id,
'show_on_dashboard': False,
'sequence': 6,
})