Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[16.0] [MIG] l10n_it_declaration_of_intent #3026

Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
301f360
[IMP] l10n_it_dichiarazione_intento: Translate all the things to english
SimoRubi Apr 14, 2021
5a7c8d2
[MIG] l10n_it_declaration_of_intent: Migration script to translated m…
SimoRubi May 19, 2021
9c77d39
[IMP] l10n_it_declaration_of_intent: Currency note in roadmap, follow…
SimoRubi Jun 15, 2021
4f0db94
[UPD] Update l10n_it_declaration_of_intent.pot
oca-travis Oct 1, 2021
1cade4c
[UPD] README.rst
OCA-git-bot Oct 1, 2021
0b75eb8
[14.0][FIX] l10n_it_declaration_of_intent: duplicated line_ids
fredzamoabg Feb 2, 2022
96d9eda
l10n_it_declaration_of_intent 14.0.1.0.1
OCA-git-bot Feb 4, 2022
5e5c942
[14.0][FIX] l10n_it_declaration_of_intent: wrong calculation in get_d…
fredzamoabg Feb 7, 2022
a15e453
[FIX] l10n_it_declaration_of_intent: fix warnings raised during tests…
tafaRU Feb 8, 2022
353d74e
l10n_it_declaration_of_intent 14.0.1.0.2
OCA-git-bot Feb 8, 2022
2d4fc3b
[IMP] added declaration multi-company rules
Borruso Jan 7, 2022
52dfba8
[UPD] Update l10n_it_declaration_of_intent.pot
Mar 9, 2022
635b641
l10n_it_declaration_of_intent 14.0.1.1.0
OCA-git-bot Mar 9, 2022
7eaaefa
Update translation files
oca-transbot Mar 9, 2022
e6c40ca
[FIX] l10n_it_declaration_of_intent: fix test tags
TheMule71 Apr 15, 2022
6019ca7
l10n_it_declaration_of_intent 14.0.1.1.1
OCA-git-bot Apr 15, 2022
645c15f
Translated using Weblate (Italian)
francesco-ooops Sep 9, 2022
f0c9cdd
Translated using Weblate (Italian)
francesco-ooops Oct 26, 2022
d9fd9a7
[MIG] l10n_it_declaration_of_intent: Migration to 16.0
ArcadioPinto Nov 10, 2022
015208f
pre-commit stuff fixed
ArcadioPinto Nov 11, 2022
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
3 changes: 2 additions & 1 deletion l10n_it_declaration_of_intent/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ITA - Dichiarazione di intento
:target: https://runbot.odoo-community.org/runbot/122/14.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
|badge1| |badge2| |badge3| |badge4| |badge5|

**Italiano**

Expand Down Expand Up @@ -98,6 +98,7 @@ Contributors
* Lorenzo Battistini <lb@takobi.online>
* Lara Baggio <lbaggio@linkeurope.it>
* Simone Rubino <simone.rubino@agilebg.com>
* Arcadio Pinto <pinto.a@stesi.eu>

Maintainers
~~~~~~~~~~~
Expand Down
208 changes: 0 additions & 208 deletions l10n_it_declaration_of_intent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,211 +4,3 @@

from . import models
from . import wizard

from openupgradelib import openupgrade
from psycopg2 import sql


def rename_old_italian_module(cr):
"""
Move data and fields
from italian module `l10n_it_dichiarazione_intento`
to this module.
"""
old_module_name = "l10n_it_dichiarazione_intento"

if not openupgrade.is_module_installed(cr, old_module_name):
return

new_module_name = "l10n_it_declaration_of_intent"
env = api.Environment(cr, SUPERUSER_ID, {})

old_sequence = env["ir.model.data"].get_object(
old_module_name, "dichiarazione_intento_seq"
)
old_sequence.code = "declaration_of_intent"

renamed_fields = [
(
"res.company",
"res_company",
"dichiarazione_yearly_limit_ids",
"declaration_yearly_limit_ids",
),
(
"dichiarazione.intento.yearly.limit",
"dichiarazione_intento_yearly_limit",
"dichiarazione_id",
"declaration_id",
),
(
"dichiarazione.intento.line",
"dichiarazione_intento_line",
"dichiarazione_id",
"declaration_id",
),
(
"account.fiscal.position",
"account_fiscal_position",
"valid_for_dichiarazione_intento",
"valid_for_declaration_of_intent",
),
(
"account.move.line",
"account_move_line",
"force_dichiarazione_intento_id",
"force_declaration_of_intent_id",
),
(
"account.move",
"account_move",
"dichiarazione_intento_ids",
"declaration_of_intent_ids",
),
]
openupgrade.rename_fields(
env,
renamed_fields,
)

renamed_models = [
(
"dichiarazione.intento.yearly.limit",
"l10n_it_declaration_of_intent.yearly_limit",
),
("dichiarazione.intento", "l10n_it_declaration_of_intent.declaration"),
(
"dichiarazione.intento.line",
"l10n_it_declaration_of_intent.declaration_line",
),
]
openupgrade.rename_models(
cr,
renamed_models,
)
renamed_tables = [
(
old_model.replace(".", "_"),
new_model.replace(".", "_"),
)
for old_model, new_model in renamed_models
]
openupgrade.rename_tables(
cr,
renamed_tables,
)

