Skip to Content
Menú
This question has been flagged
1 Respondre
4551 Vistes

Hi, I created a custom Progress field (integer) for Project, how do I set this custom field to 100, whenever user change state to Closed or Done?

Thanks

Avatar
Descartar
Best Answer

You can inherit the write method of that object, something like this:

class class_name(osv.osv):
    _inherit='object.name'
    def write(self, cr, uid, ids, vals, context=None):
        #Maybe some code here
        if vals.get('state'):
            if vals.get('state')=='done':
                #write your code here to write the percentage

    return super(class_name, self).write(cr, uid, ids, vals, context=context)
Avatar
Descartar
Related Posts Respostes Vistes Activitat
1
de març 15
6982
1
de juny 23
2154
3
de maig 23
13126
1
d’abr. 23
11217
1
de juny 22
2483