Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo course community database gettingstarted
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo course community database gettingstarted
About this forum
  1. Getting Started
  2. Forum

Sub Total Per page

Subscribe

Get notified when there's activity on this post

This question has been flagged
5 Replies
3395 Views
Avatar
SOUJIRO30

How can I get the  subtotal per page of the records.?

I need your help. Thank you!

0
Avatar
Discard
Deepa Venkatesh

Could you plz elaborate your query

SOUJIRO30
Author

here is my code

<?xml version="1.0" encoding="UTF-8" ?>

<odoo>

<data>

<!--Loan Summary Template-->

<template id="report_loan_summary_template">

<t t-call="report.html_container">

<!--<t t-call="report.external_layout"/>-->

<t t-foreach="docs" t-as="o">

<div class="page">

<!--<br/><br/><br/><br/>-->

<t t-set="company_ids" t-value="[]"/>

<t t-foreach="records.sorted(key=lambda r: r.employee_id.company_id.name)" t-as="recs">

<t t-set="company_ids" t-value="company_ids+[recs.employee_id.company_id]"/>

</t>

<t t-foreach="o.get_sorted(list(set(company_ids)))" t-as="company">

<div style="page-break-before:always;">

<t t-if="o.columns_of_two">

<t t-set="end" t-value="[1,2]"/>

</t>

<t t-if="not o.columns_of_two">

<t t-set="end" t-value="[1]"/>

</t>

<t t-foreach="end" t-as="e">

<div class="col-xs-6">

<!--<div class="text-center">-->

<!--<span style="font-weight:bold;font-family:Liberation Sans;font-size:16px;"><span class="text-uppercase" t-field="o.loan_type_id.name"/> SUMMARY<br/></span>-->

<!--&lt;!&ndash;<span style="font-weight:bold;font-family:Liberation Sans;font-size:16px;">LOAN SUMMARY LIST<br/></span>&ndash;&gt;-->

<!--<span style="font-weight:bold;font-family:Liberation Sans;font-size:10px;">FOR THE MONTH OF <span class="text-uppercase" t-esc="time.strftime('%B', time.strptime(o.from_date,'%Y-%m-%d'))"/><br/></span>-->

<!--&lt;!&ndash;<span><span t-esc="time.strftime('%B %d, %Y', time.strptime(o.from_date,'%Y-%m-%d'))"/> - <span t-esc="time.strftime('%B %d, %Y', time.strptime(o.to_date,'%Y-%m-%d'))"/></span>&ndash;&gt;-->

<!--</div><br/>-->

<!--<span style="font-weight:bold;font-family:Liberation Sans;font-size:12px;text-align:center;">Date: <span t-esc="context_timestamp(datetime.datetime.now()).strftime('%B %d, %Y %I:%M:%S %p')"/></span><br/>-->

<!--<t t-set="loan_type_ids" t-value="[]"/>-->

<!--<t t-foreach="records.sorted(key=lambda r: r.loan_type.name)" t-as="recs">-->

<!--<t t-set="loan_type_ids" t-value="loan_type_ids+[recs.loan_type]"/>-->

<!--</t>-->

<!--<t t-foreach="o.get_sorted(list(set(loan_type_ids)))" t-as="loan">-->

<!--<span style="font-weight:bold;font-family:Liberation Sans;font-size:14px;" class="text-uppercase"><span t-esc="loan.name"/></span><br/>-->

<table style="width:100%;text-align:center;font-family:Liberation Sans;border-collapse: collapse;">

<thead>

<tr>

<th colspan="5" style="width:100%;padding:8px;text-align:center;vertical-align:center;">

<div class="text-center">

<span style=";font-family:Liberation Sans;font-size:16px;" class="text-uppercase" t-esc="company.name"/><br/>

<span style="font-weight:bold;font-family:Liberation Sans;font-size:16px;"><span class="text-uppercase" t-field="o.loan_type_id.name"/> SUMMARY<br/></span>

<span style="font-weight:bold;font-family:Liberation Sans;font-size:10px;">FOR THE MONTH OF <span class="text-uppercase" t-esc="time.strftime('%B, %Y', time.strptime(o.from_date,'%Y-%m-%d'))"/><br/></span>

</div>

</th>

</tr>

<tr style="font-size:12;font-weight:bold;background-color:#d6d8db;text-align:center;border: 1px solid #000000;">

<th style="width:5%;padding:8px;text-align:center;vertical-align:center;border: 1px solid #000000;">ID NO.</th>

<th style="width:30%;padding:8px;text-align:center;vertical-align:center;border: 1px solid #000000;">EMPLOYEE'S NAME</th>

