summaryrefslogtreecommitdiff
path: root/addons/iap/models/iap.py
diff options
context:
space:
mode:
authorRémi Rahir <rar@odoo.com>2018-09-25 13:06:29 +0000
committerRémi Rahir <rar@odoo.com>2018-09-25 16:11:26 +0000
commit2bf1af77fbb232c2e09059ea68a4b62fb7b582bd (patch)
treeb2048f2f4d0c382eabf7082f6e9bb1ff57588059 /addons/iap/models/iap.py
parent6ce408c824cb542ef52b516a41e697a206d39aa9 (diff)
[FIX] iap: fixing get() for non-amin users
closes odoo/odoo#27219
Diffstat (limited to 'addons/iap/models/iap.py')
-rw-r--r--addons/iap/models/iap.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/iap/models/iap.py b/addons/iap/models/iap.py
index 6f24205f8d4..2f7053b7c74 100644
--- a/addons/iap/models/iap.py
+++ b/addons/iap/models/iap.py
@@ -146,7 +146,8 @@ class IapAccount(models.Model):
def get(self, service_name):
account = self.search([('service_name', '=', service_name), ('company_id', 'in', [self.env.user.company_id.id, False])])
if not account:
- account = self.create({'service_name': service_name})
+ # TODO: remove this sudo in v12 as we change the user rights.
+ account = self.sudo().create({'service_name': service_name}).with_env(self.env)
# Since the account did not exist yet, we will encounter a NoCreditError,
# which is going to rollback the database and undo the account creation,
# preventing the process to continue any further.