Odoo Help


set values for many2one child fields by function ? [Closed]

on 3/29/13, 1:26 AM 1,418 views

The Question has been closed

on 04/22/2013 05:00:38

below shows my view xml and model class. i have a form to add records.its work properly. but i need to set values for that sub childs onchange event. i refer this link also from documentation

and here is my whole code of module GIT HUB REPO

<field name='selected_tea_workers_line_ids' nolabel='1'>
<tree string='List' readonly='1'>
<field name='tea_line_worker_id' invisible="0" />
<field name='worker_id' />
<field name='is_selected' />

    def on_change_division(self, cr, uid, ids, bpl_division_id):
        v = {}
        if bpl_division_id:
            work_offer = self.pool.get('bpl.work.offer').browse(cr, uid, 2)
            v['selected_tea_workers_line_ids'] = work_offer.selected_tea_workers_line_ids
            if work_offer.selected_tea_workers_line_ids:
                for record_item in work_offer.selected_tea_workers_line_ids:
                    v['tea_line_worker_id'] = record_item.selected_tea_workers_line_ids.tea_line_worker_id
                    v['worker_id'] = record_item.selected_tea_workers_line_ids.worker_id
                    v['is_selected'] = record_item.selected_tea_workers_line_ids.is_selected
        return {'value':v}
On 4/22/13, 5:00 AM

work done and updated in my Github repo

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

0 follower(s)


Asked: 3/29/13, 1:26 AM
Seen: 1418 times
Last updated: 3/16/15, 8:10 AM