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

How do I write ('product_tmpl_id.last_synchro_ing', '<', date) properly (as a search domain)

By
Tatorus
on 3/9/16, 8:23 AM 358 views

Hi, i wanna assign products in my db to idProduct with this line :

idProduct = product_product.search(['|', ('product_tmpl_id.ing', '=', True), ('product_tmpl_id.last_synchro_ing', '<', date)], order='id')

But the sample in bold doesn't work.

I tested with one product whom don't respect this condition ('product_tmpl_id.last_synchro_ing', '<', date) but the idProduct still includes it:

The product I tested :

date = 2016-03-02 13:10:53.017044

idProd[0].last_synchro_ing = 2016-03-09


An idea ? Thanks in advance.




1

Jérémy Kersten (jke)

--Jérémy Kersten (jke)--
2993
| 3 2 5
Jodoigne, Belgium
--Jérémy Kersten (jke)--

Jérémy is a member of the core R&D team since september 2013. He developed several projects for OpenERP version 8 including the eCommerce, the Google Calendar synchronization and the new product variants/configurator. Now, he manages Odoo website and themes for saas.

Jérémy Kersten (jke)
On 3/9/16, 2:33 PM

Hello


Idem, date should be a string...

so:

    your_date.strftime(DEFAULT_SERVER_DATE_FORMAT)


And ps, you domain starts with one '|' (OR), so all product_tmpl_id.ing, == True will be returned !

Is it possible to compare two strings (the dates) with "('product_tmpl_id.last_synchro_ing', '

Tatorus
on 3/10/16, 5:44 AM

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

2 follower(s)

Stats

Asked: 3/9/16, 8:23 AM
Seen: 358 times
Last updated: 3/11/16, 4:08 AM