Thursday, August 21, 2008

Latest Changes in the Framework

A quick note to list some changes made in the framework in the trunk version:


1. To import big files, you can use the option -P when running the server:
tinyerp-server.py -Pa.pickle -dtrunk -i module
It will commit every 100 lines to not slow down the system when importing very big files. If it crash in a big .CSV or .XML file, you can rerun the query above and it will continue after the crash. Very practical to make tests on big imports and fix problems in your initial data.

2. Properties
Properties are not anymore added automatically in views. You have to inherit forms and add the properties in the form like any other field. The tag in views does no exist anymore. I changed all addons module, but you will probably have to modify your own module in this direction.

3. Nested Trees
For objects with tree structure, you can define _parent_store='M2NFIELD' on the object. It will compute parent_left and parent_right automatically so that you can compute on a whole tree in one SQL query instead of doing very slow recursion algorythms. More infos here:
http://www.intelligententerprise.com/001020/celko.jhtml

Use this to speed up all computations on tree structure. For instance, to compute the recursive debit and recursive credit of the account having a parent_left=3,parent_left=22 and all his childs, you can do that in only one query: select sum(l.debit),sum(l.credit) from account_move_line l left join account_account a on (a.id=l.account_id) where a.parent_left>=3 and a.parent_left<22;

4. Function fields
Sometimes it's interresting to compute several function fields using one call and not one call per field. For instance, for speed improvement, we should be able to compute fields debit,credit and balance at the same time (same SQL query), which was impossible before. Now, we can do that with the multi argument on fields.function. So several functions fields will be computed at once if they share the same multi argument value. Check how debit,credit and balance are computed with only one function in addons/account.py

0 comments: