I am running Tryton in a docker container on a remote server, and I am trying to use proteus to activate some modules and do some setup on there.
Using the standard docker image for 5.2 this works without a problem, but on 5.4 it no longer works and I consistently get a concurrency exception when updating the Config Wizard Items.
I am wondering if this is a problem with the way I am doing things, or if this is a bug that needs fixing?
FYI, I did also notice this message https://codereview.tryton.org/277491002/#msg84 by @wifasoi which I think may be related.
I’m happy to create a bug report if this seems to be issue, but any help with this would be greatly appreciated.
Some more details:
A cut down version of the script that works against 5.2 but not 5.4:
#!/usr/bin/env python3
from proteus import Model, Wizard, config as proteus_config
url='https://admin:password@tryton.host/tryton/'
config = proteus_config.set_xmlrpc(url=url)
Module = Model.get('ir.module')
modules = Module.find([('name', 'in', [
'account',
'account_statement_ofx',
'account_statement_rule',
'country',
'currency',
])])
for module in modules:
module.click('activate')
Wizard('ir.module.activate_upgrade').execute('upgrade')
ConfigWizardItem = Model.get('ir.module.config_wizard.item')
for item in ConfigWizardItem.find([('state', '!=', 'done')]):
item.state = 'done'
item.save()
The result of running the above script against a standard tryton 5.4 container:
Traceback (most recent call last):
File "./test.py", line 21, in <module>
item.save()
File "/home/dave/.venv/lib/python3.7/site-packages/proteus/__init__.py", line 101, in newfunc
return self.func(owner, [instance], *args, **kwargs)
File "/home/dave/.venv/lib/python3.7/site-packages/proteus/__init__.py", line 858, in save
proxy.write(*values)
File "/usr/lib/python3.7/xmlrpc/client.py", line 1112, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python3.7/xmlrpc/client.py", line 1452, in __request
verbose=self.__verbose
File "/usr/lib/python3.7/xmlrpc/client.py", line 1154, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/lib/python3.7/xmlrpc/client.py", line 1170, in single_request
return self.parse_response(resp)
File "/usr/lib/python3.7/xmlrpc/client.py", line 1342, in parse_response
return u.close()
File "/usr/lib/python3.7/xmlrpc/client.py", line 656, in close
raise Fault(**self._stack[0])
xmlrpc.client.Fault: <Fault 4: 'Records were modified in the meanwhile'>
The traceback from the server:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/trytond/protocols/dispatcher.py", line 186, in _dispatch
result = rpc.result(meth(*c_args, **c_kwargs))
File "/usr/local/lib/python3.7/dist-packages/trytond/res/ir.py", line 229, in write
super(ModuleConfigWizardItem, cls).write(items, values, *args)
File "/usr/local/lib/python3.7/dist-packages/trytond/model/modelsql.py", line 159, in wrapper
return func(cls, *args, **kwargs)
File "/usr/local/lib/python3.7/dist-packages/trytond/model/modelsql.py", line 951, in write
cls.__check_timestamp(all_ids)
File "/usr/local/lib/python3.7/dist-packages/trytond/model/modelsql.py", line 551, in __check_timestamp
'Records were modified in the meanwhile')
trytond.exceptions.ConcurrencyException: Records were modified in the meanwhile