Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
3 Răspunsuri
3695 Vizualizări

I am newbie in odoo 8 , I add a date field entry and exit date and how to calculate the date of entry and exit dates

Imagine profil
Abandonează
Autor Cel mai bun răspuns

Mr.achuthan I am still confused with answer , Mr.achuthan could give a few examples of the answers above

Imagine profil
Abandonează
Cel mai bun răspuns

You use normal python library to do date calculation.  There are many python datetime libraries out there, but I would recommend that you use datetime with some improvement from dateutil if necessary.
 

Imagine profil
Abandonează
Cel mai bun răspuns

d_frm_obj = datetime.strptime(entry_date, DEFAULT_SERVER_DATETIME_FORMAT)
d_to_obj = datetime.strptime(exit date, DEFAULT_SERVER_DATETIME_FORMAT)
diff = d_to_obj - d_frm_obj
print diff.days  //provides days

https://www.odoo.com/forum/help-1/question/how-to-find-out-number-of-hours-between-two-datetime-object-69367#answer-69386

Imagine profil
Abandonează