Skip to content
Snippets Groups Projects
Commit b7effc44 authored by Yenthe Van Ginneken's avatar Yenthe Van Ginneken Committed by root
Browse files

[FIX] account: allow overriding portal domain


Before this commit the only way to modify the domain is to completely override portal_my_invoices.
Since this function is so big this is not clean/easy to do.
By creating a separate function we can simply override it and we can reuse the function on two places.

closes odoo/odoo#77272

Signed-off-by: default avatarFlorian Gilbert <FlorianGilbert@users.noreply.github.com>
parent c2750517
Branches
Tags
No related merge requests found
......@@ -13,9 +13,8 @@ class PortalAccount(CustomerPortal):
def _prepare_home_portal_values(self, counters):
values = super()._prepare_home_portal_values(counters)
if 'invoice_count' in counters:
invoice_count = request.env['account.move'].search_count([
('move_type', 'in', ('out_invoice', 'in_invoice', 'out_refund', 'in_refund', 'out_receipt', 'in_receipt')),
]) if request.env['account.move'].check_access_rights('read', raise_exception=False) else 0
invoice_count = request.env['account.move'].search_count(self._get_invoices_domain()) \
if request.env['account.move'].check_access_rights('read', raise_exception=False) else 0
values['invoice_count'] = invoice_count
return values
......@@ -30,12 +29,15 @@ class PortalAccount(CustomerPortal):
}
return self._get_page_view_values(invoice, access_token, values, 'my_invoices_history', False, **kwargs)
def _get_invoices_domain(self):
return [('move_type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]
@http.route(['/my/invoices', '/my/invoices/page/<int:page>'], type='http', auth="user", website=True)
def portal_my_invoices(self, page=1, date_begin=None, date_end=None, sortby=None, filterby=None, **kw):
values = self._prepare_portal_layout_values()
AccountInvoice = request.env['account.move']
domain = [('move_type', 'in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]
domain = self._get_invoices_domain()
searchbar_sortings = {
'date': {'label': _('Date'), 'order': 'invoice_date desc'},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment