From 67873a573afdb978c440437e5ce80dacce711f28 Mon Sep 17 00:00:00 2001 From: duongnguyen Date: Thu, 14 Sep 2023 15:05:29 +0700 Subject: [PATCH] [FIX] project_purchase: Project Admin can't access project update when having PO Step to reproduct: -User A with Admin Project Access Right and no Pucharse Acesss Right -PO and Project have same analytic_account_id, with PO analytic_account will place in 'analytic_distribution' -User A then go to Project Update -> Access Error happen => Expected behaviour is to let Project Admin access it Solutions is to let he/she see it by adding sudo() only closes odoo/odoo#136045 X-original-commit: 249aaac7bd1a13d62c947cddb1835772659aabff Signed-off-by: Audric Onockx (auon) --- addons/project_purchase/models/project_project.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project_purchase/models/project_project.py b/addons/project_purchase/models/project_project.py index 0eb3004b80c..c2b6d490628 100644 --- a/addons/project_purchase/models/project_project.py +++ b/addons/project_purchase/models/project_project.py @@ -134,7 +134,7 @@ class Project(models.Model): self._cr.execute(query_string, query_param) purchase_order_line_read = [{ **pol, - 'invoice_lines': self.env['purchase.order.line'].browse(pol['id']).invoice_lines, # One2Many cannot be queried, they are not columns + 'invoice_lines': self.env['purchase.order.line'].browse(pol['id']).sudo().invoice_lines, # One2Many cannot be queried, they are not columns } for pol in self._cr.dictfetchall()] purchase_order_line_invoice_line_ids = self._get_already_included_profitability_invoice_line_ids() with_action = with_action and self.user_has_groups('purchase.group_purchase_user, account.group_account_invoice, account.group_account_readonly')