"""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 = ""
|