commit constrain
This commit is contained in:
parent
a2506c99c4
commit
8c30a885c9
|
|
@ -341,26 +341,26 @@ class FamilyMemberProfile(models.Model):
|
||||||
"Death Certificate is required for member '%s' when marked as deceased."
|
"Death Certificate is required for member '%s' when marked as deceased."
|
||||||
) % rec.name)
|
) % rec.name)
|
||||||
|
|
||||||
@api.constrains('is_work', 'age', 'member_income', 'salary_certificate')
|
# @api.constrains('is_work', 'age', 'member_income', 'salary_certificate')
|
||||||
def _check_salary_certificate_required(self):
|
# def _check_salary_certificate_required(self):
|
||||||
for rec in self:
|
# for rec in self:
|
||||||
if rec.age >= 18 and rec.is_work:
|
# if rec.age >= 18 and rec.is_work:
|
||||||
if rec.member_income <= 0:
|
# if rec.member_income <= 0:
|
||||||
raise ValidationError(_(
|
# raise ValidationError(_(
|
||||||
"Income must be greater than 0 for member '%s' when working and age is greater than or equal to 18."
|
# "Income must be greater than 0 for member '%s' when working and age is greater than or equal to 18."
|
||||||
) % rec.name)
|
# ) % rec.name)
|
||||||
if not rec.salary_certificate:
|
# if not rec.salary_certificate:
|
||||||
raise ValidationError(_(
|
# raise ValidationError(_(
|
||||||
"Salary Certificate is required for member '%s' when working and age is greater than or equal to 18."
|
# "Salary Certificate is required for member '%s' when working and age is greater than or equal to 18."
|
||||||
) % rec.name)
|
# ) % rec.name)
|
||||||
|
#
|
||||||
@api.constrains('is_mother', 'is_married', 'marriage_certificate')
|
# @api.constrains('is_mother', 'is_married', 'marriage_certificate')
|
||||||
def _check_marriage_certificate_required(self):
|
# def _check_marriage_certificate_required(self):
|
||||||
for rec in self:
|
# for rec in self:
|
||||||
if not rec.is_mother and rec.is_married and not rec.marriage_certificate:
|
# if not rec.is_mother and rec.is_married and not rec.marriage_certificate:
|
||||||
raise ValidationError(_(
|
# raise ValidationError(_(
|
||||||
"Marriage Certificate is required for member '%s' when marked as married and not a mother."
|
# "Marriage Certificate is required for member '%s' when marked as married and not a mother."
|
||||||
) % rec.name)
|
# ) % rec.name)
|
||||||
|
|
||||||
@api.constrains('member_first_name')
|
@api.constrains('member_first_name')
|
||||||
def _check_names_alphabetic(self):
|
def _check_names_alphabetic(self):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue