[FIX] point_of_sale: pos User can't close a session
Starting this commit: 8f57863707
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 <pimodoo@users.noreply.github.com>
Signed-off-by: Joseph Caburnay (jcb) <caburj@users.noreply.github.com>
This commit is contained in:
@@ -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'),
|
||||
|
||||
Reference in New Issue
Block a user