Skip to Content
Menu
This question has been flagged
1 Odpoveď
4326 Zobrazenia

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

Avatar
Zrušiť
Best Answer

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

Avatar
Zrušiť
Related Posts Replies Zobrazenia Aktivita
1
mar 15
7774
5
sep 20
12875
1
mar 15
5354
2
mar 15
7605
0
mar 15
4041