Commit c3b03d8
committed
[IMP] util.update_record_from_xml
Sometimes records get a field removed from their XML declaration. This creates a
divergence between new dbs and upgraded ones. The former will be initialised
with `NULL`/default values, whereas the latter will retain their current one.
This is usually handled in dedicated upgrade scripts with simple queries
unsetting the necessary columns. However, in some cases, these XML changes are
backported/noticed too late and need to be addressed in multiple versions.
That may create the pressure to target future versions, which creates a hidden
coupling between the xml declaration and the query, which can easily turn into a
bug. It is one such example[^1] that inspired this PR.
The proposed solution is to adapt `update_record_from_xml` to unset fields from
the `fields` kwarg and missing from the XML declaration ensuring foreward
compatibility.
[^1]: odoo/upgrade#95121 parent b0fb61b commit c3b03d8
1 file changed
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1039 | 1039 | | |
1040 | 1040 | | |
1041 | 1041 | | |
1042 | | - | |
| 1042 | + | |
| 1043 | + | |
1043 | 1044 | | |
1044 | 1045 | | |
1045 | 1046 | | |
| |||
1147 | 1148 | | |
1148 | 1149 | | |
1149 | 1150 | | |
| 1151 | + | |
1150 | 1152 | | |
1151 | 1153 | | |
1152 | 1154 | | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
1153 | 1158 | | |
1154 | 1159 | | |
1155 | 1160 | | |
| |||
0 commit comments