Odoo Help


Check that a field not changes after edition

on 4/13/15, 8:15 AM 466 views

Hello, I have Odoo 8. I am developing a module and I want to override "write" method to check that a special field (for instance: "field_a") not changes after edition. How can I check this?

In the creation the field can assume any value.



Anil R. Kesariya

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

Key Skill
Technical & Functional Expert
Anil R. Kesariya
On 4/13/15, 9:46 AM


Here you go!

    def write(cr, uid, ids, vals, context=None):

        if not vals.has_key(''field_a):

            print "Your Field A is not updated..."

        res =  super(class_name, self).write(cr, uid, ids, vals, context=context)

        return res

This might helps you!



Ajeng Shilvie
On 4/13/15, 9:23 AM

try this ;

def write(self,cr,uid,ids,vals,context=None):

     if vals.get('field_a',False):

               ##### if pass the condition means that 'field_a' has been updated

      return super(your_class_name, self).write(cr, uid, ids, vals, context=context)

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


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 4/13/15, 8:15 AM
Seen: 466 times
Last updated: 4/14/15, 4:26 PM