Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
7773 Zobrazení

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
Zrušit
Nejlepší odpověď

Read datetime documentation, in particulare the strptime function doc.

Avatar
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
3
zář 20
6419
1
pro 24
16719
1
led 17
4481
4
srp 24
76990
2
kvě 25
1653