Hi, i have to select in idProd the products who respect those conditions :
idProd = product_product.search([('product_tmpl_id.ing', '=', True), ('product_tmpl_id.last_synchro_ing', '<', date)], order='id')
The problem is for the sample in bold because "product_tmpl_id.last_synchro_ing" is a string and "date" is a datetime.
So I don't know how to compare them in a search domain, thanks in advance.
There are also helper functions on the fields.Date model:
""" Convert an ORM ``value`` into a :class:`date` value. """
""" Convert a :class:`date` value into the format expected by the ORM. """
So you could do
idProd = product_product.search([('product_tmpl_id.ing', '=', True), ('product_tmpl_id.last_synchro_ing', '<', fields.Date.to_string(date))], order='id')
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
|Asked: 3/10/16, 6:17 AM|
|Seen: 916 times|
|Last updated: 4/19/16, 4:24 PM|