Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
4330 Lượt xem

Hello.

i want to define a filter which is based on a fields.function but i have always this error  results.group_by is undefined

my code xml is the following:

<field name="historique_id"  widget="many2many_tags" invisible="1"/>

<filter string="Historique" name="histo_user" domain="[('agenda_user_rel','in',historique_id[0][2])]"/>

historique_id is defined in python like the folllowing:

'historique_id': fields.function(itk_facturation_fct_get_historique,type='many2many',string=U'Historique',store=False,relation="itk.facturation.historiqueagenda"),

and my function is the following:

def itk_facturation_fct_get_historique(self,cr,uid,context=None):
        result={}
        for agenda in self.browse(cr,uid,ids,context=context):
            cr.execute("select emp_id from itk_facturation_historiqueagenda,histo_agenda_emp_rel where itk_facturation_historiqueagenda.historiqueagenda_user_id=%s and itk_facturation_historiqueagenda.id=histo_agenda_emp_rel.histo_id",[uid])
            liste=[]
            for r in cr.fetchall():
                liste.append(r[0])
            result[agenda.id] = liste
            print "***result>>>",result
        return result

please any help

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Function fields can only be used in domain, filter, group by, etc. if either stored or have fnct_search defined.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 15
7775
5
thg 9 20
12875
1
thg 3 15
5358
2
thg 3 15
7608
0
thg 3 15
4041