Hello, I have Odoo 8.
I have a computed field in a model
pricelist_version = fields.Many2many('product.pricelist.version', 'pagos_vouchers', 'id_voucher', 'id_pago')
fue_usado = fields.Boolean(compute='_cuenta_pagos', store=True)
@api.one
@api.depends('pricelist_version')
def _cuenta_pagos(self):
if(len(self.pricelist_version) > 0):
self.fue_usado = True
else:
self.fue_usado = False
I modify the value of 'pricelist_version' (I can check this because I add a field that shows the pricelist_version asociated with the model in a view) but the _cuenta_pagos method is not triggered and I don't found my mistake. Where is it?
Edit: If I modify the pricelist_version values in the view of the model, the method is triggered. But if I modify this from the pricelist_version view, the method is not triggered.
Edit @Bole:
pricelist_version = fields.Many2many('product.pricelist.version', 'pagos_vouchers', 'id_voucher', 'id_pago')
fue_usado = fields.Boolean(compute='_cuenta_pagos', store='_check_to_recompute')
def _check_to_recompute(self, cr, uid, ids, context=None):
return [ids]
@api.one
@api.depends('pricelist_version')
def _cuenta_pagos(self):
if(len(self.pricelist_version) > 0):
self.fue_usado = True
else:
self.fue_usado = False