Domain not updated

I am trying to update the domain in windows action. The issue is that if I try to update it from the UI, then since the record is created using XML, it is considered as a part of base configuration and is not updated further.

If I am trying to update it from the XML file, the system says that it can not be updated because it has been changed. However, the notation of the domain gets changed from to a detailed pyson notation in the database.

Is there any solution / workaround to work on the same.

Normally updating from XML should work. Be sure before the update that the model data are all synchronized.

The reason that it does not work is due to the fact that the domin in the XML file is written something like this -

[‘OR’, [‘establishment.admin’, ‘=’, Get(Eval(‘user’, {}), ‘employee’, None)], [‘establishment.admin’, ‘=’, Eval(‘employee’, {})]]

When I checked in the database, it gets converted to -

[“OR”,[“establishment.admin”,"=",{“class”:“Get”,“v”:{“class”:“Eval”,“v”:“user”,“d”:{}},“k”:“employee”,“d”:null}],[“establishment.admin”,"=",{“class”:“Eval”,“v”:“employee”,“d”:{}}]]

So when I run the trytond-admin to update the database, it gives me the following warning -
WARNING trytond.convert Field domain of 195@ir.action.act_window not updated (id: act_xxxxx_department), because it has changed since the last update

I guess that because the domain gets converted into Pyson way of writing the domains, the system treats it as if the domain has been updated.

Normally, it is the encoded format that is used for comparison. But I think the problem is the key sorting.
I filled Issue 8369: Sort keys of PYSON XML value - Tryton issue tracker

Please, can you confirm that the issue fix your problem?

To fix the issue as of now, I marked the flag “noupdate” in ir_model_data by looking for the fs_id. And then updated the record from front end.

What about the patch?

@ced The patch did not work. It still shows the same error.

I think you have to force the data update from the administration menu. Both formats should be regenerated in order to be normalized.
Indeed the best way to test is to start with a clean database and redo the workflow.

This is something that I am doing as of now to run the system. But it is not a very clean workaround.

This is not a possibility if the server is up and running.

No patch will fix corrupted data. The goal of the change is to prevent future issue with the same pattern.