[FIX] web: show page number in report
Following 4a3fd02af4 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, the report alway know if he is pdf, html or text
and only print the page number if it is of type pdf.
opw-1924729
closes #30095
This commit is contained in:
@@ -281,7 +281,7 @@
|
||||
<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">
|
||||
<ul t-if="report_type == 'pdf'" class="list-inline pagenumber float-right text-center">
|
||||
<li class="list-inline-item"><strong><span class="page"/></strong></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -606,6 +606,7 @@ class IrActionsReport(models.Model):
|
||||
def render_qweb_pdf(self, res_ids=None, data=None):
|
||||
if not data:
|
||||
data = {}
|
||||
data.setdefault('report_type', 'pdf')
|
||||
|
||||
# remove editor feature in pdf generation
|
||||
data.update(enable_editor=False)
|
||||
@@ -700,6 +701,9 @@ class IrActionsReport(models.Model):
|
||||
|
||||
@api.model
|
||||
def render_qweb_text(self, docids, data=None):
|
||||
if not data:
|
||||
data = {}
|
||||
data.setdefault('report_type', 'text')
|
||||
data = self._get_rendering_context(docids, data)
|
||||
return self.render_template(self.report_name, data), 'text'
|
||||
|
||||
@@ -707,6 +711,9 @@ class IrActionsReport(models.Model):
|
||||
def render_qweb_html(self, docids, data=None):
|
||||
"""This method generates and returns html version of a report.
|
||||
"""
|
||||
if not data:
|
||||
data = {}
|
||||
data.setdefault('report_type', 'html')
|
||||
data = self._get_rendering_context(docids, data)
|
||||
return self.render_template(self.report_name, data), 'html'
|
||||
|
||||
|
||||
Reference in New Issue
Block a user