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

Module: Discuss

Entity: mail.poll.option

Compute Method: _compute_selected_by_self

View 20.0
Inputs Method Outputs
+ user, guest = self.env["res.users"]._get_current_persona()
+ if not guest and not user:
+             self.selected_by_self = False
+             return
+ domain = Domain("option_id", "in", self.ids)
+ if user:
+             domain &= Domain("user_id", "=", self.env.user.id)
+         else:
+             domain &= Domain("guest_id", "=", guest.id)
+ selected_options = self.env["mail.poll.vote"].search_fetch(domain).option_id
+ for option in self:
+             option.selected_by_self = option in selected_options
  • selected_by_self

Back to entity