Community mailing list archives

community@mail.odoo.com

Expected singleton error

by
karim.ajraam
- 06/28/2016 07:43:24
Hello community,


class class_a(models.Model):
_name = 'class.a'
    @api.one
@api.depends('class_a.total_b')
def _get_total(self):
       self.total_a = 0
       for i in self.class_a:
self.total_a += i.total_b
    total_a = fields.Float(compute='_get_total', string="Total", store=True)
    class_a = fields.Many2many('class.b', 'class_a')

class class_b(models.Model):
_name = 'class.b'

@api.multi
@api.depends('class_c.total')
def _get_total(self):
for rec in class_c:
            self.total_b +=  total_c

total_b = fields.Float(compute='_get_total', string="Total", store=True, readonly=True)
class_a = fields.Many2many(
'class.a')
    class_c = fields.Many2many('class.c')

i have a ValueError Expected singleton: class_b(10, 11, 12, 13, 14, 15, 16, 17) error
Please help.