Hello !
Here is an example code :
class myClass(model.Model): _name='myModule.myClass' myClassID=fields.Integer(required=True) att1=fields.Char(compute="_getAttr1AndAttr2", store=True) att2=fields.Char(compute="_getAttr1AndAttr2", store=True) att3=fields.Char(compute="_getAttr3",store=True) @api.one def _getAttr1AndAttr2(self): for location in self: self.att1="value1" self.att2="value2" @api.multi @api.depends('myClassID') def _getAttr3(self): for location in self: location.att3=('Attribute 3'+location.myClassID) |
- Will the compute method _getAttr1AndAttr2(self) be called twice per record or only once at the creation of the record ?
I'm asking myself this because of complexity
Are there any mistakes in my code ? Like with _getAttr1AndAttr2(self) as it is @api.one do I need to set "for location in self" or is it useless ?
Thank You !