Odoo Help

1

how to use onchange in OpenERP v7

By
More9ike
on 6/14/13, 9:14 AM 6,007 views

Hello all, please I have a model that contains 5 fields e.g employee name, department, job, and manager. I want a situation where if i choose an employee from the lists, the department, job and manager fields are automatically populated.

Please can somebody help me with this?

Thanks

5

ClueLogics Technologies Pvt. Ltd.

--ClueLogics Technologies Pvt. Ltd.--
6143
| 6 5 8
Delhi NCR, India
--ClueLogics Technologies Pvt. Ltd.--

 ClueLogics Technologies Pvt Ltd is a Software product and services provider. We are positioned to deliver robust, rapid and reliable Information Technology solutions that work. What we succeed upon is Technology and Technical Expertise. The industry review of ClueLogics has been commendable for the past years as most of its business comes from repeat orders by highly satisfied clients.

ClueLogics Technologies Pvt. Ltd.
On 6/14/13, 10:06 AM

Hi
do it like below:

    def myonchange(self,cr,uid,ids,employee_id,context=None):
       vals={}
       if employee_id:
            obj=self.pool.get('hr.employee').browse(cr,uid,employee_id)
            vals.update({'yourmanger':obj.manager_id.id,'yourjob':obj.job_id.id,'yourdepartment':obj.department_id.id})

       return {'value':vals}

add the the on_change in view in employee_id field

   <field name="employee_id" on_change="myonchange(employee_id)"/>

Thanks
Sandeep

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.

Register

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)

Stats

Asked: 6/14/13, 9:14 AM
Seen: 6007 times
Last updated: 3/16/15, 8:10 AM