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'm trying to create a graph bar view : My problem is that when I use a fields.function to calculate datas, the values are not right and it seems that the fields.function is not called! But when I use a simple fields.integer, it works fine.
To be sure that my fields.function is correctly defined and the calculation is good, I added it to the form view and it works fine.
Lastly, if I add store=True to the fields.function, it works, but I don't want to store the calculated data in the DataBase.
Thanks for your help.
Well, you had the right idea by storing the value. Unfortunately, right now, it is the only solution.
The way the graph view gets its data is by calling the read_group method in the ORM. That method will collect the data from the database. This means that the aggregation (sum) is done by postgres (and is very fast) instead of being done by the python code (not so fast).
So, right now, the design of the graph view makes it impossible to aggregate functional fields if they are not stored. A possible solution is to add a controller to the graph view. That controller could call read_group itself, then, perform additional requests to the database to aggregate manually on all non stored functional fields. It would probably be much slower, but the additional functionality might be worth it.
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: 6/3/14, 6:27 AM|
|Seen: 2050 times|
|Last updated: 3/16/15, 8:10 AM|