Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
335 มุมมอง

Hi everybody!!!

Please, i want to create a function which make me able to return the id of the object which i am creating.

I need your help please

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

well...
first.. that would be method, (since it belongs to a certain class ) 
second... the openerp/odoo framework in fact has such method... 
just call create(self, ... values)  ... pass the required/optional values as a dictionary,
and it will return the id of new created record...
hope it helps : )

edit after comment:

partner_obj = self.pool.get('res.partner')

in v7 api: 
created_partner_id = partner_obj.create(cr, uid, {'name':'Example partner'}).

n v8 api:created_partner_id = partner_obj.create({'name':'Example Partner'}).


you should also look in developers documentation:
for v8: https://www.odoo.com/documentation/8.0/reference/orm.html

r for v7 look for : OpenERP technical memento ... .hope it helps now : )

อวตาร
ละทิ้ง
ผู้เขียน

thx for the answer but can you please give me an example

edited my initial answer

Related Posts ตอบกลับ มุมมอง กิจกรรม
Selecting items for one2many relation แก้ไขแล้ว
2
ธ.ค. 22
14924
1
พ.ย. 21
5048
0
ม.ค. 21
2346
8
พ.ค. 20
7933
0
ธ.ค. 23
2985