From c00a131309f00aaf33abd77f105d5b13c5e60061 Mon Sep 17 00:00:00 2001 From: AZER Date: Sun, 26 Mar 2017 08:32:34 +0100 Subject: [PATCH] [FIX] point_of_sale: add missing sudo Main journal is not accessible for user from different company, a security error is raised during the default get A pos manager could not create a new pos configuration without create rights on ir.sequence (only admin has by default) Closes #16063 --- addons/point_of_sale/models/pos_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/models/pos_config.py b/addons/point_of_sale/models/pos_config.py index 07bd2f84051..8ee15eaeeaa 100644 --- a/addons/point_of_sale/models/pos_config.py +++ b/addons/point_of_sale/models/pos_config.py @@ -31,7 +31,7 @@ class PosConfig(models.Model): def _default_sale_journal(self): journal = self.env.ref('point_of_sale.pos_sale_journal', raise_if_not_found=False) - if journal and journal.company_id == self.env.user.company_id: + if journal and journal.sudo().company_id == self.env.user.company_id: return journal return self._default_invoice_journal() @@ -207,7 +207,7 @@ class PosConfig(models.Model): @api.model def create(self, values): - IrSequence = self.env['ir.sequence'] + IrSequence = self.env['ir.sequence'].sudo() val = { 'name': _('POS Order %s') % values['name'], 'padding': 4,