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

How to do pre data population on a one2many field?

By
Anirudh Lou
on 2/10/15, 5:45 AM 786 views

Hi to all, does any one knows how to prepopulate a data on a one2many field? I mean, when a user clicks "Add an item" on a one2many fields some fields from this line will populated? I have here the image.

 

Any help is much appreciated.

1

Ivan

--Ivan--
3210
| 5 3 6
Jakarta, Indonesia
--Ivan--
Ivan
On 2/10/15, 6:00 AM

The image is not shown.  Anyway, it is a combination of _defaults value (and overriding the default_get method of ORM) and on_change on the fields that are given _defaults.

0

Atchuthan - Technical Consultant, Sodexis Inc

--Atchuthan - Technical Consultant, Sodexis Inc--
3918
| 5 3 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 2/10/15, 6:01 AM

You could use context to set the values of the fields at one2many field
In res.partner table, odoo uses context to pass the values of Company to its Contacts.  Refer:https://github.com/odoo/odoo/blob/8.0/openerp/addons/base/res/res_partner_view.xml#L191

context={'default_country_id':country_id}

(*) default_FIELDNAME ==> set value for your particular field
(*) search_default_FILTERNAME ==> sets the search filter by default

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: 2/10/15, 5:45 AM
Seen: 786 times
Last updated: 3/16/15, 8:10 AM