Initial commit: L10N_Europe packages

This commit is contained in:
Ernad Husremovic 2025-08-29 15:20:52 +02:00
commit 9803722600
2377 changed files with 380711 additions and 0 deletions

View file

@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
def migrate(cr, version):
""" From 12.0, to saas-13.3, l10n_ch_swissqr_template
used to inherit from another template. This isn't the case
anymore since https://github.com/odoo/odoo/commit/719f087b1b5be5f1f276a0f87670830d073f6ef4
(made in 12.0, and forward-ported). The module will not be updatable if we
don't manually clean inherit_id.
"""
cr.execute("""
update ir_ui_view v
set inherit_id = NULL, mode='primary'
from ir_model_data mdata
where
v.id = mdata.res_id
and mdata.model= 'ir.ui.view'
and mdata.name = 'l10n_ch_swissqr_template'
and mdata.module='l10n_ch';
""")

View file

@ -0,0 +1,23 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, SUPERUSER_ID
from odoo.addons.account.models.chart_template import update_taxes_from_templates
def migrate(cr, version):
env = api.Environment(cr, SUPERUSER_ID, {})
# We had corrupted data, handle the correction so the tax update can proceed.
# See https://github.com/odoo/odoo/commit/7b07df873535446f97abc1de9176b9332de5cb07
for company in env.companies:
taxes_to_check = (f'{company.id}_vat_purchase_81_reverse', f'{company.id}_vat_77_purchase_reverse')
tax_ids = env['ir.model.data'].search([
('name', 'in', taxes_to_check),
('model', '=', 'account.tax'),
]).mapped('res_id')
for tax in env['account.tax'].browse(tax_ids).with_context(active_test=False):
for child in tax.children_tax_ids:
if child.type_tax_use not in ('none', tax.type_tax_use):
# set the child to it's parent's value
child.type_tax_use = tax.type_tax_use
# Update taxes
update_taxes_from_templates(cr, 'l10n_ch.l10nch_chart_template')

View file

@ -0,0 +1,13 @@
# -*- coding: utf-8 -*-
def migrate(cr, version):
cr.execute("SELECT res_id FROM ir_model_data WHERE module = 'l10n_ch' AND name='account_tax_report_line_chtax_solde_formula'")
expression_id = cr.fetchone()
if expression_id:
cr.execute(
"DELETE FROM account_report_external_value WHERE target_report_expression_id = %s",
[expression_id[0]]
)

View file

@ -0,0 +1,9 @@
# -*- coding: utf-8 -*-
import odoo
def migrate(cr, version):
registry = odoo.registry(cr.dbname)
from odoo.addons.account.models.chart_template import migrate_set_tags_and_taxes_updatable
migrate_set_tags_and_taxes_updatable(cr, registry, 'l10n_ch')