4
votes

shows me the following error when adding these lines, openerp 7

    _group_by_full = {
        'stage_id': lambda *args:['diagnostico','autorizado'],
    }

shows me the following error

TypeError: <lambda>() got an unexpected keyword argument 'read_group_order'
1
provide your whole code, this code is not enough - user1576199

1 Answers

5
votes

Given what you have provided, the only thing I can do is give you a broad answer. The structure of anonymous functions (lambda) goes like this:

lambda argument1, argument2,... argumentN :expression using arguments

Your error indicates that lambda was expecting a keyword argument (kwargs) but you passed only positional arguments (args) to the function. That being said, you might want to try this code instead:

_group_by_full = {
    'stage_id': lambda *args, **kwargs:['diagnostico','autorizado'],
}

That being said, I don't think that will completely solve your problem, it fixes this:

BEFORE:

>>> x = lambda *args:['diagnostico','autorizado']
>>> x('one','two')
['diagnostico', 'autorizado']
>>> x('one','two', keyword='keyword')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: <lambda>() got an unexpected keyword argument 'keyword'

AFTER:

>>> x = lambda *args, **kwargs:['diagnostico','autorizado']
>>> x('one','two', keyword='keyword')
['diagnostico', 'autorizado']

But as you can see, your function will always return that same list. If these were supposed to be your arguments you will have to re-write this accordingly and don't forget the function :). Hope this helps. More on lambda here.