Odoo Help

2

0
2 Answers
1
xingtongjie
18.08.13, 02:05

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

/server/openerp/modules/registry.py

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.

3 Comments
xingtongjie
14.12.14, 08:17

the pool is pool of module`s instance

xingtongjie
14.12.14, 08:20

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

xingtongjie
14.12.14, 08:23

Where init module, the pool is passed into module.

0
Avatar

Andreas Maertens

--Andreas Maertens--
1027
| 6 6 9
Finsterwalde, Germany
--Andreas Maertens--

I develop odoo8.0 modules

Andreas Maertens
24.04.13, 08:48

/server/openerp/pooler.py

1 Comment
Andreas Maertens
03.05.13, 11:04

Did you find it there?

Ask a Question
Writer
Tags
Keep Informed
1 follower(s)
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.

Register
Odoo Training Center

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

Test it now