Community mailing list archives

community@mail.odoo.com

Expected singleton error

by
karim.ajraam
- 06/24/2016 06:57:32
Hello community,

this is my code : 

class class_a(models.Model):
_name = 'class.a'
    @api.multi
@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.One2many('class.b', 'class_a')

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

@api.v8
@api.depends('qte','prixu')
def _get_total(self):
self.total = self.qte * self.prixu

qte = fields.Float('Quantite', required=True)
prixu = fields.Float('Prix U')
total_b = fields.Float(compute='_get_total', string="Total", store=True, readonly=True)
class_a = fields.Many2one('class.a')
i have this error : ValueError Expected singleton: class_b(56, 57, 55)
Please help.