QR-bills could only be generated for ISR-compliant invoices, which is wrong and would have caused issues in the future, as ISR will slowly disappear. Furthermore, doing it this way avoids raising an error after commit 719f087 , when trying to print an ISR-compliant invoice if the module hadn't been updated (it used to raise because the QR-bill report didn't exist, and it tried generating it). closes odoo/odoo#51858 Forward-port-of: #51340 Forward-port-of: #50744 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com> Signed-off-by: oco-odoo <oco-odoo@users.noreply.github.com>
32 lines
1.0 KiB
Python
32 lines
1.0 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from . import models
|
|
from . import report
|
|
|
|
from odoo import api, SUPERUSER_ID
|
|
|
|
|
|
def load_translations(env):
|
|
env.ref('l10n_ch.l10nch_chart_template').process_coa_translations()
|
|
|
|
|
|
def init_settings(env):
|
|
'''If the company is localized in Switzerland, activate the cash rounding by default.
|
|
'''
|
|
# The cash rounding is activated by default only if the company is localized in Switzerland.
|
|
ch_country = env.ref('base.ch')
|
|
for company in env['res.company'].search([('partner_id.country_id', '=', ch_country.id)]):
|
|
res_config_id = env['res.config.settings'].create({
|
|
'company_id': company.id,
|
|
'group_cash_rounding': True
|
|
})
|
|
# We need to call execute, otherwise the "implied_group" in fields are not processed.
|
|
res_config_id.execute()
|
|
|
|
|
|
def post_init(cr, registry):
|
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
|
load_translations(env)
|
|
init_settings(env)
|