[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#77446 X-original-commit: b7effc442cd7ff47e00718adf5b1af43e9f326ee Signed-off-by: Florian Gilbert <FlorianGilbert@users.noreply.github.com>
This commit is contained in:
committed by
Florian(flg)
parent
66b721236c
commit
c3f593db78
@@ -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'},
|
||||
|
||||
Reference in New Issue
Block a user