many2one function fields are recomputed every time even with store=True
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Odoo Server (MOVED TO GITHUB) |
Confirmed
|
Low
|
OpenERP's Framework R&D |
Bug Description
Hi
I am migrating my customer from v5 to v6
I make some imporvement for is V6 and I have a problem with the function field
I try to create a function fields with the type many2one and the option store=True. The problem is that the field is still read from the function and never from the database. It look like the option store=True is never use in reading.
exemple add this field to sale_shop
def _get_test_id(self, cr, uid, ids, name, args, context=None):
print 'get test'
res={}
for id in ids:
res[id] = 1
return res
'test': fields.
And open the sale shop. You will see that each time the sale_shop is open the field test is read from the function "_get_test_id" and not directly from the database.
I have this bug with the last version of openerp 6.0
I also send a mail to the support team.
Best Regard
Related branches
- Holger Brunn (Therp) (community): Approve
- Olivier Dony (Odoo): Needs Information
-
Diff: 163 lines (+126/-1)6 files modifiedopenerp/osv/fields.py (+17/-1)
openerp/tests/addons/test_function_field/__init__.py (+3/-0)
openerp/tests/addons/test_function_field/__openerp__.py (+14/-0)
openerp/tests/addons/test_function_field/data.xml (+11/-0)
openerp/tests/addons/test_function_field/models.py (+21/-0)
openerp/tests/test_function_field.py (+60/-0)
Changed in openobject-server: | |
assignee: | nobody → OpenERP Publisher's Warranty Team (openerp-opw) |
status: | New → Triaged |
description: | updated |
Changed in openobject-server: | |
importance: | Undecided → Low |
Hello Sébastien,
Thanks for the report.
Investigating it more made us face that there is a contradiction over the behavior of many2one with store=True and call of read().
We found that bug 594504 is a complete opposite to what has been said here.
We prefer to have a discussion with framework experts about the intended behavior in order to justify both the needs whether to call the method or not.
You may share your views here.
Thanks.