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

Module: Sale Loyalty

Entity: sale.order

Compute Method: _compute_gift_card_count

Inputs Method Outputs
gift_card_data = dict(
            self.env['loyalty.card']._read_group(
                domain=[
                    ('order_id', 'in', self.ids),
                    ('program_type', '=', 'gift_card'),
                ],
                groupby=['order_id'],
                aggregates=['__count'],
            )
        )
for order in self:
            order.gift_card_count = gift_card_data.get(order, 0)

Back to entity