Skip to content Skip to sidebar Skip to footer

ValueError: Expected Singleton: - Odoo V8

I have this method, which should loop on a One2many object, but the actual loop isn't working, I mean, if I add just one line it works fine, but if I add more than one line, than i

Solution 1:

In your case, it's found more then one record set in order_lines and you tried to get isbn value from it.

Try with following code:

@api.multi
@api.depends('order_lines', 'order_lines.isbn')
def checkit(self):
    for record in self:
        if record.order_lines:
            for line in record.order_lines:
                if line.isbn:  
                    return line.isbn
        else:
            raise Warning(('Enter​ ​at least​ ​1​ ​ISBN to produce'))

For details of these error. You may refer my blog.


Post a Comment for "ValueError: Expected Singleton: - Odoo V8"