From ae83889da47a05b0c190a04c0fef42ee8fa55181 Mon Sep 17 00:00:00 2001 From: Joseph Caburnay Date: Fri, 9 Oct 2020 08:05:50 +0000 Subject: [PATCH] [FIX] point_of_sale: pos User can't close a session Starting this commit: 8f578637076d4b65de222aa092ce738391ce5260 regular pos User now don't have a read access to ir.property model. Because of this, if a user opens a session, he won't be able to close it. We sudo the search to stock.move (because the query parameters requires reading from ir.property) to make sure that closing a session will succeed. closes odoo/odoo#59712 X-original-commit: 5e2763fdc94b63eee637f9679f8ea3a07beb74ce Related: odoo/enterprise#13981 Signed-off-by: pimodoo Signed-off-by: Joseph Caburnay (jcb) --- addons/point_of_sale/models/pos_session.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/models/pos_session.py b/addons/point_of_sale/models/pos_session.py index 1cfe6fbf963..e4fb8181468 100644 --- a/addons/point_of_sale/models/pos_session.py +++ b/addons/point_of_sale/models/pos_session.py @@ -460,7 +460,7 @@ class PosSession(models.Model): if self.company_id.anglo_saxon_accounting and order.picking_ids.ids: # Combine stock lines - stock_moves = self.env['stock.move'].search([ + stock_moves = self.env['stock.move'].sudo().search([ ('picking_id', 'in', order.picking_ids.ids), ('company_id.anglo_saxon_accounting', '=', True), ('product_id.categ_id.property_valuation', '=', 'real_time') @@ -485,7 +485,7 @@ class PosSession(models.Model): if self.company_id.anglo_saxon_accounting: global_session_pickings = self.picking_ids.filtered(lambda p: not p.pos_order_id) if global_session_pickings: - stock_moves = self.env['stock.move'].search([ + stock_moves = self.env['stock.move'].sudo().search([ ('picking_id', 'in', global_session_pickings.ids), ('company_id.anglo_saxon_accounting', '=', True), ('product_id.categ_id.property_valuation', '=', 'real_time'),