Permalink
Browse files

[FIX] web: show page number in report

Following 4a3fd02 on the portal when displaying an invoice we may get
a report_type variable (with value 'html' or 'pdf') on the portal.

This was used to not display the page number when checking the report,
but when the report is printed in the backend this report_type was unset
so the page number was mistakenly removed too.

With this changeset, we only show page number when it is used (ie. when
rendering PDF).

opw-1924729
closes #30095
  • Loading branch information...
nle-odoo committed Jan 10, 2019
1 parent ba925fb commit 07822d7eaf09ffd0d7491bd227e664e0049fae95
Showing with 8 additions and 5 deletions.
  1. +8 −5 addons/web/views/report_templates.xml
@@ -113,6 +113,9 @@
var z = x[i].split('=', 2);
vars[z[0]] = unescape(z[1]);
}
var pageNumbers = document.getElementsByClassName('page_number');
for(var j = 0; j<pageNumbers.length; j++)
pageNumbers[j].className = pageNumbers[j].className.replace(/(^|\s)o_hidden($|\s)/, '$1$2');
var fromPage = document.getElementsByClassName('page');
for(var j = 0; j<fromPage.length; j++)
fromPage[j].textContent = vars['sitepage'];
@@ -194,7 +197,7 @@
<li t-if="company.vat" class="list-inline-item"><i class="fa fa-building-o" role="img" aria-label="Fiscal number"/><t t-esc="company.country_id.vat_label or 'Tax ID'"/>: <span t-field="company.vat"/></li>
</ul>
<div t-field="company.report_footer"/>
<div t-if="report_type == 'pdf'" class="text-muted">
<div class="text-muted page_number o_hidden">
Page:
<span class="page"/>
of
@@ -236,7 +239,7 @@
<li t-if="company.vat" class="list-inline-item"><t t-esc="company.country_id.vat_label or 'Tax ID'"/>: <span t-field="company.vat"/></li>
</ul>
<div t-field="company.report_footer"/>
<div t-if="report_type == 'pdf'">
<div class="page_number o_hidden">
Page: <span class="page"/> / <span class="topage"/>
</div>
</div>
@@ -280,8 +283,8 @@
<div class="col-4">
<h4 class="mt0 mb0 text-uppercase" t-field="company.report_header"/>
</div>
<div class="col-1">
<ul t-if="report_type != 'html'" class="list-inline pagenumber float-right text-center">
<div class="col-1 page_number o_hidden">
<ul class="list-inline pagenumber float-right text-center">
<li class="list-inline-item"><strong><span class="page"/></strong></li>
</ul>
</div>
@@ -329,7 +332,7 @@
<span t-field="company.report_footer"/>
</div>

<div t-if="report_type == 'pdf'" class="text-muted">
<div class="text-muted page_number o_hidden">
Page: <span class="page"/> / <span class="topage"/>
</div>
</div>

0 comments on commit 07822d7

Please sign in to comment.