ValueError: : "Expected singleton: hr.salary.details(1, 2)" while evaluating 'for record in records:\n record.calculate_salary()'
my server action xml code:
< field name = "name" > calculate salary field >
list field>
code field>
for record in records:
record.calculate_salary()
field >
records >
my function:
def calculate_salary(self):
for rec in self:
salary = []
get_date = datetime. today ( )
month = int(get_date.month ) -1_
salary . append({ 'name': ('salary for') + " " + str(rec.employee1_name_id['name'])+ " " + str(month ),
'employee1_name': rec. employee1_name_id [ 'name' ],
'salary_id': rec.id ,
'employee_number': rec. employee_number_id ,
'employee_job_title': rec. employee_job_title ,
'employee_salary': rec . employee_salary ,
'hawafez_salary': rec. hawafez_salary ,
'cooperation_box': rec . cooperation_box ,
':rec. total_salary ,
})
rec. env [ 'hr.salary.months' ].create( salary )