Odoo Help

12 Answers



| 4 4 6
Hyderabad, India

9/4/15, 1:39 AM


In order to inherit your"payslip_report" class, just inherit your previous class, using python inheritance.....as:

from openerp.addons.[your_mocule_name].[directory_structue/parent_folder] import payslip_report

and then redefine the class,

class payslip_report(payslip_report.payslip_report):

# here you can override or add previous/new functions.......

Don't forget to keep your [your_module_name] dependency in __openerp__.py

Hope it helps you and i am posting this post after so much long time, since i got it now and it may help you or someone else :)




| 5 3 7
Jakarta, Indonesia
10/31/14, 8:41 AM

You should be inheriting from the payslip_report class in hr_payroll/report/report_payslip.py.  First, before the class definition you should put: from hr_payroll.report import report_payslip.  Then the class definition should be class payslip_report(report_payslip.payslip_report).  This way, you chain your inheritance (this is python inheritance, not Odoo ORM inheritance) through the class that provides the get_payslip_lines method.

Also don't forget to re-register your report with the new parser.  At the end of the py file, add the following line: report_sxw.report_sxw('report.payslip', 'hr.payslip', 'hr_payroll/report/report_payslip.rml', parser=payslip_report) adjust the information as necessary.

1 Comment
10/31/14, 8:48 AM

Thanks for your reply. I haven't gave a try yet all seems okay to me except registry of new parser. it is qweb report so no .rml.

Vinicio Llumiquinga
6/7/17, 5:49 PM

Hi friends:

I solved it in the following way:

I wanted to increase a column in trial balance, this column show before account balance to period or date chosen by the user in the wizard of trial balance.

First Inherit template of tria balance:

<template id="report_trialbalance_saldo_anterior" inherit_id="account.report_trialbalance">
            <xpath expr="//table[@class='table table-condensed']" position="replace">
                <table class="table table-condensed">
                            <th>Saldo Anterior</th>
                            <th class="text-right">Debit</th>
                            <th class="text-right">Credit</th>
                            <th class="text-right">Balance</th>
                        <tr t-foreach="lines_comprobacion(data['form'])" t-as="childrenaccount">
                            <t t-if="childrenaccount['type'] == 'view'">
                                <t t-set="style" t-value="'font-weight:bold;'"/>
                            <t t-if="childrenaccount['type'] != 'view'">
                                <t t-set="style" t-value="'font-weight:normal;'"/>
                                <span t-att-style="style" t-esc="childrenaccount['code']"/>                                   
                                <span style="color: white;" t-esc="'.' * (childrenaccount['level'] - 1)"/>
                                <span t-att-style="style" t-esc="childrenaccount['name']"/>
                            <td class="text-right">
                                 <span t-att-style="style" t-esc="childrenaccount['sal_ant']" />
                            <td class="text-right">
                                 <span t-att-style="style" t-esc="childrenaccount['debit']"/>
                            <td class="text-right">
                                <span t-att-style="style" t-esc="childrenaccount['credit']"/>
                            <td class="text-right">
                                <span t-att-style="style" t-esc="formatLang(childrenaccount['balance'], currency_obj=res_company.currency_id)"/>


And the .py in my module is:

import time

from openerp.osv import osv from openerp.report import report_sxw from openerp.addons.account.report.common_report_header import common_report_header from openerp.addons.account.report.account_balance import account_balance from datetime import datetime, timedelta

class account_balance_comprobacion(report_sxw.rml_parse, common_report_header):

    def __init__(self, cr, uid, name, context=None):
        super(account_balance_comprobacion, self).__init__(cr, uid, name, context=context)
        self.sum_debit = 0.00
        self.sum_credit = 0.00
        self.date_lst = []
        self.date_lst_string = ''
        self.result_acc = []
            'time': time,
            'lines_comprobacion': self.lines_comprobacion,
            'sum_debit': self._sum_debit,
            'sum_credit': self._sum_credit,
            'get_filter': self._get_filter,
            'get_start_period': self.get_start_period,
            'get_end_period': self.get_end_period ,
            'get_account': self._get_account,
            'get_journal': self._get_journal,
            'get_target_move': self._get_target_move,
        self.context = context

    def lines_comprobacion(self, form, ids=None, done=None):


class report_trialbalance_comprobacion(osv.AbstractModel):  
    _name = 'report.account.report_trialbalance'
    _inherit = 'report.abstract_report'
    _template = 'account.report_trialbalance'
    _wrapped_report_class = account_balance_comprobacion

That was all i hope it helps



Axel Mendoza

--Axel Mendoza--
| 7 8 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full-time employee trying to understand what to do and how

Reach me at aekroft@gmail.com

Axel Mendoza
10/15/15, 5:54 AM

I write a more extensive explanation of qweb report parsers at:


Ask a Question
About This Community

This platform 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.

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now