SQL query in Odoo

How to use sql query in Odoo model

today = time.strftime('%Y-%m-%d')
year = today[2:4]
head = "%s%s" % (year,partner_code)
sql = "select name from sale_order where name like '%s____' order by name desc;" % head
res_name = self.env.cr.fetchone()

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.