initial commit - l10n_sk_partner

This commit is contained in:
Tomas
2026-04-05 16:03:23 +02:00
parent 53b0d0a287
commit 8606fc3492
14 changed files with 310 additions and 0 deletions
View File
+46
View File
@@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
"""
Migration script pre l10n_sk_partner 19.0.2.0.5
Opravuje natívne VAT bloky vo všetkých external_layout šablónach:
- Skryje natívny VAT blok pre SK krajinu (l10n_sk ho už zobrazuje)
- Opraví t-else blok ktorý zobrazoval US12345671 pre SK
"""
LAYOUT_KEYS = [
'web.external_layout_standard',
'web.external_layout_striped',
'web.external_layout_boxed',
'web.external_layout_bold',
'web.external_layout_folder',
'web.external_layout_wave',
'web.external_layout_bubble',
]
def migrate(cr, version):
for key in LAYOUT_KEYS:
# Skry natívny t-if VAT blok pre SK
cr.execute("""
UPDATE ir_ui_view
SET arch_db = regexp_replace(
arch_db::text,
't-if="not forced_vat"',
't-if="not forced_vat and company.account_fiscal_country_id.code != ''SK''"',
'g'
)::jsonb,
arch_updated = true
WHERE key = %s
""", (key,))
# Oprav t-else blok — zmeň na t-if aby sa nezobrazoval pre SK
cr.execute("""
UPDATE ir_ui_view
SET arch_db = regexp_replace(
arch_db::text,
'li t-else="">\s*\n\s*<t t-esc="company\.country_id\.vat_label',
'li t-if="forced_vat and company.account_fiscal_country_id.code != ''SK''">\n <t t-esc="company.country_id.vat_label',
'g'
)::jsonb,
arch_updated = true
WHERE key = %s
""", (key,))