commit
b99e960881
|
|
@ -85,10 +85,29 @@ class HrAttendanceTransactions(models.Model):
|
|||
day_trans.update({'is_absent': True})
|
||||
if item.calendar_id.is_flexible:
|
||||
item.write({'temp_lateness': 0.0, 'temp_exit': 0.0, 'official_hours': item.office_hours})
|
||||
if item.temp_lateness:
|
||||
item.approve_lateness = True
|
||||
if item.temp_exit:
|
||||
item.approve_exit_out = True
|
||||
# if item.temp_lateness:
|
||||
# item.approve_lateness = True
|
||||
# if item.temp_exit:
|
||||
# item.approve_exit_out = True
|
||||
#################### Fix lateness,exit_out start #######################
|
||||
if item.temp_lateness or item.temp_exit : # solve one cases and add other case #TODO
|
||||
is_late_sign_in = item.sign_in > item.calendar_id.full_max_sign_in
|
||||
if item.sign_in < item.calendar_id.full_min_sign_in:
|
||||
expected_sign_in = item.calendar_id.full_min_sign_in
|
||||
if item.sign_in >= item.calendar_id.full_min_sign_in and item.sign_in <= item.calendar_id.full_max_sign_in :
|
||||
expected_sign_in = item.sign_in
|
||||
if is_late_sign_in:
|
||||
expected_sign_in = item.calendar_id.full_max_sign_in
|
||||
expected_sign_out = expected_sign_in + item.calendar_id.working_hours
|
||||
is_early_sign_out = item.sign_out > 0.0 and item.sign_out < expected_sign_out
|
||||
item.temp_lateness = item.sign_out > 0.0 and is_late_sign_in and item.sign_in - expected_sign_in or 0
|
||||
item.temp_exit = is_early_sign_out and expected_sign_out - item.sign_out or 0
|
||||
item.approve_lateness = is_late_sign_in
|
||||
item.approve_exit_out = is_early_sign_out
|
||||
|
||||
#if item.sign_out == 0.0:
|
||||
#item.is_absent = True
|
||||
#################### Fix end #######################
|
||||
if item.break_duration and item.calendar_id.break_duration:
|
||||
# item.write({'break_duration': item.break_duration - item.calendar_id.break_duration}) #TODO
|
||||
item.write({'break_duration': item.break_duration})
|
||||
|
|
@ -306,10 +325,36 @@ class HrAttendanceTransactions(models.Model):
|
|||
shift_dict['sign_out'] = sign_out and self.get_sign_time(fields.Datetime.to_string(sign_out))[0] or 0.0
|
||||
shift_dict['sign_in_dt'] = sign_in and sign_in or 0.0
|
||||
shift_dict['sign_out_dt'] = sign_out and sign_out or 0.0
|
||||
shift_dict['temp_lateness'] = sign_in and sign_out and (
|
||||
'''shift_dict['temp_lateness'] = sign_in and sign_out and (
|
||||
sign_in > max_in_dt and round((sign_in - min_in_dt).seconds / 60 / 60, 2)) or 0.0
|
||||
shift_dict['temp_exit'] = sign_in and sign_out and (
|
||||
sign_out < min_out_dt and round((max_out_dt - sign_out).seconds / 60 / 60, 2)) or 0.0
|
||||
sign_out < min_out_dt and round((max_out_dt - sign_out).seconds / 60 / 60, 2)) or 0.0'''
|
||||
####################
|
||||
if sign_in and not sign_out and max_in_dt and sign_in > max_in_dt:
|
||||
shift_dict['temp_lateness'] = round((sign_in - max_in_dt).seconds / 60 / 60, 2)
|
||||
elif sign_in and sign_out and max_out_dt and \
|
||||
sign_in > min_in_dt and min_out_dt <= sign_out <= max_out_dt:
|
||||
temp_lateness = round((sign_in - min_in_dt).seconds / 60 / 60, 2) - round(
|
||||
(sign_out - min_out_dt).seconds / 60 / 60, 2)
|
||||
shift_dict['temp_lateness'] = temp_lateness if temp_lateness > 0 else 0.0
|
||||
elif sign_in and sign_out and max_out_dt and \
|
||||
sign_in > min_in_dt and sign_out <= min_out_dt:
|
||||
temp_lateness = round((sign_in - min_in_dt).seconds / 60 / 60, 2)
|
||||
shift_dict['temp_lateness'] = temp_lateness if temp_lateness > 0 else 0.0
|
||||
# elif sign_in and sign_out and max_in_dt and max_out_dt and sign_in > max_in_dt and sign_out >= max_out_dt:
|
||||
# temp_lateness = round((sign_in - max_in_dt).seconds / 60 / 60, 2)
|
||||
# shift_dict['temp_lateness'] = temp_lateness if temp_lateness > 0 else 0.0
|
||||
elif sign_in and sign_out and max_in_dt and max_out_dt and sign_in > max_in_dt and sign_out >= max_out_dt:
|
||||
temp_lateness = round((sign_in - max_in_dt).seconds / 60 / 60, 2)
|
||||
shift_dict['temp_lateness'] = temp_lateness
|
||||
elif sign_in and sign_out and not max_out_dt and sign_in > min_in_dt and min_out_dt <= sign_out <= max_out_dt:
|
||||
shift_dict['temp_lateness'] = round((sign_in - min_in_dt).seconds / 60 / 60, 2)
|
||||
else:
|
||||
shift_dict['temp_lateness'] = 0.0
|
||||
|
||||
shift_dict['temp_exit'] = sign_in and sign_out and (sign_out < min_out_dt and
|
||||
round((min_out_dt - sign_out).seconds / 60 / 60, 2)) or 0.0
|
||||
##############################
|
||||
shift_dict['break_duration'] = 0.0
|
||||
shift_dict['office_hours'], shift_dict['official_hours'] = office_hours, official_hours
|
||||
if sign_in and sign_out and ((next_min_in_dt and sign_in > max_out_dt and sign_out < next_min_in_dt)
|
||||
|
|
@ -562,7 +607,7 @@ class HrAttendanceTransactions(models.Model):
|
|||
if state is not None: return feedback
|
||||
|
||||
@api.model
|
||||
def process_attendance_scheduler_queue(self, attendance_date=None, attendance_employee=None):
|
||||
def process_attendance_scheduler_queue(self, attendance_date=None, attendance_employee=None,send_email=False):
|
||||
at_device = self.env['ir.module.module'].sudo().search([('state', '=', 'installed'),
|
||||
('name', '=', 'to_attendance_device_custom')]) \
|
||||
and True or False
|
||||
|
|
@ -651,7 +696,7 @@ class HrAttendanceTransactions(models.Model):
|
|||
if not (not one_signs_in and not signs_out):
|
||||
if one_signs_in:
|
||||
signs_out = signs_out.filtered(
|
||||
lambda s: str(s.name) >= str(one_signs_in[0].name)) or attendance_pool
|
||||
lambda s: s.name >= one_signs_in[0].name) or attendance_pool
|
||||
one_dict = self.prepare_shift(at_device, attendance_dt, one_signs_in, signs_out,
|
||||
one_min_in_dt,
|
||||
one_max_in_dt, one_min_out_dt, one_max_out_dt,
|
||||
|
|
@ -766,7 +811,7 @@ class HrAttendanceTransactions(models.Model):
|
|||
if not (not one_signs_in and not signs_out):
|
||||
if one_signs_in:
|
||||
signs_out = signs_out.filtered(
|
||||
lambda s: s.name > str(one_signs_in[0].name)) or attendance_pool
|
||||
lambda s: s.name > one_signs_in[0].name) or attendance_pool
|
||||
one_dict = self.prepare_shift(at_device, attendance_dt, one_signs_in, signs_out,
|
||||
one_min_in_dt,
|
||||
one_max_in_dt, one_min_out_dt, one_max_out_dt,
|
||||
|
|
|
|||
|
|
@ -513,6 +513,19 @@ msgstr "إنشاء أيام العطل الرسمية من تلك الموجود
|
|||
msgid "Cron Run Date"
|
||||
msgstr "تاريخ تنفيذ كرون"
|
||||
|
||||
#. module: hr_holidays_public
|
||||
#: model:ir.model.fields,field_description:hr_holidays_public.field_hr_inverse_holidays__balance_leaves
|
||||
#: model_terms:ir.ui.view,arch_db:hr_holidays_public.leaves_balance_form_view
|
||||
#, python-format
|
||||
msgid "Balance"
|
||||
msgstr "ترصيد"
|
||||
|
||||
#. module: hr_holidays_public
|
||||
#: model:ir.model.fields,field_description:hr_holidays_public.field_hr_inverse_holidays__no_balance_leaves
|
||||
#: model_terms:ir.ui.view,arch_db:hr_holidays_public.leaves_balance_form_view
|
||||
msgid "No Balance"
|
||||
msgstr "عدم ترصيد"
|
||||
|
||||
#. module: hr_holidays_public
|
||||
#: model_terms:ir.ui.view,arch_db:hr_holidays_public.leaves_balance_form_view
|
||||
msgid "Cron Run Times"
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<field name="name">Leaves Balance</field>
|
||||
<field name="model">hr.holidays</field>
|
||||
<field name="arch" type="xml">
|
||||
<form create="false">
|
||||
<form create="false" edit="false" delete="false">
|
||||
<sheet>
|
||||
<group>
|
||||
<group>
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
<field name="name">Leaves Balance</field>
|
||||
<field name="model">hr.holidays</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree create="false" edit="false">
|
||||
<tree create="false" edit="false" delete="false">
|
||||
<field name="employee_id" string="Employee"/>
|
||||
<field name="holiday_status_id" string="Leave Type"/>
|
||||
<field name="state" invisible="1"/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue