Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Base

Entity: ir.model

Compute Method: _compute_count

Inputs Method Outputs
cr = self.env.cr
self.count = 0
for model in self:
            records = self.env[model.model]
            if not records._abstract and records._auto:
                cr.execute(sql.SQL('SELECT COUNT(*) FROM {}').format(sql.Identifier(records._table)))
                model.count = cr.fetchone()[0]

Back to entity