Merge pull request #3796 from expsa/fix_hr_att_err

Fix hr att err
This commit is contained in:
eslamtalaat744 2025-07-08 10:43:12 +03:00 committed by GitHub
commit 1e0e0d64cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 32 additions and 7 deletions

View File

@ -412,16 +412,34 @@ class HrAttendanceTransactions(models.Model):
time_list[7] = two_sp_timing and two_sp_timing.end_sign_out or calendar.shift_two_max_sign_out
return time_list, planed_hours
# def get_speacial_day_timing(self, calender, weekday, at_date, shift=None):
# sp_days = shift and calender.special_days_partcial or calender.special_days
# for spday in sp_days:
# if spday.name.lower() == weekday and ((shift and spday.shift == shift) or (not shift and True)):
# if spday.date_from and spday.date_to \
# and str(at_date) >= spday.date_from and str(at_date) <= spday.date_to:
# return spday
# elif spday.date_from and not spday.date_to and str(at_date) >= spday.date_from:
# return spday
# elif not spday.date_from and spday.date_to and str(at_date) <= spday.date_to:
# return spday
# elif not spday.date_from and not spday.date_to:
# return spday
def get_speacial_day_timing(self, calender, weekday, at_date, shift=None):
# Ensure at_date is a date object
if isinstance(at_date, str):
# Adjust the format string to match your date string format
at_date = datetime.strptime(at_date, "%Y-%m-%d").date()
sp_days = shift and calender.special_days_partcial or calender.special_days
for spday in sp_days:
if spday.name.lower() == weekday and ((shift and spday.shift == shift) or (not shift and True)):
if spday.date_from and spday.date_to \
and str(at_date) >= spday.date_from and str(at_date) <= spday.date_to:
and at_date >= spday.date_from and at_date <= spday.date_to:
return spday
elif spday.date_from and not spday.date_to and str(at_date) >= spday.date_from:
elif spday.date_from and not spday.date_to and at_date >= spday.date_from:
return spday
elif not spday.date_from and spday.date_to and str(at_date) <= spday.date_to:
elif not spday.date_from and spday.date_to and at_date <= spday.date_to:
return spday
elif not spday.date_from and not spday.date_to:
return spday

View File

@ -11,9 +11,12 @@
<header position="replace">
<header>
<button name="program_directory" string="program Director" class="oe_highlight" type="object"
states="hr_head_approval" groups="hr_base.group_executive_manager"/>
<button name="hr_head_approval" string="HR Head Approval" class="oe_highlight"
type="object" states="employeed_aproval" groups="hr.group_hr_manager"/>
states="employeed_aproval" groups="hr.group_hr_manager"/>
<!-- states="employeed_aproval" groups="hr_base.group_executive_manager"/>-->
<!-- <button name="hr_head_approval" string="HR Head Approval" class="oe_highlight"-->
<!-- type="object" states="employeed_aproval" groups="hr.group_hr_manager"/>-->
<button name="employeed_aproval" string="Employee Approval" class="oe_highlight"
type="object" states="draft" groups="hr.group_hr_user"/>
<button name="end_contract_state" string="End Contract" class="oe_highlight"
@ -22,8 +25,11 @@
type="object" attrs="{'invisible':[('state','=','draft')]}" groups="hr.group_hr_user"/>
<field name="state" widget="statusbar"
statusbar_visible="draft,employeed_aproval,hr_head_approval,program_directory,end_contract"/>
statusbar_visible="draft,employeed_aproval,program_directory,end_contract"/>
</header>
<!-- statusbar_visible="draft,employeed_aproval,hr_head_approval,program_directory,end_contract"/>-->
<!-- -->
</header>
<field name="employee_id" position="replace"/>
@ -288,6 +294,7 @@
>
<field name="name"/>
<field name="employee_id"/>
<field name="department_id"/>
<field name="job_id"/>
<field name="type_id" invisible="1"/>
<field name="emp_type"/>