Merge PR #959 into 13.0

Signed-off-by pedrobaeza
This commit is contained in:
OCA-git-bot
2020-09-04 14:31:27 +00:00
2 changed files with 0 additions and 58 deletions

View File

@@ -1,40 +0,0 @@
# Copyright 2020 Tecnativa - Sergio Teruel
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
from openupgradelib import openupgrade
def convert_m2o_to_x2m_fields(env):
openupgrade.m2o_to_x2m(
env.cr,
env["stock.inventory"],
"stock_inventory",
"location_ids",
openupgrade.get_legacy_name("location_id"),
)
openupgrade.m2o_to_x2m(
env.cr,
env["stock.inventory"],
"stock_inventory",
"product_ids",
openupgrade.get_legacy_name("product_id"),
)
openupgrade.m2o_to_x2m(
env.cr,
env["stock.inventory"],
"stock_inventory",
"categ_ids",
openupgrade.get_legacy_name("category_id"),
)
openupgrade.m2o_to_x2m(
env.cr,
env["stock.inventory"],
"stock_inventory",
"lot_ids",
openupgrade.get_legacy_name("lot_id"),
)
@openupgrade.migrate()
def migrate(env, version):
convert_m2o_to_x2m_fields(env)

View File

@@ -1,18 +0,0 @@
# Copyright 2020 Tecnativa - Sergio Teruel
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
from openupgradelib import openupgrade
column_renames = {
"stock_inventory": [
("location_id", None),
("product_id", None),
("category_id", None),
("lot_id", None),
]
}
@openupgrade.migrate()
def migrate(env, version):
openupgrade.rename_columns(env.cr, column_renames)