In odoo14, I have made an API to put the attendance but it creates the attendance as it is two hours later, for example, I create it at 9 pm it appears as it is 11 pm but in the database, the time is as I want
creation code:
def format_time(self,time_str):
return fields.datetime.strptime(time_str, '%m/%d/%Y %I:%M:%S %p')
@http.route('/create_attendance',type='json',auth='none',cors='*')
def index(self,check_in,check_out,user_name,base_location=None):
att_env = request.env['hr.attendance']
employee_id = request.env['hr.employee'].sudo().search([('name','=',user_name)])[0].id
check_in_time = self.format_time(check_in)
check_out_time = self.format_time(check_out)
new_att = att_env.sudo().create({
'employee_id':employee_id,
'check_in':check_in_time,
'check_out':check_out_time
})
return new_att.check_out # returns what i want but in the ui it's wrong