Merge branch 'leave_manage' into 'development'

comment code for timesheet validation

See merge request prakash.jain/cor-odoo!191
This commit is contained in:
pawan.sharma 2021-07-25 07:53:02 +00:00
commit 8a14a73f6b
1 changed files with 13 additions and 13 deletions

View File

@ -225,16 +225,16 @@ class AccountAnalyticLine(models.Model):
if rec.start_datetime:
rec.date = rec.start_datetime.date()
@api.constrains('start_datetime', 'end_datetime', 'employee_id')
def _check_date(self):
for entry in self.filtered('employee_id'):
domain = [
('start_datetime', '<', entry.end_datetime),
('end_datetime', '>', entry.start_datetime),
('employee_id', '=', entry.employee_id.id),
('id', '!=', entry.id),
]
entries = self.search_count(domain)
if entries:
raise ValidationError(
_('You can not set 2 timesheet entries that overlaps on the same day for the same employee.'))
# @api.constrains('start_datetime', 'end_datetime', 'employee_id')
# def _check_date(self):
# for entry in self.filtered('employee_id'):
# domain = [
# ('start_datetime', '<', entry.end_datetime),
# ('end_datetime', '>', entry.start_datetime),
# ('employee_id', '=', entry.employee_id.id),
# ('id', '!=', entry.id),
# ]
# entries = self.search_count(domain)
# if entries:
# raise ValidationError(
# _('You can not set 2 timesheet entries that overlaps on the same day for the same employee.'))