renamed_xmlids = [
("access_dichiarazione_intento", "access_declaration_of_intent"),
("access_dichiarazione_intento_base", "access_declaration_of_intent_base"),
("access_dichiarazione_intento_line", "access_declaration_of_intent_line"),
(
"access_dichiarazione_intento_yearly_limit",
"access_declaration_of_intent_yearly_limit",
),
("dichiarazione_intento_seq", "declaration_of_intent_seq"),
("dichiarazione_intento_invoice_form", "declaration_of_intent_invoice_form"),
(
"dichiarazione_intento_invoice_line_form",
"declaration_of_intent_invoice_line_form",
),
(
"dichiarazione_intento_account_position_form",
"declaration_of_intent_account_position_form",
),
(
"dichiarazione_intento_view_company_form",
"declaration_of_intent_view_company_form",
),
("dichiarazione_intento_form", "declaration_of_intent_form"),
("dichiarazione_intento_search", "declaration_of_intent_search"),
("dichiarazione_intento_tree", "declaration_of_intent_tree"),
("dichiarazione_intento_action", "declaration_of_intent_action"),
("dichiarazione_intento_menu", "declaration_of_intent_menu"),
]
renamed_xmlids = [
(".".join([old_module_name, old_xmlid]), ".".join([new_module_name, new_xmlid]))
for (old_xmlid, new_xmlid) in renamed_xmlids
]
openupgrade.rename_xmlids(
cr,
renamed_xmlids,
)

renamed_modules = [
(old_module_name, new_module_name),
]
openupgrade.update_module_names(
cr,
renamed_modules,
merge_modules=True,
)


def copy_m2m_values(cr, registry):

# List of tuples
# (old_relation_table, old_model_column, old_comodel_column,
# new_relation_table, new_model_column, new_comodel_column)
m2m_fields = [
# Field l10n_it_declaration_of_intent.declaration.taxes_ids
(
"account_tax_dichiarazione_intento_rel",
"dichiarazione_intento_id",
"account_tax_id",
"account_tax_l10n_it_declaration_of_intent_declaration_rel",
"l10n_it_declaration_of_intent_declaration_id",
"account_tax_id",
),
# Field l10n_it_declaration_of_intent.declaration_line.taxes_ids
(
"account_tax_dichiarazione_intento_line_rel",
"dichiarazione_intento_line_id",
"account_tax_id",
"account_tax_l10n_it_declaration_of_intent_declaration_line_rel",
"l10n_it_declaration_of_intent_declaration_line_id",
"account_tax_id",
),
# Field l10n_it_declaration_of_intent.declaration_line.move_line_ids
(
"account_move_line_dichiarazione_intento_line_rel",
"dichiarazione_intento_line_id",
"account_move_line_id",
"move_line_declaration_line_rel",
"l10n_it_declaration_of_intent_declaration_line_id",
"account_move_line_id",
),
]

# Copy m2m values from old table
query = sql.SQL(
"""
INSERT INTO {new_relation_table}
({new_model_column}, {new_comodel_column})
SELECT
rel.{old_model_column},
rel.{old_comodel_column}
FROM {old_relation_table} rel
"""
)
for (
old_relation_table,
old_model_column,
old_comodel_column,
new_relation_table,
new_model_column,
new_comodel_column,
) in m2m_fields:
if not openupgrade.table_exists(cr, old_relation_table):
continue
openupgrade.logged_query(
cr,
query.format(
old_relation_table=sql.Identifier(old_relation_table),
old_model_column=sql.Identifier(old_model_column),
old_comodel_column=sql.Identifier(old_comodel_column),
new_relation_table=sql.Identifier(new_relation_table),
new_model_column=sql.Identifier(new_model_column),
new_comodel_column=sql.Identifier(new_comodel_column),
),
)
4 changes: 1 addition & 3 deletions l10n_it_declaration_of_intent/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{
"name": "ITA - Dichiarazione di intento",
"summary": "Gestione dichiarazioni di intento",
"version": "14.0.1.1.1",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "Francesco Apruzzese, Sergio Corato, Glauco Prina, Lara Baggio, "
"Odoo Community Association (OCA)",
Expand All @@ -25,6 +25,4 @@
"views/company_view.xml",
"views/account_invoice_view.xml",
],
"pre_init_hook": "rename_old_italian_module",
"post_init_hook": "copy_m2m_values",
}
6 changes: 1 addition & 5 deletions l10n_it_declaration_of_intent/data/sequence.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<data noupdate="1">

<odoo noupdate="1">
<record id="declaration_of_intent_seq" model="ir.sequence">
<field name="name">Declaration of intent sequence</field>
<field name="code">declaration_of_intent</field>
<field eval="1" name="number_next" />
<field eval="1" name="number_increment" />
</record>

</data>
</odoo>
106 changes: 0 additions & 106 deletions l10n_it_declaration_of_intent/migrations/14.0.1.0.0/post-migrate.py

This file was deleted.

Loading