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.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
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.
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.
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
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng ký