0

モジュールでかんばんビューを作成しました。フィールドを使用してかんばんにプロパティ
を設定しました。状態には次が含まれます。default_group_bystate

[('new','Waiting Queue'),('in_progress','In Progress'),('done','Finished')]

しかし、特定の状態のデータがない場合、その状態のデータを作成するまで、状態の列は表示されません。
この問題を回避する方法はありますか?ありがとう..

4

2 に答える 2

0

_group_by_full メソッドを使用できます。このメソッドは、このフィールドでグループ化されている場合、_read_group に含めるために (name_get of records, {id: fold}) を返さなければなりません。もちろん、この列のデータがまだない場合でも、必要な列のすべての値を返すことができます。project.py と crm_lead.py で _group_by_full の明確な例を見ることができます。

于 2014-05-05T12:42:25.097 に答える
0

_group_by_full dictionnary を使用してそれを達成し、osv.osv クラスに追加できます。

たとえば、サンプル コードを確認します。

def _read_group_state_ids(self, cr, uid, ids, domain, read_group_order=None, access_rights_uid=None, context=None):

    stage_obj = self.pool.get('produce.book.stage')
    order = stage_obj._order

    if read_group_order == 'stage_id desc':
        order = "%s desc" % order
    # perform search
    stage_ids = stage_obj._search(cr, uid, [], order=order, access_rights_uid=access_rights_uid, context=context)
    result = stage_obj.name_get(cr, access_rights_uid, stage_ids, context=context)
    # restore order of the search
    result.sort(lambda x, y: cmp(stage_ids.index(x[0]), stage_ids.index(y[0])))

    fold = {}
    for stage in stage_obj.browse(cr, access_rights_uid, stage_ids, context=context):
        fold[stage.id] = stage.fold or False
    return result, fold

_group_by_full = {
    'stage_id': _read_group_state_ids
}

result は (id, name) を含むタプルのリストで、fold はペア {id: bool} の辞書で、それぞれが true の場合、その列は fold になります。

于 2014-11-13T05:08:37.833 に答える