İçereği Atla
Menü
Bu soru işaretlendi
4144 Görünümler

i have function approve inherit in hr.analytic.timesheet

 

def approve(self,cr,uid,ids,context=None):
    for value in self.browse(cr,uid,ids) :
        value.write({'state':'done'})
    return True 


and when i click my button approve (state=confirm)  its show constraint like this

Error! You cannot modify an entry in a confirmed timesheet.


and i try to redefine function like this

 def _check(self, cr, uid, ids):
        for line in self.browse(cr, uid, ids):
            if line.sheet_id and line.sheet_id.state not in ('draft', 'new','confirm'):
                    raise osv.except_osv(_('Error!'), _('You cannot modify an entry in a confirmed timesheet.'))
            return True 

in my function i add state confirm. but the constraiint still show. what should i do with my code? is there something wrong? thanks before

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Ağu 17
5932
1
Tem 16
3619
1
Tem 25
363
0
Tem 25
397
1
May 25
886