[IMP] openupgrade_records: compare columns of many2many tables
parent
ba1bbeb82d
commit
1a8d67c991
|
@ -114,6 +114,8 @@ def fieldprint(old, new, field, text, reprs):
|
||||||
fullrepr = "{:<12} / {:<24} / {:<30}".format(old["module"], old["model"], fieldrepr)
|
fullrepr = "{:<12} / {:<24} / {:<30}".format(old["module"], old["model"], fieldrepr)
|
||||||
if not text:
|
if not text:
|
||||||
text = "{} is now '{}' ('{}')".format(field, new[field], old[field])
|
text = "{} is now '{}' ('{}')".format(field, new[field], old[field])
|
||||||
|
if field in ("column1", "column2"):
|
||||||
|
text += " [%s]" % old["table"]
|
||||||
if field == "relation":
|
if field == "relation":
|
||||||
text += " [nothing to do]"
|
text += " [nothing to do]"
|
||||||
reprs[module_map(old["module"])].append("{}: {}".format(fullrepr, text))
|
reprs[module_map(old["module"])].append("{}: {}".format(fullrepr, text))
|
||||||
|
@ -161,6 +163,14 @@ def report_generic(new, old, attrs, reprs):
|
||||||
else:
|
else:
|
||||||
text = "not related anymore"
|
text = "not related anymore"
|
||||||
fieldprint(old, new, "", text, reprs)
|
fieldprint(old, new, "", text, reprs)
|
||||||
|
elif attr == "table":
|
||||||
|
if old[attr] != new[attr]:
|
||||||
|
fieldprint(old, new, attr, "", reprs)
|
||||||
|
if old[attr] and new[attr]:
|
||||||
|
if old["column1"] != new["column1"]:
|
||||||
|
fieldprint(old, new, "column1", "", reprs)
|
||||||
|
if old["column2"] != new["column2"]:
|
||||||
|
fieldprint(old, new, "column2", "", reprs)
|
||||||
elif old[attr] != new[attr]:
|
elif old[attr] != new[attr]:
|
||||||
fieldprint(old, new, attr, "", reprs)
|
fieldprint(old, new, attr, "", reprs)
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,17 @@ class UpgradeRecord(models.Model):
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
repre.update({x.name: x.value for x in record.attribute_ids})
|
repre.update({x.name: x.value for x in record.attribute_ids})
|
||||||
|
if repre["table"]:
|
||||||
|
repre.update(
|
||||||
|
{
|
||||||
|
"column1": self.env[repre["model"]]
|
||||||
|
._fields[repre["field"]]
|
||||||
|
.column1,
|
||||||
|
"column2": self.env[repre["model"]]
|
||||||
|
._fields[repre["field"]]
|
||||||
|
.column2,
|
||||||
|
}
|
||||||
|
)
|
||||||
data.append(repre)
|
data.append(repre)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue