diff options
| author | Vo Minh Thu <vmt@openerp.com> | 2012-12-14 11:58:20 +0100 |
|---|---|---|
| committer | Vo Minh Thu <vmt@openerp.com> | 2012-12-14 11:58:20 +0100 |
| commit | 3667e3c6190d8a22e358bfd2eac48e0cdca9a8a3 (patch) | |
| tree | cfb04829684675d486dc9fca5b8bbf94211986cc /openerp/modules/loading.py | |
| parent | f668a123d94e3e27ea7c1e7343ab8fafd5ceb69f (diff) | |
[IMP] module loading: removed unnecessary indentation, added comments.
bzr revid: vmt@openerp.com-20121214105820-9nlgzu9pm7cvh1pz
Diffstat (limited to 'openerp/modules/loading.py')
| -rw-r--r-- | openerp/modules/loading.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/openerp/modules/loading.py b/openerp/modules/loading.py index 48f816035ff..b4ad08af7a1 100644 --- a/openerp/modules/loading.py +++ b/openerp/modules/loading.py @@ -146,7 +146,10 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules= cr.execute("select (now() at time zone 'UTC')::timestamp") dt_before_load = cr.fetchone()[0] - pool.fields_by_model = {'whatever': {}} + # Query manual fields for all models at once and save them on the registry + # so the initialization code for each model does not have to do it + # one model at a time. + pool.fields_by_model = {'so_this_dict_is_not_empty': {}} cr.execute('SELECT * FROM ir_model_fields WHERE state=%s', ('manual',)) for field in cr.dictfetchall(): pool.fields_by_model.setdefault(field['model'], []).append(field) @@ -227,6 +230,8 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules= cr.commit() + # The query won't be valid for models created later (i.e. custom model + # created after the registry has been loaded), so empty its result. pool.fields_by_model = {} cr.commit() |
