Tryton - Issues

 

Issue7761

Title ModelData records are considered out of sync after migration to 5.0
Priority bug Status resolved
Superseder Nosy List ced, pokoli, reviewbot, roundup-bot
Type behavior Components trytond
Assigned To ced Keywords review
Reviews 45741002
View: 45741002

Created on 2018-10-04.12:15:58 by pokoli, last changed by roundup-bot.

Messages
New changeset 44deb919a358 by Cédric Krier in branch 'default':
Sort keys when dumping data
https://hg.tryton.org/tryton-env/rev/44deb919a358
New changeset 70904e384bd0 by Cédric Krier in branch 'default':
Sort keys when dumping data
https://hg.tryton.org/trytond/rev/70904e384bd0
review45741002 updated at https://codereview.tryton.org/45741002/#ps1
msg44345 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-10-05.22:58:03
For me, review45741002 fixes the problem but only for new created database or updated. The sync button does not necessary fix it.
msg44319 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-10-04.12:39:56
The comparison is done on the dumped value so if the strings are the same, it is considered as synchronized. So for me, the problem is the order of the dump of the dict keys.
msg44318 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2018-10-04.12:37:48
> I guess we should use sort_keys=True when dumping json.

Thanks for the tip, but this does not fix the problem. 

Indeed the problem is that the representation for Decimal fields is different on the database but when comparing the record on python code is exactly the same as we compare Decimals instead of dicts.
msg44317 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2018-10-04.12:20:52
I guess we should use sort_keys=True when dumping json.
msg44316 (view) Author: [hidden] (pokoli) (Tryton committer) (Tryton translator) Date: 2018-10-04.12:15:58
After migrating some databases to version 5.0 we've noticed that there are some ModelData records that are considered out of sync and using the sync button does not work. 

For example, the eur currency is marked as out of sync with the following values:

[["code","EUR"],["digits",2],["name","Euro"],["numeric_code","978"],["rounding",{"__class__":"Decimal","decimal":"0.01"}],["symbol","\u20ac"]]

and with the following fs_values:

[["code","EUR"],["digits",2],["name","Euro"],["numeric_code","978"],["rounding",{"decimal":"0.01","__class__":"Decimal"}],["symbol","\u20ac"]]

The only diference is that the rounding fields properties are sorted in a diferrent way.
History
Date User Action Args
2018-10-21 21:29:03roundup-botsetmessages: + msg44497
2018-10-21 21:28:57roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg44496
2018-10-05 23:03:45reviewbotsetnosy: + reviewbot
messages: + msg44346
2018-10-05 22:58:04cedsetstatus: chatting -> testing
reviews: 45741002
messages: + msg44345
keyword: + review
assignedto: ced
2018-10-04 12:39:56cedsetmessages: + msg44319
2018-10-04 12:37:48pokolisetmessages: + msg44318
2018-10-04 12:20:53cedsetstatus: unread -> chatting
nosy: + ced
messages: + msg44317
2018-10-04 12:15:58pokolicreate

Showing 10 items. Show all history (warning: this could be VERY long)