Odoo Help


Get data from one model to another model

on 3/31/15, 1:14 AM 2,391 views

Hi,,help me in getting this,,,

when i fill the form   i.e, it contains(subject,date,amount,note) of one model,,it has to update in the another model, it contains (subject,date,amount).


please explain your scenario with code

Atchuthan - Technical Consultant, Sodexis Inc
on 3/31/15, 1:22 AM
Alby Antony
On 3/31/15, 5:00 AM

i have dobe the similar may be this will help you. i created an invoice table entry when one claim form is approved. here i will give the code

class claim_submitted(osv.osv):

_name = "claim_submitted"

_description = "claims submitted"

_columns = {

'claim_name':fields.many2one('claim_type','Claim type:',required=True),

'claim_name_edit':fields.char('Claim :' ,readonly = True),

'member_id':fields.many2one('res.users','Member ID:',required=True, ),


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



claim_invoices = self.pool.get('claim_invoices')

vals = {'claim_id': ids[0], 'invoice_date': time.strftime('%Y-%m-%d'), 'invoice_amount':invoice_amount}

claim_invoices.create(cr, uid, vals, context=context)

self.write(cr, uid, ids, {'state': 'done','approved_date': time.strftime('%Y-%m-%d'),'approved_id':uid}, context=context)

return True

class claim_invoices(osv.osv):

_name = "claim_invoices"

_description = "invoices generated for claims"

_columns = {

'claim_id': fields.integer('claim_id:'),

'invoice_date':fields.date('Invoice date:'),

'invoice_amount':fields.integer('Invoice amount:')


instead of this approve function you can use create function.

On 3/31/15, 1:27 AM

Hi,  Atchuthan 

can u give me some examples on this 


Atchuthan - Technical Consultant, Sodexis Inc

--Atchuthan - Technical Consultant, Sodexis Inc--
| 5 5 8
Puducherry, India
--Atchuthan - Technical Consultant, Sodexis Inc--
Passionate coder in Python/Odoo(formerly known as OpenERP).

Contact me via GMail: atchuthantu@gmail.com via Skype: atchuthan_skype
via Linkedin: http://in.linkedin.com/in/atchuthantu
Atchuthan - Technical Consultant, Sodexis Inc
On 3/31/15, 1:22 AM

You can load the value using 3 ways:

1. context (Preferred)
2. default_get
3. defaults

pass the context with default_FIELDNAME keyword

E.g. context={'default_name': name}

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: 3/31/15, 1:14 AM
Seen: 2391 times
Last updated: 4/17/15, 1:46 AM