Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Error filter: results.group_by is undefined ???

By
kaisusr
on 12/1/14, 9:25 AM 776 views

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

1

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 12/1/14, 8:42 PM

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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 12/1/14, 9:25 AM
Seen: 776 times
Last updated: 3/16/15, 8:10 AM