Skip to content
Snippets Groups Projects
Commit 15a896f4 authored by Pierre Masereel's avatar Pierre Masereel
Browse files

[FIX] sale_coupon: access to fields on coupon from POS


When a pos launched by a user having no access rights on sales order
lines is launched. It cannot have access to the coupon program because
it tries to get the computed field order_count that needs to read the
sale order lines.

closes odoo/odoo#84544

Task-id: 2742528
Signed-off-by: default avatarMasereel Pierre <pim@odoo.com>
parent 2faefd5d
Branches
Tags
No related merge requests found
......@@ -12,7 +12,7 @@ class CouponProgram(models.Model):
# The api.depends is handled in `def modified` of `sale_coupon/models/sale_order.py`
def _compute_order_count(self):
for program in self:
program.order_count = self.env['sale.order.line'].search_count([('product_id', '=', program.discount_line_product_id.id)])
program.order_count = self.env['sale.order.line'].sudo().search_count([('product_id', '=', program.discount_line_product_id.id)])
def action_view_sales_orders(self):
self.ensure_one()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment