Skip to content

Commit 5a1fde3

Browse files
authored
Merge pull request OCA#4990 from Tecnativa/17.0-ou_add-l10n_de
[17.0][OU-ADD] l10n_de: Migration scripts
2 parents 822cf9a + c9cb6f8 commit 5a1fde3

2 files changed

Lines changed: 2757 additions & 0 deletions

File tree

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Copyright 2025 Tecnativa - Pedro M. Baeza
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
from openupgradelib import openupgrade
4+
5+
6+
def _remove_xml_id_account_fiscal_position(env):
7+
"""In 17.0 account.fiscal.position.tax and account.fiscal.position.account don't
8+
have XML-IDs. With this method they are removed.
9+
"""
10+
for company in env["res.company"].search([]):
11+
openupgrade.logged_query(
12+
env.cr,
13+
f"""
14+
DELETE FROM ir_model_data
15+
WHERE module='l10n_de'
16+
AND model IN (
17+
'account.fiscal.position.tax', 'account.fiscal.position.account'
18+
) AND name LIKE '{company.id}_%'
19+
""",
20+
)
21+
22+
23+
@openupgrade.migrate()
24+
def migrate(env, version):
25+
openupgrade.rename_xmlids(
26+
env.cr,
27+
[
28+
("l10n_de.l10n_de_chart_template", "l10n_de.de_skr03"),
29+
("l10n_de.l10n_chart_de_skr04", "l10n_de.de_skr04"),
30+
],
31+
)
32+
_remove_xml_id_account_fiscal_position(env)

0 commit comments

Comments
 (0)