[IMP] Create records with timestamp; [RFR] No /migration/ level when using upgrade-path
parent
3a2b838f41
commit
b16c6f36e3
|
@ -62,11 +62,12 @@ class UpgradeAnalysis(models.Model):
|
|||
% module_name
|
||||
)
|
||||
module_path = os.path.join(self.upgrade_path, module_name)
|
||||
full_path = os.path.join(module_path, version)
|
||||
else:
|
||||
module_path = get_module_path(module_name)
|
||||
full_path = os.path.join(module_path, "migrations", version)
|
||||
if not module_path:
|
||||
return "ERROR: could not find module path of '%s':\n" % (module_name)
|
||||
full_path = os.path.join(module_path, "migrations", version)
|
||||
if not os.path.exists(full_path):
|
||||
try:
|
||||
os.makedirs(full_path)
|
||||
|
|
|
@ -27,8 +27,8 @@ def get_record_id(cr, module, model, field, mode):
|
|||
return record[0]
|
||||
cr.execute(
|
||||
"INSERT INTO upgrade_record "
|
||||
"(module, model, field, mode, type) "
|
||||
"VALUES (%s, %s, %s, %s, %s)",
|
||||
"(create_date, module, model, field, mode, type) "
|
||||
"VALUES (NOW() AT TIME ZONE 'UTC', %s, %s, %s, %s, %s)",
|
||||
(module, model, field, mode, "field"),
|
||||
)
|
||||
cr.execute(
|
||||
|
@ -67,7 +67,8 @@ def compare_registries(cr, module, registry, local_registry):
|
|||
if not cr.fetchone():
|
||||
cr.execute(
|
||||
"INSERT INTO upgrade_attribute "
|
||||
"(name, value, record_id) VALUES (%s, %s, %s)",
|
||||
"(create_date, name, value, record_id) "
|
||||
"VALUES (NOW() AT TIME ZONE 'UTC', %s, %s, %s)",
|
||||
(key, value, record_id),
|
||||
)
|
||||
old_field[key] = value
|
||||
|
@ -212,6 +213,7 @@ def log_xml_id(cr, module, xml_id):
|
|||
if not cr.fetchone():
|
||||
cr.execute(
|
||||
"INSERT INTO upgrade_record "
|
||||
"(module, model, name, type) values(%s, %s, %s, %s)",
|
||||
"(create_date, module, model, name, type) "
|
||||
"values(NOW() AT TIME ZONE 'UTC', %s, %s, %s, %s)",
|
||||
(module, record[0], xml_id, "xmlid"),
|
||||
)
|
||||
|
|
|
@ -88,8 +88,9 @@ class GenerateWizard(models.TransientModel):
|
|||
# Log model records
|
||||
self.env.cr.execute(
|
||||
"""INSERT INTO upgrade_record
|
||||
(module, name, model, type)
|
||||
SELECT imd2.module, imd2.module || '.' || imd.name AS name,
|
||||
(create_date, module, name, model, type)
|
||||
SELECT NOW() AT TIME ZONE 'UTC',
|
||||
imd2.module, imd2.module || '.' || imd.name AS name,
|
||||
im.model, 'model' AS type
|
||||
FROM (
|
||||
SELECT min(id) as id, name, res_id
|
||||
|
|
Loading…
Reference in New Issue