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

Module: Social Media Base

Entity: social.post.account

Compute Method: _compute_link_click_count

Inputs Method Outputs
  • id
"""Count the clicks Odoo registered on the links of the publication.

        Never stored: nothing is written on the publication, so the figures
        the social media report cannot overwrite it nor race with it.
        """
counts = {
            post_account.id: count
            for post_account, count in self.env["link.tracker.click"]._read_group(
                [("social_post_account_id", "in", self.ids)],
                ["social_post_account_id"],
                ["__count"],
            )
        }
for post_account in self:
            post_account.link_click_count = counts.get(post_account.id, 0)

Back to entity