Skip to content
Closed
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/modules180-190.rst
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ Module coverage 18.0 -> 19.0
+---------------------------------------------------+----------------------+-------------------------------------------------+
| l10n_tr | |No DB layout changes. |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| l10n_tr_nilvera | | |
| l10n_tr_nilvera |Done | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
| l10n_tr_nilvera_edispatch | | |
+---------------------------------------------------+----------------------+-------------------------------------------------+
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from openupgradelib import openupgrade

# Semantic conversion: the 18.0 res.company.l10n_tr_nilvera_environment
# selection (values 'production' / 'sandbox') is replaced in 19.0 by a
# new boolean res.company.l10n_tr_nilvera_use_test_env. The 18.0 value
# carries meaning ('sandbox' = test environment); preserve and map it
# before Odoo's update_db drops the legacy column.
#
# Steps:
# 1. Rename the legacy selection column out of the way (-> openupgrade_legacy_19_0_*)
# so update_db doesn't reject the type-incompatible NEW column on the same name.
# 2. Add the new boolean column via add_fields (creates the column +
# ir_model_fields entry + xmlid). Default False so non-NULL rows in
# 18.0 with NULL get the manifest default.
# 3. Map values: 'sandbox' -> True (test env), 'production' -> False (live env).
# Rows where the legacy column is NULL are left at the column's default (False).
#
# Precedent: hr_holidays/19.0.1.6/pre-migration.py (yes/no -> boolean pattern).


@openupgrade.migrate()
def migrate(env, version):
openupgrade.rename_columns(
env.cr,
{
"res_company": [
("l10n_tr_nilvera_environment", None),
],
},
)
openupgrade.add_fields(
env,
[
(
"l10n_tr_nilvera_use_test_env",
"res.company",
"res_company",
"boolean",
None,
"l10n_tr_nilvera",
False,
),
],
)
openupgrade.map_values(
env.cr,
openupgrade.get_legacy_name("l10n_tr_nilvera_environment"),
"l10n_tr_nilvera_use_test_env",
[("sandbox", True), ("production", False)],
table="res_company",
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---Models in module 'l10n_tr_nilvera'---
---Fields in module 'l10n_tr_nilvera'---
l10n_tr_nilvera / res.company / l10n_tr_nilvera_environment (selection): DEL required, selection_keys: ['production', 'sandbox']
l10n_tr_nilvera / res.company / l10n_tr_nilvera_use_test_env (boolean): NEW required, hasdefault: default

# DONE: semantic conversion handled in pre-migration. The 18.0 selection
# `l10n_tr_nilvera_environment` is preserved as the legacy column
# `openupgrade_legacy_19_0_l10n_tr_nilvera_environment`; the new boolean
# `l10n_tr_nilvera_use_test_env` is added by add_fields and populated by
# map_values: 'sandbox' → True, 'production' → False. Existing rows
# where the legacy column is NULL get the field's manifest default.

l10n_tr_nilvera / res.partner / invoice_edi_format (False) : selection_keys added: [pint_anz, pint_sg] (most likely nothing to do)

# NOTHING TO DO: pure selection-keys widening on an existing column; Odoo's update_db handles.

l10n_tr_nilvera / res.partner / l10n_tr_nilvera_customer_status (selection): not a function anymore

# NOTHING TO DO: was a non-stored compute in 18.0 with no column. Stays a non-stored selection in 19.0 (the "not a function anymore" line just indicates the implementation moved off @api.depends but the field signature is unchanged). No schema impact.

---XML records in module 'l10n_tr_nilvera'---
NEW ir.actions.server: l10n_tr_nilvera.action_account_reports_customer_statements_do_followup

# NOTHING TO DO: standard module-data record loaded during install.

DEL uom.category: l10n_tr_nilvera.product_uom_categ_energy (noupdate)

# NOTHING TO DO: noupdate-flagged record left in place (standard upgrade flow); database_cleanup handles later.
Loading