<th style="width:5%;padding:8px;text-align:center;vertical-align:center;border: 1px solid #000000;">15TH</th>

<th style="width:5%;padding:8px;text-align:center;vertical-align:center;border: 1px solid #000000;"><span t-esc="o.get_last_day_month(o.to_date)"/> </th>

<th style="width:5%;padding:8px;text-align:center;vertical-align:center;border: 1px solid #000000;">TOTAL</th>

</tr>

</thead>

<!--<t t-foreach="records.sorted(key=lambda r: r.employee_id.name)" t-as="rec">-->

<t t-set="employee_ids" t-value="[]"/>

<t t-foreach="records.sorted(key=lambda r: r.loan_id.employee_id)" t-as="recs">

<t t-if="recs.loan_id.employee_id.company_id.id == company.id">

<t t-set="employee_ids" t-value="employee_ids+[recs.loan_id.employee_id]"/>

</t>

</t>

<t t-foreach="o.get_sorted(list(set(employee_ids)))" t-as="employee">

<tbody>

<tr style="font-size:12px;">

<t t-set="loan_1" t-value="0"/>

<t t-set="loan_2" t-value="0"/>

<td style="width:5%;padding:8px;text-align:left;vertical-align:center;">

<span class="text-uppercase"><span t-esc="employee.identification_id"/></span>

</td>

<td style="width:30%;padding:8px;text-align:left;vertical-align:center;">

<span t-esc="employee.name"/>

</td>

<td style="width:5%;padding:8px;text-align:center;vertical-align:center;">

<t t-set="loan_1" t-value="0"/>

<t t-set="loan_1" t-value="sum([rec.paid_amount for rec in records if rec.loan_id.employee_id.id == employee.id and rec.loan_type_id.id == o.loan_type_id.id and rec.payroll_id.payslip_run_id.hr_period_id.vale_period == 1])"/>

<t t-esc="'{0:,.2f}'.format((loan_1))"/>

</td>

<td style="width:5%;padding:8px;text-align:center;vertical-align:center;">

<t t-set="loan_2" t-value="0"/>

<t t-set="loan_2" t-value="sum([rec.paid_amount for rec in records if rec.loan_id.employee_id.id == employee.id and rec.loan_type_id.id == o.loan_type_id.id and rec.payroll_id.payslip_run_id.hr_period_id.vale_period == 2])"/>

<t t-esc="'{0:,.2f}'.format((loan_2))"/>

</td>

<td style="width:5%;padding:8px;text-align:right;vertical-align:center;">

<span t-esc="'{0:,.2f}'.format(loan_2 + loan_1)"/>

</td>

</tr>

</tbody>

</t>

<tr>

<t t-set="total_loan_1" t-value="0"/>

<t t-set="total_loan_2" t-value="0"/>

<td style="vertical-align:center;text-align:center;padding:5px;border: 1px solid #000000;" colspan="2">

<strong><span>GRAND TOTAL</span></strong>

</td>

<td style="vertical-align:center;text-align:right;padding:5px;font-weight:bold;border: 1px solid #000000;">

<t t-set="total_loan_1" t-value="0"/>

<t t-set="total_loan_1" t-value="sum([rec.paid_amount for rec in records if rec.loan_type_id.id == o.loan_type_id.id and rec.payroll_id.payslip_run_id.hr_period_id.vale_period == 1])"/>

<t t-esc="'{0:,.2f}'.format((total_loan_1))"/>

</td>

<td style="vertical-align:center;text-align:right;padding:5px;font-weight:bold;border: 1px solid #000000;">

<t t-set="total_loan_2" t-value="0"/>

<t t-set="total_loan_2" t-value="sum([rec.paid_amount for rec in records if rec.loan_type_id.id == o.loan_type_id.id and rec.payroll_id.payslip_run_id.hr_period_id.vale_period == 2])"/>

<t t-esc="'{0:,.2f}'.format((total_loan_2))"/>

</td>

<td style="vertical-align:center;text-align:right;padding:5px;font-weight:bold;border: 1px solid #000000;">

<t t-esc="'{0:,.2f}'.format((total_loan_1 + total_loan_2))"/>

</td>

</tr>

</table><br/>

</div>

</t>

</div>

</t>

</div>

<div class="footer">

<i>

<div class="text-left">

<span style="font-size:12px;"><i>Date printed: <span t-esc="context_timestamp(datetime.datetime.now()).strftime('%B %d, %Y %I:%M:%S %p')"/></i></span>

</div>

<div class="text-center">

<ul class="list-inline">

<li>Page:</li>

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

<li>/</li>

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

</ul>

</div>

</i>

</div>

</t>

</t>

</template>

</data>

</odoo>

