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

Save Button

By
aci aisha
on 1/20/15, 11:54 PM 918 views

Which fuction works when pressing "Save" button

4

Anil R. Kesariya

--Anil R. Kesariya--
4321
| 6 5 8
Gandhinagar, India
--Anil R. Kesariya--
ERP Consultant

Key Skill
-
Technical & Functional Expert
Anil R. Kesariya
On 1/21/15, 12:06 AM

Hello aci aisha,

LIBU has given corret answer. I will improve his answer.

1) When you click for the very first time on save button after providing detail of your record than it will call the save button of orm.

2) when you update the information of of existing it will call the write() method.

These methods defined in base model.

Whenever we are defining any class we are passing one argument in class like

class your_class(models.Model),

class your_class(osv.Model) or class your_class(osv.osv)

whatever version you are using you are passing something in your class this is the base class where all the methods are defined.

Hope this will helps.

Regards,

Anil.

 

 

Thanks Anil, But i did'nt knw which fcn call when press "Save" I want to work as when i press second time

aci aisha
on 1/21/15, 12:30 AM

write() method is called. you can override the write() method.

Anil R. Kesariya
on 1/21/15, 7:48 AM
4

Openies Services

--Openies Services--
925
| 2 2 4
Vadodara, India
--Openies Services--

We provide Odoo Services.

Contact us on : contact@openies.com

Openies Services
On 3/30/15, 9:58 AM

When you click on save button it will call create method, and pass all the filled value.

When you modify the record it will call write method. and pass the active record ids and modified field values.

If you want to try it your self you can open a terminal and see log. In that you can see the method call. like

 "POST /web/dataset/call_kw/res.partner/create HTTP/1.1" 200 
 "POST /web/dataset/call_kw/res.partner/write HTTP/1.1" 200 

1

Odoo

--Odoo --
1328
| 5 2 5
kerala, India
--Odoo --

Working as a Odoo Functional and Technical Expert

Odoo
On 1/20/15, 11:59 PM

Your model is subclass of orm.Model'. There are methods inclass BaseModel(BaseModel is inherited by Model) which will be call for thesave` record. These methods are

def create(self, cr, user, vals, context=None)

hanks dear Libu,Can we pass values to 2 classes in a single in "Save" button..

aci aisha
on 1/21/15, 12:03 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

1 follower(s)

Stats

Asked: 1/20/15, 11:54 PM
Seen: 918 times
Last updated: 3/30/15, 9:58 AM