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.

0

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

By
priyankahdp
on 3/29/13, 1:26 AM 1,204 views

The Question has been closed

by
priyankahdp
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' />
</tree>
</field>

    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}
0

priyankahdp

--priyankahdp--
1089
| 5 5 6
Colombo, Sri Lanka
--priyankahdp--
Java Developer ORACLE Python J2EE Spring Hibernate Struts & Jquery............. :-)
priyankahdp
On 4/22/13, 5:00 AM

work done and updated in my Github repo

About This Community

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

Question tools

0 follower(s)

Stats

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