Odoo Help

0

ProgrammingError: operator does not exist: timestamp without time zone" Error on search view

By
kais dkhili
on 8/15/14, 6:09 AM 2,490 views

Hello,

i want to make a search view; but i have a problem when my search is based on the following field:

'reports_datecreation' :fields.function(_getcreatedate, method=True, type='char', string='le', store=True),

the function is the following:

def _getcreatedate(self,cr,uid,ids,name,args,context=None):
        date=''
        res={}
        id=ids[0]
        for report in self.browse(cr,uid,ids,context=context):
            cr.execute("select create_date from ch14_reports where id=%s",[id])
            r=cr.fetchone()
            date=r[0]
            res[report.id]=date
        return res

the ERROR is the Following:

ProgrammingError: operator does not exist: timestamp without time zone ~~* unknown LINE 1: ...ch14_reports" WHERE ("ch14_reports"."create_date" ilike ' ... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

Can someone tell me what'is wrong ? the field saved is : 2014-08-14 16:20:38.546581 her type is char

Change type in function field to 'date'.

Ben Bernard
on 8/15/14, 6:34 AM

Bernard there is no changes

kais dkhili
on 8/15/14, 6:55 AM

Bernard there is no changes

kais dkhili
on 8/15/14, 6:56 AM

restart? I'm sorry to ask, but python is not ruby or php.

Ben Bernard
on 8/15/14, 7:16 AM
0

Kais,

cr.execute("select create_date from ch14_reports where id=%s",[id])

Should be

cr.execute("select create_date from ch14_reports where id=%s",id)

OR

cr.execute("select create_date from ch14_reports where id=%s" % id)

Thanks.

About This Community

This platform 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.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)

Stats

Asked: 8/15/14, 6:09 AM
Seen: 2490 times
Last updated: 3/16/15, 8:10 AM