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

I am trying to work with the due date in account.invoice, i want the difference of current date an date_due but i get this error. ValueError: time data 'inv.date_due' does not match format '%m-%d-%Y %H:%M:%S'

my code is:

def _get_date_difference(self, cr, uid, ids, field_name, arg,context):
        res={}
        for inv in self.browse(cr,uid,ids):            
            dt=datetime.strptime('inv.date_due', '%m-%d-%Y %H:%M:%S').date()
##            if inv.payment_term and inv.state == "open":
            res[inv.id] = abs((datetime.now()-dt).days)
        return res
Avatar
Vazgeç
En İyi Yanıt

Read datetime documentation, in particulare the strptime function doc.

Avatar
Vazgeç
İlgili Gönderiler Cevaplar Görünümler Aktivite
3
Eyl 20
6441
1
Ara 24
16737
1
Oca 17
4492
4
Ağu 24
77082
2
May 25
1662