[IMP] openupgrade_records: add _order comparison

pull/2417/head
mreficent 2021-03-23 18:18:17 +01:00 committed by Stefan Rijnhart
parent c4e8d88849
commit 480412abc8
3 changed files with 12 additions and 1 deletions

View File

@ -110,7 +110,9 @@ def search(item, item_list, fields, get_all=None):
def fieldprint(old, new, field, text, reprs):
fieldrepr = "{} ({})".format(old["field"], old["type"])
fieldrepr = "{}".format(old["field"])
if old["field"] not in ("_inherits", "_order"):
fieldrepr += " ({})".format(old["type"])
fullrepr = "{:<12} / {:<24} / {:<30}".format(old["module"], old["model"], fieldrepr)
if not text:
text = "{} is now '{}' ('{}')".format(field, new[field], old[field])
@ -244,6 +246,7 @@ def compare_sets(old_records, new_records):
"isrelated",
"required",
"table",
"_order",
],
)
@ -260,6 +263,7 @@ def compare_sets(old_records, new_records):
"isrelated",
"required",
"table",
"_order",
],
)
@ -276,6 +280,7 @@ def compare_sets(old_records, new_records):
"isrelated",
"required",
"table",
"_order",
],
)
@ -289,6 +294,8 @@ def compare_sets(old_records, new_records):
"attachment",
]
for column in old_records:
if column["field"] == "_order":
continue
# we do not care about removed non stored function fields
if not column["stored"] and (column["isfunction"] or column["isrelated"]):
continue
@ -311,6 +318,8 @@ def compare_sets(old_records, new_records):
]
)
for column in new_records:
if column["field"] == "_order":
continue
# we do not care about newly added non stored function fields
if not column["stored"] and (column["isfunction"] or column["isrelated"]):
continue

View File

@ -103,6 +103,7 @@ class UpgradeRecord(models.Model):
"hasdefault",
"table",
"_inherits",
"_order",
]
template = {x: False for x in keys}

View File

@ -124,6 +124,7 @@ def log_model(model, local_registry):
model_registry = local_registry.setdefault(model._name, {})
if model._inherits:
model_registry["_inherits"] = {"_inherits": str(model._inherits)}
model_registry["_order"] = {"_order": model._order}
for k, v in model._fields.items():
properties = {
"type": typemap.get(v.type, v.type),