Odoo Help

5
2 Answers
10
Avatar

ClueLogics Technologies Pvt. Ltd.

--ClueLogics Technologies Pvt. Ltd.--
6203
| 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.
5/23/13, 8:25 AM

Hi Aldennis

suppose your one2manyfield name is my_field then

define list in first ex .. r=[]

then

r.append({'first_field_ino2m':'my vlaue','second......':'my second value'})

you can add more field availble in That one2manyobject for another record just continuous append same after all append completed just add rinmy_field':r,

exm. vals.update({'my_field':r})

Thanks
Sandeep

3 Comments
Camptocamp SA
8/21/13, 11:43 AM

This solution allows you to use the on_change even if you just clicked create and haven't saved your record yet. +1 and setted as accepted answerd. Thanks Sandeep

Ankit H Gandhi(AHG)
8/3/16, 6:13 AM

Thanks @ Sandeep +1

SunArc Technologies, Pawan Sharma
10/23/17, 7:18 AM

hello @Cluelogics @Camptocamp,

My problem in the following link. Can you provide me approprient solution for this problem.

https://www.odoo.com/nl_NL/forum/help-1/question/how-to-update-all-values-of-one2many-field-in-table-for-odoo10-125284

5
Avatar

Sudhir Arya (ERP Harbor Consulting Services)

--Sudhir Arya (ERP Harbor Consulting Services)--
13452
| 7 8 8
Ahmedabad, India
--Sudhir Arya (ERP Harbor Consulting Services)--

• Co-Founder & Co-Owner at ERP Harbor Consulting Services

• ERP Consultant / ERP Customization / TechnoFunctional Expert

• Sound knowledge in Python, Odoo (Open ERP), XML, PostgreSQL

• Domain knowledge of Sale Management, Purchase Management, Warehouse Management, Manufacturing, Multi Company Configuration & Management, HR Management, Medical Management, Construction Management, Education Management, Point of Sale, Third Party Integrations

• Positive attitude and quick Learner

• Good analytical skill, quick bug and issue tracing and find the solution

• Good knowledge and experience in payment gateway integration with Odoo

• Ready to accept new challenges

• Active Memeber On Stackoverflow 

LinkedIn

Blog

Stackoverflow

ERP Harbor Consulting Services

Skype:sudhir@erpharbor.com
Website: http://www.erpharbor.com
Sudhir Arya (ERP Harbor Consulting Services)
5/23/13, 10:16 AM

You need to return all IDs in one list with your one2many field in values.

Syntax:

return {'value': {'your_one2many_field': list_of_ids}}

For example my_emp_ids is my one2many field of hr.employee and I want to fill it when I will select Department. I want all employees of selected Depratment.

def onchange_department(self, cr, uid, deprt_id):
    employee_ids = self.search(cr, uid, [('department_id', '=', deprt_id)])
    return {'value': {'my_emp_ids': employee_ids}}
2 Comments
Nanda Kanoko
7/15/13, 2:13 AM

I've tried your code , it's working . but the employee filled is not based on their department , but based on the id of class that contain deprt_id . Example : in my departments , Admin have ID 1 , Programmer have ID 2 , Engineer have ID 3 . When I choose Programmer Department , the printed employees on my_emp_ids is not programmer dept employee , but Admin dept employee . When I checked on PostgreSQL Database , the deprt_id shows correct id ( same id with department_id ) . I assume that the printed employee based on id of deprt_id and not the deprt_id . Am I making mistake ? please help

Ankit H Gandhi(AHG)
11/23/15, 7:15 AM

This code is full work Thank you @ Sudhir sir +1 and up voted.

Ask a Question
Writer
Tag
Keep Informed
3 follower(s)
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