Hello ,
I working on payroll constraint that If the net salary less than zero,get all the employees that meet that condition in list.
here's is my code:
@api.constrains("salary_rule_id", 'amount')
def hide_some_loans(self):
for rec in self:
if rec.salary_rule_id.name == "Net Salary" and rec.amount < 0 and rec.employee_id.name:
neg=[]
neg.append(rec.employee_id.name)
print(neg)
raise ValidationError(_("Please Forward the Dedication for %s to the Next Months.") %(neg))
The Problem is I get only the first employee.