Skip to content Skip to sidebar Skip to footer

Odoo 11 Valueerror: Expected Singleton: %s" % Record

I am creating a custom module where I want to get all the selected employee in the Payroll and send them a default email. For that I am doing this To show the action button

Solution 1:

Try the below code snippet,

 template.with_context(lang=lang).send_mail(
            payslip.employee_id.user_id.id, force_send=True, raise_exception=True
        ) 

Solution 2:

Try to loop the 'payslip' also , like below

for payslip in self:
    for slip in payslip:
         try:
           lang = payslip.employee_id.user_id.lang
           template.with_context(lang=lang).send_mail(
               self.env.user.id, force_send=True, raise_exception=True
           )
           selected_employess.append(slip.name)
         except Exception as e:
           not_selected_employees.append(slip.name)

Post a Comment for "Odoo 11 Valueerror: Expected Singleton: %s" % Record"