Skip to content

Commit

Permalink
Merge pull request #56 from akretion/16.0-fix-partner-access
Browse files Browse the repository at this point in the history
project_api_client: create/update partner using sudo, as specific pro…
  • Loading branch information
sebastienbeau authored Jul 3, 2024
2 parents 3f893e8 + e296753 commit a1c0eb3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions project_api_client/models/partner.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _get_support_partner(self, data):
"""This method will return the local partner used for the support
If the partner is missing it will be created
If the partner information are obsolete their will be updated"""
partner = self.env["res.partner"].with_context(active_test=False).search(
partner = self.env["res.partner"].sudo().with_context(active_test=False).search(
[("support_uid", "=", str(data["uid"]))]
)
# Compatibility v10-v12
Expand All @@ -50,7 +50,7 @@ def _get_support_partner(self, data):
update_date = fields.Datetime.from_string(update_date)
if not partner:
vals = self._get_support_partner_vals(data)
partner = self.env["res.partner"].create(vals)
partner = self.env["res.partner"].sudo().create(vals)
elif partner.support_last_update_date < update_date:
vals = self._get_support_partner_vals(data)
partner.write(vals)
Expand Down

0 comments on commit a1c0eb3

Please sign in to comment.