تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
2 الردود
5851 أدوات العرض

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!

الصورة الرمزية
إهمال
أفضل إجابة

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.


الصورة الرمزية
إهمال
أفضل إجابة


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)



الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
7
مايو 20
6304
0
أبريل 16
2978
11
سبتمبر 21
31988
2
يناير 24
14896
2
ديسمبر 17
4098