Updated project hours vali

This commit is contained in:
projectsodoo 2021-01-19 12:38:25 +05:30
parent 4f2601e9fb
commit 1ebcea9b16
1 changed files with 6 additions and 6 deletions

View File

@ -33,7 +33,7 @@ class ProjectConsultantHrs(models.Model):
def _check_percent(self):
for val in self:
if val.employee_id and val.percentage:
rec = self.search([('employee_id','=',val.employee_id.id),('project_id','=',val.project_id.id)])
rec = val.search([('employee_id','=',val.employee_id.id),('project_id','=',val.project_id.id)])
per = [r.percentage for r in rec]
if sum(per) > 100:
raise ValidationError(_('Consultant total percentage should not be greater than 100'))
@ -44,13 +44,13 @@ class ProjectConsultantHrs(models.Model):
def _check_date(self):
for val in self:
#if 'project_id' in self.env.context:
if not self.project_id.date_start or not self.project_id.date:
if not val.project_id.date_start or not val.project_id.date:
raise UserError(_('Project start date and end date should not be blank'))
if self.project_id.date_start and self.start_date:
if not (self.project_id.date_start <= self.start_date <= self.project_id.date):
if val.project_id.date_start and val.start_date:
if not (val.project_id.date_start <= val.start_date <= val.project_id.date):
raise ValidationError("Start date should be between project start date and End Date")
if self.end_date:
if not (self.project_id.date_start <= self.end_date <= self.project_id.date):
if val.end_date:
if not (val.project_id.date_start <= val.end_date <= val.project_id.date):
raise ValidationError("End date should be between project start date and End Date")
domain = [
('start_date', '<=', val.end_date),