Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
4641 Widoki

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

Awatar
Odrzuć
Najlepsza odpowiedź

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)
Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
mar 15
7133
1
cze 23
2272
3
maj 23
13180
1
kwi 23
11346
1
cze 22
2586