Avatar
Francis Louie Del Rosario
Best Answer

Hello SOUJIRO30,

is this a qweb report?

i think you need a "for-loop" inside of qweb, and you should know what object inside that page and get the data.

you can add multiple 




0
Avatar
Discard
Avatar
Ludvig Auvens (lau)
Best Answer

Hi, 

In order to help you, could you give us more details about your problem?

0
Avatar
Discard
SOUJIRO30
Author

here is my code, I hope you can help me.

<?xml version="1.0" encoding="UTF-8" ?>

<odoo>

<data>

<!--Loan Summary Template-->

<template id="report_loan_summary_template">

<t t-call="report.html_container">

<!--<t t-call="report.external_layout"/>-->

<t t-foreach="docs" t-as="o">

<div class="page">

<!--<br/><br/><br/><br/>-->

<t t-set="company_ids" t-value="[]"/>

<t t-foreach="records.sorted(key=lambda r: r.employee_id.company_id.name)" t-as="recs">

<t t-set="company_ids" t-value="company_ids+[recs.employee_id.company_id]"/>

</t>

<t t-foreach="o.get_sorted(list(set(company_ids)))" t-as="company">

<div style="page-break-before:always;">

<t t-if="o.columns_of_two">

<t t-set="end" t-value="[1,2]"/>

</t>

<t t-if="not o.columns_of_two">

<t t-set="end" t-value="[1]"/>

</t>

<t t-foreach="end" t-as="e">

<div class="col-xs-6">

<!--<div class="text-center">-->

<!--<span style="font-weight:bold;font-family:Liberation Sans;font-size:16px;"><span class="text-uppercase" t-field="o.loan_type_id.name"/> SUMMARY<br/></span>-->

<!--&lt;!&ndash;<span style="font-weight:bold;font-family:Liberation Sans;font-size:16px;">LOAN SUMMARY LIST<br/></span>&ndash;&gt;-->

<!--<span style="font-weight:bold;font-family:Liberation Sans;font-size:10px;">FOR THE MONTH OF <span class="text-uppercase" t-esc="time.strftime('%B', time.strptime(o.from_date,'%Y-%m-%d'))"/><br/></span>-->

<!--&lt;!&ndash;<span><span t-esc="time.strftime('%B %d, %Y', time.strptime(o.from_date,'%Y-%m-%d'))"/> - <span t-esc="time.strftime('%B %d, %Y', time.strptime(o.to_date,'%Y-%m-%d'))"/></span>&ndash;&gt;-->

<!--</div><br/>-->

<!--<span style="font-weight:bold;font-family:Liberation Sans;font-size:12px;text-align:center;">Date: <span t-esc="context_timestamp(datetime.datetime.now()).strftime('%B %d, %Y %I:%M:%S %p')"/></span><br/>-->

<!--<t t-set="loan_type_ids" t-value="[]"/>-->

<!--<t t-foreach="records.sorted(key=lambda r: r.loan_type.name)" t-as="recs">-->

<!--<t t-set="loan_type_ids" t-value="loan_type_ids+[recs.loan_type]"/>-->

<!--</t>-->

<!--<t t-foreach="o.get_sorted(list(set(loan_type_ids)))" t-as="loan">-->

<!--<span style="font-weight:bold;font-family:Liberation Sans;font-size:14px;" class="text-uppercase"><span t-esc="loan.name"/></span><br/>-->

<table style="width:100%;text-align:center;font-family:Liberation Sans;border-collapse: collapse;">

<thead>

<tr>

<th colspan="5" style="width:100%;padding:8px;text-align:center;vertical-align:center;">

<div class="text-center">

<span style=";font-family:Liberation Sans;font-size:16px;" class="text-uppercase" t-esc="company.name"/><br/>

<span style="font-weight:bold;font-family:Liberation Sans;font-size:16px;"><span class="text-uppercase" t-field="o.loan_type_id.name"/> SUMMARY<br/></span>

<span style="font-weight:bold;font-family:Liberation Sans;font-size:10px;">FOR THE MONTH OF <span class="text-uppercase" t-esc="time.strftime('%B, %Y', time.strptime(o.from_date,'%Y-%m-%d'))"/><br/></span>

</div>

</th>

</tr>

<tr style="font-size:12;font-weight:bold;background-color:#d6d8db;text-align:center;border: 1px solid #000000;">

<th style="width:5%;padding:8px;text-align:center;vertical-align:center;border: 1px solid #000000;">ID NO.</th>

<th style="width:30%;padding:8px;text-align:center;vertical-align:center;border: 1px solid #000000;">EMPLOYEE'S NAME</th>

