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

Module: Fleet History

Entity: fleet.vehicle.assignation.log

Compute Method: _compute_attachment_number

Inputs Method Outputs
  • id
attachment_data = self.env['ir.attachment']._read_group([
            ('res_model', '=', 'fleet.vehicle.assignation.log'),
            ('res_id', 'in', self.ids)], ['res_id'], ['__count'])
attachment = dict(attachment_data)
for doc in self:
            doc.attachment_number = attachment.get(doc.id, 0)

Back to entity