Odoo Help


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.


how to execute sql code from jasonRequest?

voathnak lim
on 7/19/13, 4:54 AM 586 views

Hello i got a function and respond for ajax request and i want to get a row data from database but i did get success. please help.

class customone2many(oeweb.Controller):
_cp_path = "/product_extensions/customone2many"

def test_ajax(self, bom_lines_id=0):
    return  self._get_product_id( cr, uid, bom_lines_id)
    #return {'product_id': '70'}
def _get_product_id(self, cr, uid, bom_lines_id):
    cr.execute('SELECT product_id FROM mrp_bom WHERE id = ' + bom_lines_id)
    res = cr.fetchone()
    return res and res[0] or False

could you tell me how can i get the cr and uid variable?

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

0 follower(s)


Asked: 7/19/13, 4:54 AM
Seen: 586 times
Last updated: 3/16/15, 8:10 AM