Skip to content

Commit

Permalink
[FIX] l10n_it_accompanying_invoice: fix migration
Browse files Browse the repository at this point in the history
  • Loading branch information
odooNextev committed Aug 26, 2024
1 parent 2528707 commit 47c2e8d
Showing 1 changed file with 153 additions and 13 deletions.
166 changes: 153 additions & 13 deletions l10n_it_accompanying_invoice/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,146 @@
from odoo.tools import DotDict

RENAMED_FIELDS = [
(
"account.move",
"account_move",
"note",
"delivery_note",
),
(
"account.move",
"account_move",
"date_done",
"delivery_transport_datetime",
),
[
(
"account.invoice",
"note",
),
(
"account.move",
"delivery_note",
),
],
[
(
"account.invoice",
"date_done",
),
(
"account.move",
"delivery_transport_datetime",
),
],
[
(
"account.invoice",
"carriage_condition_id",
),
(
"account.move",
"delivery_transport_condition_id",
),
],
[
(
"account.invoice",
"goods_description_id",
),
(
"account.move",
"delivery_goods_appearance_id",
),
],
[
(
"account.invoice",
"transportation_reason_id",
),
(
"account.move",
"delivery_transport_reason_id",
),
],
[
(
"account.invoice",
"transportation_method_id",
),
(
"account.move",
"delivery_transport_method_id",
),
],
[
(
"account.invoice",
"carrier_id",
),
(
"account.move",
"delivery_carrier_id",
),
],
[
(
"account.invoice",
"parcels",
),
(
"account.move",
"delivery_packages",
),
],
[
(
"account.invoice",
"weight",
),
(
"account.move",
"delivery_net_weight",
),
],
[
(
"account.invoice",
"gross_weight",
),
(
"account.move",
"delivery_gross_weight",
),
],
[
(
"account.invoice",
"volume",
),
(
"account.move",
"delivery_volume",
),
],
[
(
"account.invoice",
"weight_manual_uom_id",
),
(
"account.move",
"delivery_net_weight_uom_id",
),
],
[
(
"account.invoice",
"gross_weight_uom_id",
),
(
"account.move",
"delivery_gross_weight_uom_id",
),
],
[
(
"account.invoice",
"volume_uom_id",
),
(
"account.move",
"delivery_volume_uom_id",
),
],
]

RENAMED_XMLIDS = [
Expand Down Expand Up @@ -51,16 +179,28 @@ def remove_models(cr, model_spec):


def migrate_old_module(cr):
field_spec = []

Check warning on line 182 in l10n_it_accompanying_invoice/hooks.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_accompanying_invoice/hooks.py#L182

Added line #L182 was not covered by tests
for renamed_field in RENAMED_FIELDS:
(old_model, old_field), (new_model, new_field) = renamed_field
field_spec.append(

Check warning on line 185 in l10n_it_accompanying_invoice/hooks.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_accompanying_invoice/hooks.py#L184-L185

Added lines #L184 - L185 were not covered by tests
(
old_model,
old_model.replace(".", "_"),
old_field,
new_field,
)
)
openupgrade.rename_fields(

Check warning on line 193 in l10n_it_accompanying_invoice/hooks.py

View check run for this annotation

Codecov / codecov/patch

l10n_it_accompanying_invoice/hooks.py#L193

Added line #L193 was not covered by tests
# The method only needs the cursor, not the whole Environment
DotDict(
cr=cr,
),
RENAMED_FIELDS,
field_spec,
# Prevent Environment usage
# whenever it will be implemented.
no_deep=True,
)

full_renamed_xmlids = [
(
".".join(("l10n_it_accompanying_invoice", old_xmlid)),
Expand Down

0 comments on commit 47c2e8d

Please sign in to comment.