Odoo Help

Welcome!

This community 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.

1

Pass context with default value to a one2many field

By
Mohammed Roshan
on 3/3/15, 4:04 AM 3,373 views

hi

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

8

Vasanth

--Vasanth--
3458
| 5 3 8
Pondicherry, India
--Vasanth--
Vasanth
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

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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