[FIX] point_of_sale: allow deletion of contact to any user

Before this fix, if the user has no PoS access rights, he cannot delete a contact
due to a check done on open PoS sessions.

closes odoo/odoo#45868

X-original-commit: f7b83cfc41045e1cc81d2e1c5540ac105f333a61
Signed-off-by: Alex Tuyls <alt-odoo@users.noreply.github.com>
This commit is contained in:
alt-odoo
2020-02-20 17:40:10 +00:00
parent 49c46b0bb4
commit 54e1a69b09
+1 -1
View File
@@ -40,7 +40,7 @@ class ResPartner(models.Model):
return partner_id
def unlink(self):
running_sessions = self.env['pos.session'].search([('state', '!=', 'closed')])
running_sessions = self.env['pos.session'].sudo().search([('state', '!=', 'closed')])
if running_sessions:
raise UserError(
_("You cannot delete contacts while there are active PoS sessions. Close the session(s) %s first.")