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

Module: Marketing Card

Entity: card.campaign

Compute Method: _compute_card_stats

View 19.0
Inputs Method Outputs
+ cards_by_status_count = self.env['card.card']._read_group(
+             domain=[('campaign_id', 'in', self.ids)],
+             groupby=['campaign_id', 'share_status'],
+             aggregates=['__count'],
+             order='campaign_id ASC',
+         )
+ self.update({
+             'card_count': 0,
+             'card_click_count': 0,
+             'card_share_count': 0,
+         })
+ for campaign, status, card_count in cards_by_status_count:
+             # shared cards are implicitly visited
+             if status == 'shared':
+                 campaign.card_share_count += card_count
+             if status in ('shared', 'visited'):
+                 campaign.card_click_count += card_count
+             campaign.card_count += card_count
  • card_share_count
  • card_click_count
  • card_count

Back to entity