<th style="width:5%;padding:8px;text-align:center;vertical-align:center;border: 1px solid #000000;">15TH</th>

<th style="width:5%;padding:8px;text-align:center;vertical-align:center;border: 1px solid #000000;"><span t-esc="o.get_last_day_month(o.to_date)"/> </th>

<th style="width:5%;padding:8px;text-align:center;vertical-align:center;border: 1px solid #000000;">TOTAL</th>

</tr>

</thead>

<!--<t t-foreach="records.sorted(key=lambda r: r.employee_id.name)" t-as="rec">-->

<t t-set="employee_ids" t-value="[]"/>

<t t-foreach="records.sorted(key=lambda r: r.loan_id.employee_id)" t-as="recs">

<t t-if="recs.loan_id.employee_id.company_id.id == company.id">

<t t-set="employee_ids" t-value="employee_ids+[recs.loan_id.employee_id]"/>

</t>

</t>

<t t-foreach="o.get_sorted(list(set(employee_ids)))" t-as="employee">

<tbody>

<tr style="font-size:12px;">

<t t-set="loan_1" t-value="0"/>

<t t-set="loan_2" t-value="0"/>

<td style="width:5%;padding:8px;text-align:left;vertical-align:center;">

<span class="text-uppercase"><span t-esc="employee.identification_id"/></span>

</td>

<td style="width:30%;padding:8px;text-align:left;vertical-align:center;">

<span t-esc="employee.name"/>

</td>

<td style="width:5%;padding:8px;text-align:center;vertical-align:center;">

<t t-set="loan_1" t-value="0"/>

<t t-set="loan_1" t-value="sum([rec.paid_amount for rec in records if rec.loan_id.employee_id.id == employee.id and rec.loan_type_id.id == o.loan_type_id.id and rec.payroll_id.payslip_run_id.hr_period_id.vale_period == 1])"/>

<t t-esc="'{0:,.2f}'.format((loan_1))"/>

</td>

<td style="width:5%;padding:8px;text-align:center;vertical-align:center;">

<t t-set="loan_2" t-value="0"/>

<t t-set="loan_2" t-value="sum([rec.paid_amount for rec in records if rec.loan_id.employee_id.id == employee.id and rec.loan_type_id.id == o.loan_type_id.id and rec.payroll_id.payslip_run_id.hr_period_id.vale_period == 2])"/>

<t t-esc="'{0:,.2f}'.format((loan_2))"/>

</td>

<td style="width:5%;padding:8px;text-align:right;vertical-align:center;">

<span t-esc="'{0:,.2f}'.format(loan_2 + loan_1)"/>

</td>

</tr>

</tbody>

</t>

<tr>

<t t-set="total_loan_1" t-value="0"/>

<t t-set="total_loan_2" t-value="0"/>

<td style="vertical-align:center;text-align:center;padding:5px;border: 1px solid #000000;" colspan="2">

<strong><span>GRAND TOTAL</span></strong>

</td>

<td style="vertical-align:center;text-align:right;padding:5px;font-weight:bold;border: 1px solid #000000;">

<t t-set="total_loan_1" t-value="0"/>

<t t-set="total_loan_1" t-value="sum([rec.paid_amount for rec in records if rec.loan_type_id.id == o.loan_type_id.id and rec.payroll_id.payslip_run_id.hr_period_id.vale_period == 1])"/>

<t t-esc="'{0:,.2f}'.format((total_loan_1))"/>

</td>

<td style="vertical-align:center;text-align:right;padding:5px;font-weight:bold;border: 1px solid #000000;">

<t t-set="total_loan_2" t-value="0"/>

<t t-set="total_loan_2" t-value="sum([rec.paid_amount for rec in records if rec.loan_type_id.id == o.loan_type_id.id and rec.payroll_id.payslip_run_id.hr_period_id.vale_period == 2])"/>

<t t-esc="'{0:,.2f}'.format((total_loan_2))"/>

</td>

<td style="vertical-align:center;text-align:right;padding:5px;font-weight:bold;border: 1px solid #000000;">

<t t-esc="'{0:,.2f}'.format((total_loan_1 + total_loan_2))"/>

</td>

</tr>

</table><br/>

</div>

</t>

</div>

</t>

</div>

<div class="footer">

<i>

<div class="text-left">

<span style="font-size:12px;"><i>Date printed: <span t-esc="context_timestamp(datetime.datetime.now()).strftime('%B %d, %Y %I:%M:%S %p')"/></i></span>

</div>

<div class="text-center">

<ul class="list-inline">

<li>Page:</li>

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

<li>/</li>

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

</ul>

</div>

</i>

</div>

</t>

</t>

</template>

</data>

</odoo>

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Sign up
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now