Skip to Content
Menú
This question has been flagged
2081 Vistes
  1. Hello, i got a model (book) where i can add books and assign authors to them (res.partner) in many2many: authors = fields.Many2many('res.partner', string='Authors')
    
    I then made another model which inherits from res partner to add a boolean 'isAuthor', that way i can filter them in a graph.
    
    
    
    Now i want to add a computed field that counts how many books an author has.
    
    I made this:
    
    nbBooks = fields.Integer('Number of authored books', compute='nombre_livre_auteur', store=True)
    
    #@api.depends("author") 


Avatar
Descartar
Related Posts Respostes Vistes Activitat
1
de juny 25
15531
3
d’abr. 25
5759
2
de jul. 24
3630
1
de gen. 24
1894
1
de jul. 22
2328