FEC generation: 'ir.lang' Model has no attribute 'pm'
Using tip (cbbf40368fcb exactly), when trying to generate FEC, I have the following exception:
Traceback (most recent call last):
File "/trytond/model/model.py", line 277, in __getattr__
return self._values[name]
KeyError: 'pm'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/trytond/wsgi.py", line 108, in dispatch_request
return endpoint(request, **request.view_args)
File "/trytond/protocols/dispatcher.py", line 48, in rpc
request, database_name, *request.rpc_params)
File "/trytond/wsgi.py", line 76, in auth_required
return wrapped(*args, **kwargs)
File "/trytond/protocols/wrappers.py", line 131, in wrapper
return func(request, pool, *args, **kwargs)
File "/trytond/protocols/dispatcher.py", line 186, in _dispatch
result = rpc.result(meth(*c_args, **c_kwargs))
File "/trytond/wizard/wizard.py", line 285, in execute
return wizard._execute(state_name)
File "/trytond/wizard/wizard.py", line 316, in _execute
result = self._execute(transition())
File "/trytond/modules/account_fr/account.py", line 117, in transition_generate
row = self.get_row(line, format_date, format_number)
File "/trytond/modules/account_fr/account.py", line 305, in get_row
format_date(reconciliation.create_date) if reconciliation else '',
File "/trytond/modules/account_fr/account.py", line 150, in
return lambda value: fr.strftime(value, '%Y%m%d')
File "/trytond/ir/lang.py", line 504, in strftime
p = self.pm or 'PM'
File "/trytond/model/modelstorage.py", line 1403, in __getattr__
return super(ModelStorage, self).__getattr__(name)
File "/trytond/model/model.py", line 280, in __getattr__
% (self.__name__, name, self._values))
AttributeError: 'ir.lang' Model has no attribute 'pm': {'code': 'fr_FR', 'date': '%d.%m.%Y'}
Fault: 'ir.lang' Model has no attribute 'pm': {'code': 'fr_FR', 'date': '%d.%m.%Y'}
I am able to reproduce it with trytond-console (it is the same way account_fr/account.fr function get_format_date() is doing):
>>> fr = Lang(code='fr_FR', date='%d.%m.%Y')
>>> fr.pm
Traceback (most recent call last):
File "/usr/local/tryton-tip/lib/python3.7/site-packages/trytond/model/model.py", line 277, in __getattr__
return self._values[name]
KeyError: 'pm'
...
But I couldn't reproduce if I get a Lang from database:
>>> >>> fr, = Lang.search([('code', '=', 'fr')])
>>> fr.pm
''
I am unsure if the problem is in account_fr (Lang should be get from database) or in trytond itself (pm field should be infered to None as not defined).