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.

1

How to know, in Javascript, the state of a form (edit/view mode)

By
Dijoux Corentin
on 3/20/14, 1:00 PM 2,051 views

Hello,

I wan't to know if it's possible to know the mode of a form : if it's in edit mode or in view mode? I need this information to change the "edit" mode of a widget that I implement! If it's not in edit mode, the user can't edit information, but if it's in edit mode, he can change these information!

Moreover, when the user click on button "Save", how can I saved the information of my widget in the BDD? What is the function to redefined to do that?

Thank you in advance!

Best regards, Corentin Dijoux

Hi, I also need an answer to this question

YannickB
on 4/9/14, 1:31 PM
0
Dijoux Corentin
On 5/20/14, 4:46 AM

Hello,

 

I forgot this messages! I find the solution, but i didn't think to post the solution here.

 

In a javascript object, apparently, you have the variable "active_view" (this.active_view). It's equal to "page" if it's the "view" mode and when it's the "edit" mode, the variable is equal to "form".

 

The function call each time you click on the "Save" button is the "do_save" function (that you can modify to save your information). The function to call after each change (o change the state of the "Save" button) is : "this.on_ui_change()".

 

Best regards,

Corentin Dijoux

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

2 follower(s)

Stats

Asked: 3/20/14, 1:00 PM
Seen: 2051 times
Last updated: 3/16/15, 8:10 AM