# -*- coding: utf-8 -*-
def post_init_hook(env):
"""
Opravuje l10n_sk.vat_registry_tax_id_external_layout šablónu:
- Mení 'ID:' na 'IČO:' pre obe jazykové verzie
- Odstraňuje duplicitný IČ DPH riadok
"""
view = env['ir.ui.view'].search([
('key', '=', 'l10n_sk.vat_registry_tax_id_external_layout')
], limit=1)
if not view:
return
new_template_en = """
IČO:
DIČ:
IČ DPH:
"""
new_template_sk = """
IČO:
DIČ:
IČ DPH:
"""
env.cr.execute("""
UPDATE ir_ui_view
SET arch_db = jsonb_set(
jsonb_set(
arch_db,
'{en_US}',
%s::jsonb
),
'{sk_SK}',
%s::jsonb
)
WHERE key = 'l10n_sk.vat_registry_tax_id_external_layout'
""", (
f'"{new_template_en}"',
f'"{new_template_sk}"',
))