Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I am trying to compute a value for a field and store the value in the DB. If I remove the store=True everything seems fine, but when I add the parameter, isntead of showing the resul from the function I simply get a 0 in all my fields.
Why can this be? Why is adding store=True changing my values to 0?
Any tip will be appreciated,
for record in self:
fats = 0
fats_id = record.name.id
get_detail = self.env['trackfood.foods'].search([['id', '=', fats_id],])
for record2 in get_detail:
fats = record2.fats
self.fats = fats
fats = fields.Float(compute='_compute_fats', string="Fat" , store=True)
I found out that _compute_fats is not even getting triggered when store=True, when I remove it, it works fine, but I need to store the values in the DB for charting porposes.
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 3/15/15, 12:35 AM|
|Seen: 2291 times|
|Last updated: 3/22/15, 12:08 AM|