Files
stock-rma/rma/migrations/14.0.1.1.2/pre-migration.py
DavidJForgeFlow b84b9badda [REF] rma: change stock_move_forced_lot to stock_restrict_lot
The two modules have the same features, but the stock_restrict_lot is more used in other modules so changing the module used to match the OCA behavior.
2025-01-21 09:03:41 +01:00

19 lines
542 B
Python

# Copyright (C) 2025 ForgeFlow S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html)
from openupgradelib import openupgrade # pylint: disable=W7936
_field_renames = [
("stock.move", "stock_move", "forced_lot_id", "restrict_lot_id"),
]
@openupgrade.migrate()
def migrate(env, version):
cr = env.cr
for field in _field_renames:
if openupgrade.table_exists(cr, field[1]) and openupgrade.column_exists(
cr, field[1], field[2]
):
openupgrade.rename_fields(env, [field])