[FIX] account: avoid error when internal user (no accounting
permissions) see Invoices & Bills at /my/account Issue: Internal user cannot see their Invoices & Bills at portal without permissions in the accounting Fix: Verify that the read operation is allowed for the current user closes odoo/odoo#139141 X-original-commit: 5ebab949a06ec338cc28e912317a74bbfb3fe6ac Signed-off-by: William André (wan) <wan@odoo.com>
This commit is contained in:
@@ -93,12 +93,16 @@ class PortalAccount(CustomerPortal):
|
||||
'date': date_begin,
|
||||
# content according to pager and archive selected
|
||||
# lambda function to get the invoices recordset when the pager will be defined in the main method of a route
|
||||
'invoices': lambda pager_offset: AccountInvoice.search(domain, order=order, limit=self._items_per_page, offset=pager_offset),
|
||||
'invoices': lambda pager_offset: (
|
||||
AccountInvoice.search(domain, order=order, limit=self._items_per_page, offset=pager_offset)
|
||||
if AccountInvoice.check_access_rights('read', raise_exception=False) else
|
||||
AccountInvoice
|
||||
),
|
||||
'page_name': 'invoice',
|
||||
'pager': { # vals to define the pager.
|
||||
"url": url,
|
||||
"url_args": {'date_begin': date_begin, 'date_end': date_end, 'sortby': sortby},
|
||||
"total": AccountInvoice.search_count(domain),
|
||||
"total": AccountInvoice.search_count(domain) if AccountInvoice.check_access_rights('read', raise_exception=False) else 0,
|
||||
"page": page,
|
||||
"step": self._items_per_page,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user