Odoo Help


This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Total Number of Pages in a Qweb Report

on 7/21/16, 6:21 AM 313 views

I would like to control the Page numbers being displayed in the footer of the report.

Standard Paging concept allows to print the page numbers in this fashion "Page 1 / 1" or "Page 1 / 2" etc.

I have no problem with the above one. However if the total number of Page in the report itself is 1, then I would prefer not to print any page number. In other words I wish to print page number only if the pages are more than One.

So is there any value, that  I could find out total number of pages, I understand that Odoo uses a class called "topage" defined in the <span>, which prints the total number of page number, but am unlikely to extract data from it to utilise for my need.

Shawn Varghese
On 7/23/16, 11:37 AM

You could override report.minimal_layout to introduce a new class which blocks / hides when the total pages are greater than 1.

<template id="report.minimal_layout">

<t t-raw="'&lt;base href=%s&gt;' % base_url"/>

&lt;!DOCTYPE html&gt;

<html style="height: 0;">


<link href="/report/static/src/css/reset.min.css" rel="stylesheet"/>

<link href="/web/static/lib/bootstrap/css/bootstrap.css" rel="stylesheet"/>

<link href="/website/static/src/css/website.css" rel="stylesheet"/>

<link href="/web/static/lib/fontawesome/css/font-awesome.css" rel="stylesheet"/>

<style type='text/css'><t t-raw="css"/></style>

<t t-if="subst is True">


function subst() {

var vars = {};

var x = document.location.search.substring(1).split('&amp;');

for (var i in x) {

var z = x[i].split('=', 2);

vars[z[0]] = unescape(z[1]);


var x=['frompage', 'topage', 'page', 'webpage', 'section', 'subsection', 'subsubsection'];

for (var i in x) {

var y = document.getElementsByClassName(x[i]);

for (var j=0; j&lt;y.length; ++j)

y[j].textContent = vars[x[i]];


var operations = {

'single-page': function (elt)


elt.style.display = (vars.topage >1) ? "block" : "none";



for (var klass in operations)


var y = document.getElementsByClassName(klass);

for (var j=0; j&lt;y.length; ++j)







<body class="container" onload="subst()">

<t t-raw="body"/>




Then, you can override the external_layout_footer as well:

<ul class="list-inline single-page">


<li><span class="page"/></li>


<li><span class="topage"/></li>


Now, since we included the single-page class, that class will only be shown if the topage value is greater than 1.

Let me know if you need more help on this.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

2 follower(s)


Asked: 7/21/16, 6:21 AM
Seen: 313 times
Last updated: 7/23/16, 3:06 PM