Skip to Content
मेन्यू
This question has been flagged
1 Reply
7684 Views

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
Discard
Best Answer

Read datetime documentation, in particulare the strptime function doc.

Avatar
Discard
Related Posts Replies Views Activity
3
सित॰ 20
6350
1
दिस॰ 24
16623
1
जन॰ 17
4413
4
अग॰ 24
76817
2
मई 25
1595