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

Module: Matomo analytics

Entity: website

Compute Method: _compute_matomo_userid

Inputs Method Outputs
  • user_id
"""Gets the unique user ID of the current user. Here we assume that user ID
        is the "login" field of "res.users".
        Override this method if you want to use a different user ID.
        """
for website in self.filtered(
            lambda w: not w.matomo_analytics_host or not w.matomo_enable_userid
        ):
            website.matomo_get_userid = ""
for website in self.filtered(
            lambda w: w.matomo_analytics_host and w.matomo_enable_userid
        ):
            if self.env.user != website.user_id:  # current user is logged in
                website.matomo_get_userid = str(self.env.user.id)
            else:
                website.matomo_get_userid = ""

Back to entity