[FIX] point_of_sale: account.tax write permission.

When a user try to import (to edit) some account.tax, some verification are done on pos.order.line.
The search is done in sudo but the read is executed with the current logged user.
So pos.order.line from others companies are check with a user who don't have access to these companies.
And the AccessError exception is triggered.
This PR aims to fix the permission issue by adding a sudo() for the read on pos.order.line

closes odoo/odoo#149288

X-original-commit: 1c22f6bd36ffcade3d84d0f76bbb3b9d1dc8c4c1
Signed-off-by: Joseph Caburnay (jcb) <jcb@odoo.com>
This commit is contained in:
François Honoré
2024-01-15 14:48:40 +00:00
parent 03d7ce049a
commit 8f7985a6e8
+1 -1
View File
@@ -18,7 +18,7 @@ class AccountTax(models.Model):
('order_id.session_id.state', '!=', 'closed')
])
self_ids = set(self.ids)
for lines_chunk in map(self.env['pos.order.line'].browse, split_every(100000, lines.ids)):
for lines_chunk in map(self.env['pos.order.line'].sudo().browse, split_every(100000, lines.ids)):
if any(tid in self_ids for ts in lines_chunk.read(['tax_ids']) for tid in ts['tax_ids']):
raise UserError(_(
'It is forbidden to modify a tax used in a POS order not posted. '