[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:
@@ -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. '
|
||||
|
||||
Reference in New Issue
Block a user