Skip to Content
Menu
This question has been flagged
3 Replies
3679 Views

I want to add non-DB computed One2many field.
If I define it like


field = fields.One2many('model', 'inverse_field', compute='compute')

def compute(self):
    for record in self:
        record.field = self.env['model'].new()

I don't see computed values

Avatar
Discard

Hope this tips will help you in future: https://github.com/sehrishnaz/learnopenerp/wiki

Author Best Answer

Did you read question? I want to populate One2many field dynamically.

Avatar
Discard
Best Answer

Hi,

You can add a print statement/logger message inside the compute function and see whether the function is get called or not. Also have a look at this video: How to Write Compute Field and its Function in Odoo12

Thanks

Avatar
Discard