Browse Source

[IMP] web_tree_many2one_clickable: Migration script from version 8

pull/515/head
Pedro M. Baeza 8 years ago
parent
commit
129e0b8ac7
  1. 30
      web_tree_many2one_clickable/migrations/9.0.1.0.0/pre-migration.py

30
web_tree_many2one_clickable/migrations/9.0.1.0.0/pre-migration.py

@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# Copyright 2016 Pedro M. Baeza <pedro.baeza@tecnativa.com>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openupgradelib import openupgrade
@openupgrade.migrate(use_env=True)
def migrate(env, version):
"""If the system parameter exists before (manually created), don't error
on duplicated record inserting manually the XML-ID entry before the
loading.
"""
param = env['ir.config_parameter'].search([
('key', '=', 'web_tree_many2one_clickable.default')
])
if not param:
return
try:
env.ref('web_tree_many2one_clickable.default')
# XML-ID already exists - Nothing to do
except ValueError:
# Entry doesn't exist - Create it
env['ir.model.data'].create({
'module': 'web_tree_many2one_clickable',
'name': 'default',
'model': 'ir.config_parameter',
'noupdate': True,
'res_id': param.id,
})
Loading…
Cancel
Save