Odoo Help


Content of self.search

John Doe
on 5/5/16, 8:10 AM 328 views

How can i have a look at the results(res) of self.search.

res = self.search([('type','=',inv_type),('number','=',str(number_down)),('date_invoice','>',date_invoice)])
if res:
     raise except_orm(res bla bla bla bla bla..............................
Jose Vasquez
On 5/5/16, 9:04 AM

Hi John Doe, try this:

from openerp.exceptions import UserError

res = self.search([('type','=',inv_type),('number','=',str(number_down)),('date_invoice','>',date_invoice)])
raise osv.except_osv(_('Title'),_(res))

or to see in your log:

import logging
_logger = logging.getLogger(__name__)

res = self.search([('type','=',inv_type),('number','=',str(number_down)),('date_invoice','>',date_invoice)])
logger.info('Content: %r',res)

I hope it helps you, regards.

Dr Obx
On 5/5/16, 9:48 AM

res = self.search([('type','=',inv_type),('number','=',str(number_down)),('date_invoice','>',date_invoice)])raise osv.except_osv(_('Title'),_(res)
#If you want just see what's inside of your res add
print res
then in console you will see what's in there
this is the easiest thing you can do. I think ...

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 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/5/16, 8:10 AM
Seen: 328 times
Last updated: 9/24/16, 4:23 AM