Tryton - Issues



Title FEC generation: 'ir.lang' Model has no attribute 'pm'
Priority bug Status chatting
Superseder Nosy List ced, reviewbot, semarie
Type crash Components account_fr
Assigned To semarie Keywords review
Reviews 282451002
View: 282451002

Created on 2019-11-20.15:37:03 by semarie, last changed by reviewbot.

review282451002 updated at
review282451002 updated at
review282451002 updated at
msg53364 (view) Author: [hidden] (semarie) Date: 2019-11-20.19:48:06
I created a review with reconciliation.create_date converted to date
msg53360 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-11-20.18:56:34
The test is not failing because pm is only required for datetime. And only reconciliation is datetime.
So I think the best is to convert the reconciliation create_date as date instead of fill pm on the language.
msg53359 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-11-20.18:52:20
Indeed FEC format force the configuration of the language so we use a fake one. But as we have defined new field on ir.lang that are used for formatting, we should fill them in the fake language.
msg53358 (view) Author: [hidden] (semarie) Date: 2019-11-20.15:37:02
Using tip (cbbf40368fcb exactly), when trying to generate FEC, I have the following exception:

Traceback (most recent call last):
  File "/trytond/model/", 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/", line 108, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/", line 48, in rpc
    request, database_name, *request.rpc_params)
  File "/trytond/", line 76, in auth_required
    return wrapped(*args, **kwargs)
  File "/trytond/protocols/", line 131, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/", line 186, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/wizard/", line 285, in execute
    return wizard._execute(state_name)
  File "/trytond/wizard/", line 316, in _execute
    result = self._execute(transition())
  File "/trytond/modules/account_fr/", line 117, in transition_generate
    row = self.get_row(line, format_date, format_number)
  File "/trytond/modules/account_fr/", line 305, in get_row
    format_date(reconciliation.create_date) if reconciliation else '',
  File "/trytond/modules/account_fr/", line 150, in <lambda>
    return lambda value: fr.strftime(value, '%Y%m%d')
  File "/trytond/ir/", line 504, in strftime
    p = or 'PM'
  File "/trytond/model/", line 1403, in __getattr__
    return super(ModelStorage, self).__getattr__(name)
  File "/trytond/model/", 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/ function get_format_date() is doing):
>>> fr = Lang(code='fr_FR', date='%d.%m.%Y')
Traceback (most recent call last):
  File "/usr/local/tryton-tip/lib/python3.7/site-packages/trytond/model/", line 277, in __getattr__
    return self._values[name]
KeyError: 'pm'

But I couldn't reproduce if I get a Lang from database:
>>> >>> fr, =[('code', '=', 'fr')])

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).
Date User Action Args
2019-11-21 08:40:53reviewbotsetmessages: + msg53370
2019-11-21 07:08:51reviewbotsetmessages: + msg53369
2019-11-20 20:08:25reviewbotsetstatus: unread -> chatting
nosy: + reviewbot
messages: + msg53365
2019-11-20 19:48:06semariesetstatus: chatting -> unread
reviews: 282451002
messages: + msg53364
keyword: + review
assignedto: semarie
2019-11-20 18:56:34cedsetmessages: + msg53360
2019-11-20 18:52:20cedsetstatus: unread -> chatting
nosy: + ced
messages: + msg53359
2019-11-20 15:37:03semariecreate

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