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

I have custom model, when I'm trying to make grouping only 'name' is grouped. On grouping by any other custom field odoo makes groups with zero count in tree view, something like this:

<field_1> (0)

<field_2> (0)

...

<field_n> (0)

 

I've written search view with 'group_by' filters in context, but the result is the same - groups with zero count.

It should be something simple I'm not considering.

Any suggestion?


アバター
破棄
著作者 最善の回答

solved! very simple!

the only you need is to override read_group() method and change lazy=True to lazy=False

tested in odoo 9.0

@api.model

def read_group(self, domain, fields, groupby, offset=0, limit=None, orderby=False, lazy=True):

    return super(<your_model_class_name>, self).read_group(domain, fields, groupby, offset=offset, limit=limit, orderby=orderby, lazy=False)


アバター
破棄