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

Before edit a record event

By
Zakir Husain
on 9/26/15, 2:31 PM 560 views

Hi,

        I want to check some condition on edit button click of a record if condition meet then only allow user to edit that record otherwise raise an exception.

        For achieve this where should i write my code so it will check that condition before Edit that record.

Nice question. I don't know how to solve it, but you need to deal with Javascript. I searched and found that when edit button is clicked the 'on_rpc_event' javascript event is called to show the 'Loading (..' instance title. I think community could help complete this piece of information, this comment may boost the replies.

Tarek Mohamed Ibrahim
on 9/27/15, 1:43 AM
0

Pawan

--Pawan--
1267
| 4 3 5
Hyderabad, India
--Pawan--


Pawan
On 9/28/15, 1:47 AM

Yusuf,

If you don't want to apply constraints on click of save button, then you can use "on_change" events of the fields on which you want to apply the constraints. ochange methods will be called as and when the cursor is moved off the particular fields (or the field gets out of focus)


0

Tarek Mohamed Ibrahim

--Tarek Mohamed Ibrahim--
896
| 5 3 7
Gîza, Egypt
--Tarek Mohamed Ibrahim--

I am an old VFP developer on ERP

I have moved to 2p since Nov-2014 and started developing with Python on Odoo.

https://www.linkedin.com/profile/public-profile-settings?trk=prof-edit-edit-public_profile

tibrahim@2p.com.sa

Tarek Mohamed Ibrahim
On 9/27/15, 3:39 AM

For the moment you can put all your checks in the 'write' method, get the record id and get the original record from the database by the record id and do your checks on the original record. You can then allow save process or trigger a warning message and raise an error. This gives you the same final result.

but in that case user will edit the record and once the save button click then only i can check the condition and give an exception. But that i don't want it. Is there any other solution to do this?

Zakir Husain
on 9/27/15, 1:26 PM

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: 9/26/15, 2:31 PM
Seen: 560 times
Last updated: 9/28/15, 1:48 AM