Odoo Help

0

how to execute sql code from jasonRequest?

By
voathnak lim
on 7/19/13, 4:54 AM 768 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"

@oeweb.jsonrequest
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?

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.

Register

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

0 follower(s)

Stats

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