Odoo Help


How to access calculated fields in the create method

Tarek Mohamed Ibrahim
on 5/26/15, 1:03 AM 832 views


In the write method I can access the current created object using the browse orm method as follows:

o = self.browse(cr,uid,ids,context=context)[0]
I need to do the same thing in the 'create' method as I need to access some function fields that are not listed in the vals parameter of the create method, pls advise



As you access browse inside write method, you can also access browse inside create method as like below.

Inside Odoo V8.

def create(self, vals):

    new_object = super(self,class_name).create(vals) # create method in odoo V8 return browse object instead of integer ID.

    new_object.xxx_field #you can get any of the field as like this.

    return new_object

Inside OpenERP V7.

def create(self, cr, uid, vals, context={})

    new_id = super(self, class_name).create(cr, uid, vals, context=context)

    new_obj = self.browse(cr, uid, new_id, context=context)

    new_obj.xxx_field #you can access any field as like this.

    return new_id

I hope it is helpful to you.

Thx for answer, I found it useful and applied it in my code

Tarek Mohamed Ibrahim
on 6/14/15, 11:27 AM

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

2 follower(s)


Asked: 5/26/15, 1:03 AM
Seen: 832 times
Last updated: 6/14/15, 11:26 AM