Odoo Help


create record of other object from my object

Atchuthan - Technical Consultant, Sodexis Inc
on 7/29/13, 4:44 AM 1,453 views

     When I click on "SAVE" event to create a record in my object, my field values are also used to create a record in other object.

Also my requirement doesnt go well with _inherits of other object.

Thanks & Regards,

Write def create() for this.

Hiral Patel (hip)
on 7/29/13, 5:30 AM

@Hiral Patel

def create() is used only to provide the values to be set at the time of create for my object

but my requirement is to create a record of other object

If we can use create() ORM method, give me in detail

Atchuthan - Technical Consultant, Sodexis Inc
on 7/29/13, 5:40 AM

Hiral Patel (hip)

--Hiral Patel (hip)--
| 2 1 5
--Hiral Patel (hip)--

Hiral Patel (hip)
On 7/29/13, 7:20 AM


class test1(osv.osv): _name = 'test1'

class test(osv.osv):

_name = 'test'

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

    att_id = self.pool.get('test1').create(cr, uid, {'key':value}, context=context)

    res = super(test, self).create(cr, uid, vals, context=context)

    return res

Here, 'test' & 'test1' are two objects. I have written a create() in 'test', When we create a record for this object it will create record for 'test1' as we have written self.pool.get('test1').create(cr, uid, {'key':value}, context=context).

we have to pass a dictionary of 'Key' & of it's value.

Thank you.

Don't hesitate to mark as "correct" the answer. That will be helpful for future search.

on 8/2/13, 12:08 PM

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

0 follower(s)


Asked: 7/29/13, 4:44 AM
Seen: 1453 times
Last updated: 3/31/15, 5:37 PM