Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
1 Svar
7790 Visninger

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
Kassér
Bedste svar

Read datetime documentation, in particulare the strptime function doc.

Avatar
Kassér
Related Posts Besvarelser Visninger Aktivitet
3
sep. 20
6438
1
dec. 24
16734
1
jan. 17
4490
4
aug. 24
77067
2
maj 25
1659