Odoo Help


Where is pool.get() defined in OpenERP source?

on 4/24/13, 3:55 AM 6,993 views

By looking at addons, that come with OpenERP source, one can tell that


is frequently used in model methods.

Where is this "pool" and "get()" defined in OpenERP source code? I would like to look at it's documentation (docstrings).

On 8/18/13, 2:05 AM

In /server/openerp/osv/orm.py

class BaseModel(object):

def __init__(self, pool, cr):

    """ Initialize a model and make it part of the given registry.

    - copy the stored fields' functions in the osv_pool,
    - update the _columns with the fields found in ir_model_fields,
    - ensure there is a many2one for each _inherits'd parent,
    - update the children's _columns,
    - give a chance to each field to initialize itself.

    pool.add(self._name, self)
    self.pool = pool

pool is registry

in /server/openerp/pooler.py

def get_db_and_pool(db_name, force_demo=False, status=None, update_module=False):

"""Create and return a database connection and a newly initialized registry."""

 registry = RegistryManager.get(db_name, force_demo, status, update_module)

return registry.db, registry


class Registry(object): """ Model registry for a particular database.

The registry is essentially a mapping between model names and model
instances. There is one registry instance per database.


def __init__(self, db_name):
    self.models = {}    # model name/model instance mapping

def get(self, model_name):

    """ Return a model for a given name or None if it doesn't exist."""

    return self.models.get(model_name)

I understand pool today, above i find pool 's source code.

the pool is pool of module`s instance

on 12/14/14, 8:17 AM

Has nothing to do with db cursor, every model has its cr. realize 'read(),write() etc 'fuction operation.

on 12/14/14, 8:20 AM

Where init module, the pool is passed into module.

on 12/14/14, 8:23 AM

Andreas Maertens

--Andreas Maertens--
| 6 6 7
Finsterwalde, Germany
--Andreas Maertens--

I develop odoo8.0 modules

Andreas Maertens
On 4/24/13, 8:48 AM


Did you find it there?

Andreas Maertens
on 5/3/13, 11:04 AM

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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 4/24/13, 3:55 AM
Seen: 6993 times
Last updated: 2/13/17, 5:56 PM