fix
This commit is contained in:
parent
2f20f070ff
commit
81a6bdd165
|
|
@ -368,7 +368,7 @@ class ActionReason(models.Model):
|
|||
class Attendance(models.Model):
|
||||
_name = 'attendance.attendance'
|
||||
_rec_name = 'employee_id'
|
||||
_order = 'action_date DESC'
|
||||
_order = 'name DESC'
|
||||
|
||||
employee_id = fields.Many2one('hr.employee', string="Employee", domain="[('state', '=', 'open')]", required=True,
|
||||
ondelete='cascade', index=True)
|
||||
|
|
@ -388,6 +388,14 @@ class Attendance(models.Model):
|
|||
company_id = fields.Many2one(related='employee_id.company_id', string='Company')
|
||||
is_branch = fields.Many2one(related='department_id.branch_name', store=True, readonly=True)
|
||||
|
||||
is_today = fields.Boolean(string='Is Today', compute='_compute_is_today', store=True)
|
||||
|
||||
@api.depends('action_date')
|
||||
def _compute_is_today(self):
|
||||
today = datetime.now().date()
|
||||
for record in self:
|
||||
record.is_today = record.action_date == today
|
||||
|
||||
@api.depends('name')
|
||||
def compute_date(self):
|
||||
for item in self:
|
||||
|
|
|
|||
|
|
@ -330,8 +330,7 @@
|
|||
<filter name="group_department" string="Department" domain="[]" context="{'group_by': 'department_id'}"/>
|
||||
<filter name="group_branch" string="Branch" domain="[]" context="{'group_by': 'is_branch'}"/>
|
||||
<separator/>
|
||||
|
||||
<filter string="Attendance Today" name="today_less" domain="[('action_date','<=',time.strftime('%%Y-%%m-%%d'))]"/>
|
||||
<filter string="Attendance Today" name="today_less" domain="[('is_today', '=', 'True')]"/>
|
||||
<separator/>
|
||||
<separator/>
|
||||
<filter string="My Attendance" name="my_attendance" domain="[('employee_id.user_id', '=', uid)]"/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue