コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
4214 ビュー

I want to know how to use write() and create() methods and what is its purpose?. I already read the docs from openerp but still I am not getting it.

アバター
破棄
最善の回答

For this please refer doc.openerp.com

アバター
破棄
最善の回答

"Write" method is using to update or write a value in already existing id. Its like as Update query. See the below example

Table Name - person_details(OpenERP object name is person.details)

id name age

1 AA 15

2 BB 18

If you want to update an age value in Id(1), so you have to use "Write" method like as(In OpenERP)

self.pool.get(person.details).write(cr, uid, 1, {'age':16})

Value '1' is exiting object id in table. After the above statement execution look out your db that will be updated like as below

id name age

1 AA 16

2 BB 18

------------------------------------------**********--------------------------------------------------------

"Create" method is using to create a record in table. Its like as Create query.

If you want to create a new record in person_details table, so you have to use "Create" method like as(In OpenERP)

self.pool.get(person.details).create(cr, uid, {'name':'CC','age':16})

After the above statement execution look out your db that will be updated like as below

id name age

1 AA 16

2 BB 18

3 CC 16

アバター
破棄
著作者

Thanks for your reply.. I was really want to know the write() function to use when I am click on save button.

関連投稿 返信 ビュー 活動
2
9月 23
7664
2
3月 23
46732
2
12月 23
57677
0
3月 22
2347
3
6月 20
10641