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

Hi, 

In early versions I used to do this:

states={'close': [('required', True), ('readonly',True)]}

in the definition of the field. When I did this it prevent to change the state while the field (the one required in the next state) isn't set.


In odoo 9 the state changes anyway and then if you try to edit the record you see that the fields is required. 

So, my question is how do I declare my filed in order to prevente any changes of state if the field is not set? 

For now, I did this:

    @api.multi
def to_close(self):
for record in self:
if record.reason and record.so_id:
record.write({'state':'close'})
else:
raise ValidationError(_('Missing required values!'))

 
Thanks 


الصورة الرمزية
إهمال
المنشورات ذات الصلة الردود أدوات العرض النشاط
4
مارس 20
3100
19
مايو 24
97566
3
سبتمبر 16
3744
1
أغسطس 16
3757
0
أغسطس 16
5155