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

Module: Payment - Account

Entity: payment.transaction

Compute Method: _compute_invoices_count

Inputs Method Outputs
  • id
tx_data = {}
if self.ids:
            self.env.cr.execute(
                '''
                SELECT transaction_id, count(invoice_id)
                FROM account_invoice_transaction_rel
                WHERE transaction_id IN %s
                GROUP BY transaction_id
                ''',
                [tuple(self.ids)]
            )
            tx_data = dict(self.env.cr.fetchall())
for tx in self:
            tx.invoices_count = tx_data.get(tx.id, 0)

Back to entity