Odoo Help


functions in odoo like .write, .execute etc?

Milva Joy
on 4/15/15, 7:42 AM 1,065 views

can anyone explain me the different functions available in odoo?

Alby Antony
On 4/15/15, 7:43 AM


please refer claim_management module submit claim

this function is used to check validation of a field on changing the value of the field

this function can pass value to the controller with in the function invocation parameters(eg: cancellation date is send as argument to controller in below code)

view file code

<field name="visa_cancellation_date" on_change="onchange_visadate(visa_cancellation_date)"/>

function definition in controller.py

def onchange_visadate(self, cr, uid, ids, visa_cancellation_date=None, context=None):

res = {'value':{}}


---operations to be performed on this function----

return {'value': res.get('value',{})}


to insert a new row in a table

this function have a argument vals which contains all the values submitted by the form. print vals variable to know more

def create(self, cr, uid, vals, context=None):

if context is None:

context = {}

print 'valsvalsvals',vals

--------operations to be performed on this---------

row_id = super(claim_submitted, self).create(cr, uid, vals, context=context)

return True


this function is used to update a record in table

def action_verify(self,cr, uid, ids, context=None):

if context is None:

context = {}

self.write(cr, uid, ids, {'state': 'verify','verified_date': time.strftime('%Y-%m-%d'),'verified_id':uid}, context=context)

return True


to execute a query in python or in function

refer claim module in kmcc

def onchange_member_id(self, cr, uid, ids, member_id, context=None):


if member_id:

print member_id


cr.execute('SELECT * FROM res_users WHERE id=%s',(tuple(member_id)))

res = cr.fetchone()

print '########res_users##########',res

return {'value':v}


You Can see more info Here

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: 4/15/15, 7:42 AM
Seen: 1065 times
Last updated: 4/15/15, 11:26 AM