From 3751379f1e9a4c215fb6eb898b4ccc67659b9ace Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 10 May 2022 21:51:50 +0700 Subject: initial commit 2 --- addons/l10n_ch/__init__.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 addons/l10n_ch/__init__.py (limited to 'addons/l10n_ch/__init__.py') diff --git a/addons/l10n_ch/__init__.py b/addons/l10n_ch/__init__.py new file mode 100644 index 00000000..45936de3 --- /dev/null +++ b/addons/l10n_ch/__init__.py @@ -0,0 +1,30 @@ +# -*- 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. + for company in env['res.company'].search([('partner_id.country_id.code', '=', "CH")]): + 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) -- cgit v1.2.3