Merge pull request #3267 from expsa/bakry_hr3

fix
This commit is contained in:
bakry 2025-05-21 10:26:20 +03:00 committed by GitHub
commit d845e03fa3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 0 deletions

View File

@ -3486,3 +3486,8 @@ msgstr "النوع"
#: model:mail.template,subject:hr_holidays_public.email_template_employee_replace
msgid "بديل اجازة الموظف ${object.employee_id.name} "
msgstr ""
#. module: hr_holidays_public
#: model_terms:ir.ui.view,arch_db:hr_holidays_public.view_hr_holidays_filter2
msgid "Holidays Today"
msgstr "إجازات اليوم"

View File

@ -96,6 +96,22 @@ class HRHolidays(models.Model):
request_done = fields.Boolean(default=False,readonly=True)
is_branch = fields.Many2one(related='department_id.branch_name', store=True, readonly=True)
to_date = fields.Boolean(string='Today',compute='_leave_today_run', store=True)
def _compute_number_of_days(self):
res = super(HRHolidays, self)._compute_number_of_days()
self._leave_today_run()
@api.depends('date_from','date_to', 'create_date','state')
def _leave_today_run(self):
today = datetime.now().date()
for item in self:
if item.date_to and item.date_from:
if item.date_from.date() <= today <= item.date_to.date():
item.to_date = True
else:
item.to_date = False
## to remove followers ##
def _remove_followers_holiday(self):
for rec in self:

View File

@ -263,6 +263,7 @@
<filter name="state" string="State" context="{'group_by':'state'}"/>
<filter name="group_department" string="Department" domain="[]" context="{'group_by': 'department_id'}"/>
<filter name="group_branch" string="Branch" domain="[]" context="{'group_by': 'is_branch'}"/>
<filter string="Holidays Today" name="today_less" domain="[('to_date', '=', 'True')]"/>
</group>
</search>