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

Check that a field not changes after edition

By
José
on 4/13/15, 8:15 AM 408 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.

Thanks!

3

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 4/13/15, 9:46 AM

José,

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!


Regards,

Anil.


1
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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

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