Skip to content

[IMP] academic: show total amount due in portal of parents #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions academic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
##############################################################################
from . import models
from . import wizards
from . import controllers
from .hooks import post_init_hook
3 changes: 2 additions & 1 deletion academic/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
##############################################################################
{
'name': 'Academic',
'version': "17.0.1.22.0",
'version': "17.0.1.23.0",
'sequence': 14,
'summary': '',
'author': 'ADHOC SA',
Expand Down Expand Up @@ -65,6 +65,7 @@
'wizards/portal_wizard_views.xml',
'report/ir_actions_report.xml',
'views/res_partner_category.xml',
'views/account_portal_templates.xml',
'report/report_invoice.xml',
],
'demo': [
Expand Down
1 change: 1 addition & 0 deletions academic/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import portal
24 changes: 24 additions & 0 deletions academic/controllers/portal.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
from odoo.addons.account.controllers.portal import PortalAccount
from odoo.http import request
from odoo.osv import expression


class PortalAccount(PortalAccount):
def _prepare_my_invoices_values(self, page, date_begin, date_end, sortby, filterby, domain=None, url="/my/invoices"):
values = super()._prepare_my_invoices_values(page, date_begin, date_end, sortby, filterby, domain, url)
domain = expression.AND([
domain or [],
self._get_invoices_domain(),
])
searchbar_filters = self._get_account_searchbar_filters()
if not filterby:
filterby = 'all'
domain += searchbar_filters[filterby]['domain']
invoices = request.env['account.move'].search(domain)
total_amount_due = sum(
invoices.mapped(lambda x: -x.amount_residual if x.move_type == 'out_refund' else x.amount_residual)
) if invoices else 0.0
values.update({
'total_amount_due': total_amount_due
})
return values
5 changes: 5 additions & 0 deletions academic/i18n/es.po
Original file line number Diff line number Diff line change
Expand Up @@ -1274,3 +1274,8 @@ msgstr ""
#, python-format
msgid "The student must belong to at least one academic group."
msgstr "El estudiante debe pertenecer al menos a un grupo académico."

#. module: academic
#: model_terms:ir.ui.view,arch_db:academic.portal_my_invoices
msgid "<span> <strong>Total amount due: </strong> </span>"
msgstr "<span> <strong>Importe total adeudado: </strong> </span>"
7 changes: 7 additions & 0 deletions academic/views/account_portal_templates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<odoo>
<template id="portal_my_invoices" inherit_id="account.portal_my_invoices" name="My Invoices and Payments">
<xpath expr="//t[@t-if='invoices']" position="before">
<span> <strong>Total amount due: </strong> </span> <span t-out="total_amount_due"/>
</xpath>
</template>
</odoo>