Skip to content
Snippets Groups Projects
Commit 0993e279 authored by alt-odoo's avatar alt-odoo
Browse files

[FIX] iap: allow regular users to delete accounts without token

Small fixup of recent commit [1].

A regular user do not have delete right on iap.account model, hence
creating an access right error. We should allow him to delete accounts
without token so they will be re-created afterwards.

[1]:https://github.com/odoo/odoo/commit/974caef934b7a116b7375f05e047aea15ea960aa



closes odoo/odoo#99817

Signed-off-by: default avatarFlorian Daloze (fda) <fda@odoo.com>
parent 84246eea
No related branches found
No related tags found
No related merge requests found
......@@ -180,7 +180,8 @@ class IapAccount(models.Model):
# Flush the pending operations to avoid a deadlock.
self.flush()
IapAccount = self.with_env(self.env(cr=cr))
IapAccount.search(domain + [('account_token', '=', False)]).unlink()
# Need to use sudo because regular users do not have delete right
IapAccount.search(domain + [('account_token', '=', False)]).sudo().unlink()
accounts = accounts - accounts_without_token
if not accounts:
with self.pool.cursor() as cr:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment