Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
3904 Tampilan

Hi, 


I'm new to Odoo Development.

I tried to follow the examples found on  https://www.odoo.com/documentation/15.0/developer/misc/api/odoo.html
and
https://www.odoo.com/documentation/15.0/developer/reference/addons/orm.html

But I am stuck when trying to receive only id's when using manytoone fields :

When trying to get information from tags (category_id's) linked to hr.employee everything works fine :

# Code used
employees = models.execute_kw(db, uid, password,'hr.employee', 'search_read',[[['name', '=', 'Anna']]],{'fields': ['display_name', 'category_ids'],'limit': 3}) 
# Output 
[{'id': 452, 'display_name': 'Anna', 'category_ids': [1, 3]}]

When trying to get employee_id's linked to skills (hr.employee.skill), things go wrong because I do not only receive the id's, but also the display_name of the employees 


# Code used 
skills = models.execute_kw(db, uid, password,'hr.employee.skill', 'search_read',[],{'fields': ['id','display_name','employee_id'],'limit': 3}) 
# Output[{'id': 7, 'display_name': 'Developer', 'employee_id': [1, 'John']}, {'id': 5, 'display_name': 'Negotiation', 'employee_id': [459, 'David B.']}, {'id': 4, 'display_name': 'Negotiation', 'employee_id': [1, 'John']}]

What should I do to only receive the ids ? 


Thx

Sven

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
2
Feb 25
5899
1
Des 24
1450
1
Nov 22
15962
3
Agu 22
12984
2
Agu 22
4476