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

Module: PMS - Sale

Entity: pms.reservation

Compute Method: _compute_invoice_count

Inputs Method Outputs
  • id
for reservation in self:
            invoices = (
                self.env["account.move.line"]
                .search([("pms_reservation_id", "=", reservation.id)])
                .mapped("move_id")
                .filtered(lambda r: r.move_type in ("out_invoice", "out_refund"))
            )
            reservation.invoice_count = len(invoices)

Back to entity