Skip to content

Commit

Permalink
Merge PR #133 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Jul 10, 2024
2 parents b79fdcc + a6a46d5 commit 0078e6f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions resource_booking/models/resource_booking.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ class ResourceBooking(models.Model):
comodel_name="res.partner",
compute="_compute_partner_id",
inverse="_inverse_partner_id",
search="_search_partner_id",
readonly=False,
string="Requester",
)
Expand Down Expand Up @@ -270,6 +271,14 @@ def _inverse_partner_id(self):
for one in self:
one.partner_ids = one.partner_id

@api.model
def _search_partner_id(self, operator, value):
"""Overwrite this for security, partner_id field is not stored and if we search
for it by mistake (or out of ignorance) we will get all the records.
To avoid this behavior, we search for the correct field: partner_ids
"""
return [("partner_ids", operator, value)]

@api.model
def _default_user_id(self):
return self.env.user
Expand Down

0 comments on commit 0078e6f

Please sign in to comment.