콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
340 화면

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

관련 게시물 답글 화면 활동
2
12월 22
14930
1
11월 21
5053
0
1월 21
2351
8
5월 20
7936
0
12월 23
2988