Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
7904 Vistas

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
Descartar
Mejor respuesta

Read datetime documentation, in particulare the strptime function doc.

Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
3
sept 20
6532
1
dic 24
16840
1
ene 17
4574
4
ago 24
77543
2
may 25
1806