Odoo Help


odoo 8 search condition using date error

George Vincent
on 5/26/16, 11:26 AM 786 views

Hi  all,

          I am trying to retrieve some values that matches date but i am getting error. 

I created like this self.search([('date', '=', datetime.now().date())])

 ERROR  openerp.sql_db: Programming error: COALESCE types text and date cannot be matched

LINE 2: ... SELECT ct.id, coalesce(it.value,ct."date")


, in query SELECT "table_table".id FROM "table_table" WHERE ("table_table"."id" in (WITH temp_irt_current (id, name) as (

SELECT ct.id, coalesce(it.value,ct."date")

FROM bill_records ct

LEFT JOIN ir_translation it ON (it.name = %s and

it.lang = %s and

it.type = %s and

it.res_id = ct.id and

it.value != '')


SELECT id FROM temp_irt_current WHERE name = %s order by name

)) ORDER BY "table_table"."id"  

George Vincent
On 5/26/16, 1:51 PM

Hi friend,

                I tried like you said but i am getting the same 

               self.search([('date', '=', fields.Date.to_string(datetime.today().date()))])

              Sample out put from your code 

                      print fields.Date.to_string(datetime.today().date())         -----------2016-05-26

                      print type(fields.Date.to_string(datetime.today().date())) ---------<type 'str'>


Prakash Sharma

--Prakash Sharma--
--Prakash Sharma--

I like to surround myself with brave, creative people.

My motivation for learning different technologies and algos drive me. I love challenges of a steep learning curve which I believe makes me a better learner. I have a strong desire to learn different technologies, which would enable me to become a full stack developer.

Prakash Sharma
On 5/26/16, 1:04 PM

As odoo store date in text format so convert type of date to string using  strftime  or use  fields.Date.to_string(datetime.datetime.today())

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.


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

1 follower(s)


Asked: 5/26/16, 11:26 AM
Seen: 786 times
Last updated: 5/26/16, 1:51 PM