Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
2 Răspunsuri
5724 Vizualizări

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!

Imagine profil
Abandonează
Cel mai bun răspuns

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.


Imagine profil
Abandonează
Cel mai bun răspuns


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)



Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
7
mai 20
6150
0
apr. 16
2893
11
sept. 21
31802
2
ian. 24
14738
2
dec. 17
3958