Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docsource/modules160-170.rst
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ Module coverage 16.0 -> 17.0
+---------------------------------------------------+----------------------+-------------------------------------------------+
| |del| l10n_pl_sale_stock | |No DB layout changes. |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| l10n_pt | | |
| l10n_pt | Done | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| |new| l10n_qa | | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
17 changes: 17 additions & 0 deletions openupgrade_scripts/scripts/l10n_pt/17.0.1.0/post-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2025 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
l10n_pt_xmlids = [
"fiscal_position_foreign_eu",
"fiscal_position_foreign_eu_private",
"fiscal_position_foreign_other",
"fiscal_position_national_customers",
]
for xmlid in l10n_pt_xmlids:
env["ir.model.data"].search(
[("name", "=", xmlid), ("module", "=", "l10n_pt")]
).unlink()
29 changes: 29 additions & 0 deletions openupgrade_scripts/scripts/l10n_pt/17.0.1.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright 2025 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from openupgradelib import openupgrade


def _remove_xml_id_account_fiscal_position(env):
"""In 17.0 account.fiscal.position.tax and account.fiscal.position.account don't
have xml_id, so let's remove it for companies with this CoA.
"""
for company in (
env["res.company"]
.with_context(active_test=False)
.search([("chart_template", "=", "pt")])
):
openupgrade.logged_query(
env.cr,
f"""
DELETE FROM ir_model_data
WHERE module='l10n_pt'
AND model IN (
'account.fiscal.position.tax', 'account.fiscal.position.account'
) AND name LIKE '{company.id}_%'
""",
)


@openupgrade.migrate()
def migrate(env, version):
_remove_xml_id_account_fiscal_position(env)
Loading