Odoo Help


Pass context with default value to a one2many field

Mohammed Roshan
on 3/3/15, 4:04 AM 5,549 views


class search_names(osv.osv):
    _description = 'Search Names'
    _name = 'search.name'
    ' _columns = {                 'name' : fields.char('Search Name'),                 'search_name' : fields.many2one('trademark.names','Search Name'),                 'classification_no' : fields.many2one('classification','Class No'),                 }

class trademark_names(osv.osv):
    _description = 'Trademark Names'
    _name = 'trademark.names'
    _columns = {
                'name' : fields.char('Trademark Name', required=True),
                'class_no' : fields.many2one('classification','Class No'),

class ip_local(osv.osv):
    _description = 'Trademark File'
    _name = 'ip.local'     
    _columns = {
                'name' : fields.char('File Number', readonly=True),
                'classification_no_ids' : fields.many2one('classification','Classification No'),
                'search_result': fields.one2many('search.name','search_name','Search Name'),


in the model ip.local , the field classification_no_ids will have  a value

And when i create a new record using search_result(one2many) field in model ip.local

i wanna pass value in  classification_no_ids to the field class_no in model  trademark.names'

Can someone help me out here

Thanks in advance




| 5 3 8
Pondicherry, India
On 3/3/15, 5:38 AM

Hi Mohammed,

you can pass the values by using default

you this code:

<field name="search_result" context="{'default_classification_no':classification_no_ids}"/>

yes it worked Thank you very much

Mohammed Roshan
on 3/3/15, 8:55 AM

Nic Work

aci aisha
on 3/3/15, 9:22 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

1 follower(s)


Asked: 3/3/15, 4:04 AM
Seen: 5549 times
Last updated: 5/5/16, 10:31 AM