Odoo Help

Welcome!

This community 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.

0

I am beginner in openerp framework ...

By
baxi
on 2/5/14, 2:46 AM 1,143 views

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.

1
Ronak Baxi (rba)
On 6/23/14, 2:50 AM

For this please refer doc.openerp.com

1
Ayyappan
On 2/5/14, 4:58 AM

"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.

baxi
on 2/5/14, 5:32 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 2/5/14, 2:46 AM
Seen: 1143 times
Last updated: 3/16/15, 8:10 AM