Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
4691 Lượt xem

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

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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)
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 3 15
7219
1
thg 6 23
2319
3
thg 5 23
13214
1
thg 4 23
11391
1
thg 6 22
2651