Skip to content

Commit

Permalink
[MIG] l10n_it_account: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
eLBati authored and Borruso committed Jan 17, 2025
1 parent 1462553 commit 087ca3d
Show file tree
Hide file tree
Showing 20 changed files with 66 additions and 2,858 deletions.
45 changes: 39 additions & 6 deletions l10n_it_account/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,48 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import models
from . import wizards
from . import tools
from odoo import api, SUPERUSER_ID

MODEL = "account.tax"
OLD_MODEL = "account.tax.kind"
RENAMED_FIELDS = [
(
"law_reference",
"l10n_it_law_reference",
),
]


def _l10n_it_account_post_init(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})
env["account.account"].set_account_types_negative_sign()

lang = env["res.lang"]
if lang._lang_get("it_IT"):
lang.update_menu_finance_it_translation()
openupgrade.logged_query(
env.cr,
sql.SQL(f"""
UPDATE
{MODEL.replace(".", "_")}
SET
l10n_it_exempt_reason = kind_id.code
FROM
{OLD_MODEL.replace(".", "_")} AS kind
WHERE
{MODEL.replace(".", "_")}.kind_id = kind.id
AND {MODEL.replace(".", "_")}.kind_id IS NOT NULL
"""),
)

field_spec = []
for renamed_field in RENAMED_FIELDS:
old_field, new_field = renamed_field
field_spec.append(
(
MODEL,
MODEL.replace(".", "_"),
old_field,
new_field,
)
)
openupgrade.rename_fields(
env,
field_spec,
)
10 changes: 2 additions & 8 deletions l10n_it_account/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
{
"name": "ITA - Contabilità base",
"summary": "Modulo base usato come dipendenza di altri moduli contabili",
"version": "16.0.1.1.3",
"version": "18.0.1.0.0",
"development_status": "Production/Stable",
"category": "Hidden",
"author": "Agile Business Group, Abstract, Odoo Community Association (OCA)",
Expand All @@ -21,25 +21,19 @@
"account_tax_balance",
"date_range",
"web",
"l10n_it",
],
"data": [
"views/account_menuitem.xml",
"views/partner_view.xml",
"views/product_view.xml",
"views/res_config_settings_views.xml",
"reports/account_reports_view.xml",
"views/account_view.xml",
],
"assets": {
"web.report_assets_common": [
"l10n_it_account/static/src/css/*.css",
]
},
"external_dependencies": {
"python": [
"xmlschema",
],
},
"installable": True,
"post_init_hook": "_l10n_it_account_post_init",
}
24 changes: 0 additions & 24 deletions l10n_it_account/migrations/16.0.1.0.0/post-migrate_balance_sign.py

This file was deleted.

3 changes: 0 additions & 3 deletions l10n_it_account/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from . import account_account
from . import account_group
from . import account_tax
from . import res_lang
94 changes: 0 additions & 94 deletions l10n_it_account/models/account_account.py

This file was deleted.

88 changes: 0 additions & 88 deletions l10n_it_account/models/account_group.py

This file was deleted.

35 changes: 0 additions & 35 deletions l10n_it_account/models/res_lang.py

This file was deleted.

Loading

0 comments on commit 087ca3d

Please sign in to comment.