python 3.x - How to calculate the difference between time in odoo -
anyone can tell how calculate difference between time here time in , out, in :-code tried:-
@api.model @api.depends('attendance_manage_lines.punch_time') def _time_difference(self): ls=[] item in self.attendance_manage_lines: data = {} data[item.punch_time]=str(item.punch_type) ls.append(data)`
now how calculate :- here difference between in , out comes in work duration , out , in comes in break duration.
from openerp.tools import default_server_date_format, default_server_datetime_format datetime import datetime, timedelta out = datetime.strptime(out, default_server_datetime_format) intime = datetime.strptime(intime, default_server_datetime_format) diff = out - intime #here out , in punch intime , out times.output exact difference in datetime object
Comments
Post a Comment