コンテンツへスキップ
メニュー
この質問にフラグが付けられました
6 返信
25883 ビュー

   I have used following code  but i get traceback : TypeError: read_group() got multiple values for keyword argument 'context

   @api.model
    def read_group(self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True):
        """ Override read_group to always display all states. """
        if groupby and groupby[0] == "state":
            states = self.EVALUATION_STATE
            read_group_all_states = [{
                        '__context': {'group_by': groupby[1:]},
                        '__domain': domain + [('state', '=', state_value)],
                        'state': state_value,
                    } for state_value, state_name in states]
            read_group_res = super(hr_evaluation, self).read_group(domain, fields, groupby, offset, limit, orderby, lazy)
            result = []
            for state_value, state_name in states:
                res = filter(lambda x: x['state'] == state_value, read_group_res)
                if not res:
                    res = filter(lambda x: x['state'] == state_value, read_group_all_states)
                result.append(res[0])
            return result
        else:
            return super(hr_evaluation, self).read_group(domain, fields, groupby, offset=offset, limit=limit, orderby=orderby, lazy=lazy)

 

it works well with old api 

 

アバター
破棄
著作者

@prakash : This question related to new api not old api.

Is Version 8 ?.. In the latest version https://github.com/odoo/odoo/blob/master/addons/account/report/account_entries_report.py File read_group method is defined with the given below same parameters. Let me know if any issues.

著作者

i konw that but it's all about new api not versioning. u can check new api guideline: https://github.com/nbessi/odoo_new_api_guideline/blob/master/source/environment.rst

please see the link http://www.slideshare.net/openobject/odoo-from-v7-to-v8-the-new-api may be help you.

最善の回答

In Odoo 9 with the new API I call it like you and it is working

アバター
破棄
最善の回答

Try the below parameters in read_group method.

 def read_group(self, cr, uid, domain, fields, groupby, offset=0, limit=None, context=None, orderby=False,lazy=True):
       # your code
       return super(hr_evaluation self).read_group(cr, uid, domain, fields, groupby, offset, limit, context, orderby,lazy)

アバター
破棄
関連投稿 返信 ビュー 活動
3
5月 20
7777
3
12月 23
19796
1
3月 15
8463
2
1月 20
15653
0
1月 17
11178