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
+71
View File
@@ -0,0 +1,71 @@
# -*- coding: utf-8 -*-
"""
Migration script pre l10n_sk_partner 19.0.2.0.4
Opravuje l10n_sk šablóny:
1. vat_registry_tax_id_external_layout: ID -> IČO, DIČ
2. report_invoice_document: IČO, DIČ pre odberateľa na faktúre
"""
def migrate(cr, version):
# --- 1. Oprava dodávateľského bloku ---
layout_template = (
'<t t-name="l10n_sk.vat_registry_tax_id_external_layout">'
'\n <li t-if="company.company_registry and company.account_fiscal_country_id.code == \'SK\'">'
'\n I\u010cO: <span t-field="company.company_registry"/>'
'\n </li>'
'\n <li t-if="company.income_tax_id and company.account_fiscal_country_id.code == \'SK\'">'
'\n DI\u010c: <span t-field="company.income_tax_id"/>'
'\n </li>'
'\n </t>'
)
cr.execute("""
UPDATE ir_ui_view
SET arch_db = jsonb_build_object('en_US', %s, 'sk_SK', %s),
arch_updated = true
WHERE key = 'l10n_sk.vat_registry_tax_id_external_layout'
""", (layout_template, layout_template))
# --- 2. Oprava odberateľského bloku na faktúre ---
invoice_template = (
'<data inherit_id="account.report_invoice_document">'
'\n <xpath expr="//div[@id=\'partner_vat_address_not_same_as_shipping\']" position="before">'
'\n <div t-if="o.partner_id.company_registry and o.company_id.country_code == \'SK\'">'
'\n I\u010cO: <span t-field="o.partner_id.company_registry"/>'
'\n </div>'
'\n <div t-if="o.partner_id.dic and o.company_id.country_code == \'SK\'">'
'\n DI\u010c: <span t-field="o.partner_id.dic"/>'
'\n </div>'
'\n </xpath>'
'\n <xpath expr="//div[@id=\'partner_vat_address_same_as_shipping\']" position="before">'
'\n <div t-if="o.partner_id.company_registry and o.company_id.country_code == \'SK\'">'
'\n I\u010cO: <span t-field="o.partner_id.company_registry"/>'
'\n </div>'
'\n <div t-if="o.partner_id.dic and o.company_id.country_code == \'SK\'">'
'\n DI\u010c: <span t-field="o.partner_id.dic"/>'
'\n </div>'
'\n </xpath>'
'\n <xpath expr="//div[@id=\'partner_vat_no_shipping\']" position="before">'
'\n <div t-if="o.partner_id.company_registry and o.company_id.country_code == \'SK\'">'
'\n I\u010cO: <span t-field="o.partner_id.company_registry"/>'
'\n </div>'
'\n <div t-if="o.partner_id.dic and o.company_id.country_code == \'SK\'">'
'\n DI\u010c: <span t-field="o.partner_id.dic"/>'
'\n </div>'
'\n </xpath>'
'\n <xpath expr="//div[@name=\'comment\']" position="after">'
'\n <p t-if="o.company_id.trade_registry and o.company_id.country_code == \'SK\'" name="trade_registry">'
'\n <strong>Trade registry: </strong><t t-out="o.company_id.trade_registry"/>'
'\n </p>'
'\n </xpath>'
'\n </data>'
)
cr.execute("""
UPDATE ir_ui_view
SET arch_db = jsonb_build_object('en_US', %s, 'sk_SK', %s),
arch_updated = true
WHERE key = 'l10n_sk.report_invoice_document'
""", (invoice_template, invoice_template))