Amy
Amy

Reputation: 70

@api.depends on non-stored field not working

I need to store a computed field so that I can use it in group by in tree view , The problem is once I add store=True the field dosen't update and return 0 even with @api.depends

P.S: amount_total is also a computed field so maybe that's the problem , Please Help me out

Here is my code :

@api.one
@api.depends('amount_total')
def check_negatif_or_positif(self):
    if (self.picking_type_id.name =='Receptions'):
        self.amount_calcul = self.amount_total * (-1) 

    else:
        self.amount_calcul = self.amount_total 

 amount_calcul= fields.Float(compute='check_negatif_or_positif ,string='Amount' ,store=True)

Thanks

Upvotes: 1

Views: 863

Answers (1)

Navi
Navi

Reputation: 1062

To store your computed field, give readonly=False in your field.

Upvotes: 2

Related Questions