migration error from 5.0 to 5.2: ir.msg_setter_function_missing
I am testing a migration path between 5.0 and 5.2.
When tryting to synchronize out_fo_sync ir.model.data records, I have the following error:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/semarie/tmp/tryton/tryton-5.2/lib/python3.7/site-packages/trytond/model/modelview.py", line 692, in wrapper
return func(cls, records, *args, **kwargs)
File "/home/semarie/tmp/tryton/tryton-5.2/lib/python3.7/site-packages/trytond/ir/model.py", line 1265, in sync
Model.write(*values_to_write)
File "/home/semarie/tmp/tryton/tryton-5.2/lib/python3.7/site-packages/trytond/model/modelsql.py", line 159, in wrapper
return func(cls, *args, **kwargs)
File "/home/semarie/tmp/tryton/tryton-5.2/lib/python3.7/site-packages/trytond/model/modelsql.py", line 1007, in write
field.set(cls, fname, *fargs)
File "/home/semarie/tmp/tryton/tryton-5.2/lib/python3.7/site-packages/trytond/model/fields/function.py", line 126, in set
**Model.__names__(self.name)))
NotImplementedError: Fonction de définition manquante pour le champ « Report » sur « Modèle de compte ».
The exception message (in french here) is "ir.msg_setter_function_missing".
I tested it with empty database with only standard modules installed. The database has been initialized with a Party, a Company, and a Chart of Accounts (French plan).
Next, I started the following upgrade path:
- stopped my 5.0 server
- applying database conversion described on https://discuss.tryton.org/t/migration-from-5-0-to-5-2/995
- running trytond-admin -d test -m
- running trytond-admin -d test --all
few warnings
- with trytond-console, I checked for out_of_sync records
>>> Data = pool.get('ir.model.data')
>>> ms = Data.search([('out_of_sync', '=', True)])
>>> len(ms)
87
>>> set(map(lambda m: (m.module, m.model) , ms))
{('account', 'ir.model.button'), ('country', 'country.subdivision'), ('account_invoice', 'ir.model.button'), ('account_payment', 'ir.rule.group'), ('account_product', 'ir.rule.group'
), ('account_fr', 'account.account.type.template'), ('account_invoice', 'ir.rule.group'), ('account_statement', 'ir.model.button'), ('account_statement', 'ir.rule.group'), ('account_
asset', 'ir.model.button'), ('ir', 'ir.lang'), ('account_payment_sepa', 'ir.rule.group'), ('account_payment_sepa', 'ir.model.button'), ('analytic_account', 'ir.rule.group'), ('accoun
t', 'ir.rule.group'), ('res', 'ir.rule.group'), ('account_asset', 'ir.rule.group'), ('company', 'ir.rule.group'), ('account', 'account.account.type.template')}
>>> Data.sync(ms)
>>> Data.search([('out_of_sync', '=', True)])
[]
>>> transaction.commit()
- rerun trytond-admin -d test --all
no more warnings
- rerun trytond-console -d test
>>> Data = pool.get('ir.model.data')
>>> ms = Data.search([('out_of_sync', '=', True)])
>>> len(ms)
651
>>> set(map(lambda m: (m.module, m.model) , ms))
{('account', 'ir.action.act_window'), ('ir', 'ir.ui.menu'), ('account', 'ir.action.act_window.domain'), ('ir', 'ir.lang'), ('account_fr', 'account.tax.code.line.template'), ('account
_fr', 'account.account.template'), ('res', 'ir.cron'), ('account_asset', 'account.account.template'), ('account_fr', 'account.account.type.template'), ('account_payment_clearing', 'i
r.cron'), ('account_payment', 'ir.action.act_window'), ('account', 'account.account.type.template'), ('account', 'account.account.template')}
>>> Data.sync(ms)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/home/semarie/tmp/tryton/tryton-5.2/lib/python3.7/site-packages/trytond/model/modelview.py", line 692, in wrapper
return func(cls, records, *args, **kwargs)
File "/home/semarie/tmp/tryton/tryton-5.2/lib/python3.7/site-packages/trytond/ir/model.py", line 1265, in sync
Model.write(*values_to_write)
File "/home/semarie/tmp/tryton/tryton-5.2/lib/python3.7/site-packages/trytond/model/modelsql.py", line 159, in wrapper
return func(cls, *args, **kwargs)
File "/home/semarie/tmp/tryton/tryton-5.2/lib/python3.7/site-packages/trytond/model/modelsql.py", line 1007, in write
field.set(cls, fname, *fargs)
File "/home/semarie/tmp/tryton/tryton-5.2/lib/python3.7/site-packages/trytond/model/fields/function.py", line 126, in set
**Model.__names__(self.name)))
NotImplementedError: Fonction de définition manquante pour le champ « Report » sur « Modèle de compte ».
If I ran Data.sync() individually on each record, I have errors only on a few set of records.
>>> def resync_one_by_one(ms):
... for m in ms:
... try:
... Data.sync([m])
... except:
... pass
...
>>> resync_one_by_one(ms)
>>> ms = Data.search([('out_of_sync', '=', True)])
>>> len(ms)
93
>>> set(map(lambda m: (m.module, m.model) , ms))
{('account_fr', 'account.account.template'), ('account_asset', 'account.account.template')}
Example of values:
>>> ms[0].model
'account.account.template'
>>> ms[0].module
'account_asset'
>>> ms[0].values
'[["deferral",true],["kind","expense"],["name","Assets"],["parent",1],["reconcile",false],["type",6]]'
>>> ms[0].fs_values
'[["deferral",true],["kind","expense"],["name","Assets"],["parent",1],["reconcile",false],["type",297]]'
>>> ms[-1].model
'account.account.template'
>>> ms[-1].module
'account_fr'
>>> ms[-1].values
'[["code","8092"],["deferral",true],["kind","other"],["name","Contrepartie 802"],["parent",1315],["type",296]]'
>>> ms[-1].fs_values
'[["code","8092"],["deferral",true],["kind","other"],["name","Contrepartie 802"],["parent",1315],["type",314]]'