No, stored function fields are not recomputed one at a time.
In 7.0 they are recomputed 40 by 40 [0]. Yes, it may be low but that the default since Feb 2008 [1]. This value has been bump to 1000 in trunk.
One thing that may cause slowness was that, in case of m2o function fields, the name_get() was done id by id. This has been fixed last month in trunk [2]
About, your good example, that's effectively a good example how to NOT do a migration script.
Stored function fields are computed (in batch) in _auto_init(), before init() and also BEFORE migration post- scripts are executed.
Your module is not slow because of this query in init() but because your function field is badly written. You execute a query per id [3] instead of executing a single query with all the ids the ORM give you.
No, stored function fields are not recomputed one at a time.
In 7.0 they are recomputed 40 by 40 [0]. Yes, it may be low but that the default since Feb 2008 [1]. This value has been bump to 1000 in trunk.
One thing that may cause slowness was that, in case of m2o function fields, the name_get() was done id by id. This has been fixed last month in trunk [2]
About, your good example, that's effectively a good example how to NOT do a migration script.
Stored function fields are computed (in batch) in _auto_init(), before init() and also BEFORE migration post- scripts are executed.
Your module is not slow because of this query in init() but because your function field is badly written. You execute a query per id [3] instead of executing a single query with all the ids the ORM give you.
[0] http:// bazaar. launchpad. net/~openerp/ openobject- server/ 7.0/view/ head:/openerp/ osv/orm. py#L82 bazaar. launchpad. net/~openerp/ openobject- server/ trunk/revision/ 702/bin/ osv/orm. py bazaar. launchpad. net/~openerp/ openobject- server/ trunk/revision/ 5185/openerp/ osv/fields. py bazaar. launchpad. net/~account- report- core-editor/ account- financial- report/ 7.0/view/ head:/account_ financial_ report_ webkit/ account_ move_line. py#L58
[1] http://
[2] http://
[3] http://