Siirry sisältöön
Odoo Menu
  • Kirjaudu sisään
  • Kokeile ilmaiseksi
  • Sovellukset
    Talous
    • Kirjanpito
    • Laskutus
    • Kulut
    • Datataulukot (BI)
    • Asiakirjat
    • Allekirjoita
    Myynti
    • CRM
    • Myynti
    • Kassajärjestelmä myymälään
    • Kassajärjestelmä ravintolaan
    • Tilaukset
    • Vuokraus
    Verkkosivut
    • Verkkosivun Rakennustyökalu
    • Verkkokauppa
    • Blogi
    • Foorumi
    • Livechat
    • Verkko-oppiminen
    Toimitusketju
    • Varastointi
    • Tuotanto
    • Tuotteen elinkaaren hallinta (PLM)
    • Ostot
    • Huolto
    • Laatu
    Henkilöstöhallinto
    • Työntekijät
    • Rekrytointi
    • Vapaat
    • Arvioinnit
    • Suositukset
    • Kuljetuskalusto
    Markkinointi
    • Somemarkkinointi
    • Sähköpostimarkkinointi
    • Tekstiviestimarkkinointi
    • Tapahtumat
    • Markkinoinnin automaatio
    • Kyselyt
    Palvelut
    • Projekti
    • Työaikakirjaukset
    • Kenttähuolto
    • Asiakaspalvelu
    • Suunnittelu
    • Ajanvaraukset
    Tuottavuus
    • Viestintä
    • Hyväksynnät
    • IoT
    • IP-puhe
    • Tietokirjasto
    • WhatsApp
    Kolmannen osapuolen sovellukset Odoo-Studio Odoo-Pilvialusta
  • Toimialat
    Vähittäiskauppa
    • Kirjakauppa
    • Vaatekauppa
    • Huonekaluliike
    • Ruokakauppa
    • Laitteistokauppa
    • Lelukauppa
    Ruoka & Majoitus
    • Baari ja Pubi
    • Ravintola
    • Pikaruoka
    • Majatalo
    • Juomien jakelija
    • Hotelli
    Kiinteistöt
    • Kiinteistönvälitystoimisto
    • Arkkitehtitoimisto
    • Rakentaminen
    • Kiinteistönhallinta
    • Puutarhanhoito
    • Kiinteistön omistajien yhdistys
    Konsultointi
    • Tilitoimisto
    • Odoo-kumppani
    • Markkinointitoimisto
    • Lakitoimisto
    • Osaajahankinta
    • Tilintarkastus & sertifiointi
    Tuotanto
    • Tekstiili
    • Metalli
    • Huonekalut
    • Ruoka
    • Panimo
    • Yrityslahjat
    Terveys & Liikunta
    • Urheiluseura
    • Silmälasiliike
    • Kuntokeskus
    • Hyvinvointialan ammattilaiset
    • Apteekki
    • Kampaamo
    Kaupat
    • Yleismies
    • IT-laitteisto & Tuki
    • Aurinkoenergiajärjestelmät
    • Suutari
    • Siivouspalvelut
    • LVI-palvelut
    Muut
    • Voittoa tavoittelematon järjestö
    • Ympäristötoimisto
    • Mainostaulujen vuokraus  
    • Valokuvaus
    • Leasing-pyörät
    • Ohjelmistojen jälleenmyyjä
    Selaa kaikkia toimialoja
  • Yhteisö
    Opi
    • Kurssit
    • Dokumentaatio
    • Todistukset
    • Koulutus
    • Blogi
    • Podcast
    Kannusta kouluttautumaan
    • Koulutusohjelmat
    • Scale Up! Liiketoimintapeli
    • Vieraile Odoolla
    Hanki ohjelmisto
    • Lataa
    • Vertaile versioita
    • Julkaisut
    Tee yhteistyötä
    • Github
    • Foorumi
    • Tapahtumat
    • Käännökset
    • Ryhdy kumppaniksi
    • Kumppanipalvelut
    • Rekisteröi tilitoimistosi
    Hanki palveluja
    • Löydä kumppani
    • Löydä kirjanpitäjä
    • Varaa asiantuntijatapaaminen
    • Implementaatiopalvelut
    • Asiakasreferenssit
    • Tuki
    • Versionkorotukset
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Varaa demo
  • Hinnoittelu
  • Asiakaspalvelu

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

  • CRM
  • e-Commerce
  • Kirjanpito
  • Varastointi
  • PoS
  • Projekti
  • MRP
All apps
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Kaikki kirjoitukset Ihmiset Merkit
Tunnisteet (Näytä kaikki)
odoo accounting v14 pos v15
Tietoa tästä foorumista
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Kaikki kirjoitukset Ihmiset Merkit
Tunnisteet (Näytä kaikki)
odoo accounting v14 pos v15
Tietoa tästä foorumista
Apua

How to inherit standard report parser class in qweb reports

Tilaa

Saat ilmoituksen, kun tähän viestiin ilmaantuu aktiviteettia

Tämä kysymys on merkitty
12 Vastaukset
14401 Näkymät
Avatar
Yogesh

I am modifying hr_payslip report in custom module. I want to add a custom method to this report for this I need to update localcontext with custom method for this report. I am trying

 

class payslip_report(report_sxw.rml_parse):

    def __init__(self, cr, uid, name, context):
        super(payslip_report, self).__init__(cr, uid, name, context)
        self.localcontext.update({
            'get_payslip_total':self.get_payslip_total,
        })


    def get_payslip_total(self, obj):
        payslip_line = self.pool.get('hr.payslip.line')
        res = []
        total = 0.0
        for id in range(len(obj)):
            if obj[id].appears_on_payslip is True:
                total = total + obj.total

        return total

 

and calling in qweb template like

<td><span t-esc="get_payslip_total(o.line_ids)"/> </td>

 

but getting error  "QWebException: "'NoneType' object is not callable" while evaluating
'get_payslip_lines(o.line_ids)". Can anyone help me what I am missing here?

5
Avatar
Hylkää
Houssine BAKKALI

Hi, I've you solved your issue?

Yogesh
Tekijä

No

Houssine BAKKALI

I'm also stuck with this. Just trying to reuse the parser for a new qweb report and it doesn't seems to be possible...

Yogesh
Tekijä

I also got stuck and had to pause the task , if you get solution please post the answer it will help me and others. I have to start that task again in 3-4 days.

Houssine BAKKALI

i've maybe go a solution for my case... and I think that for your case you will need to override payslip_report instead of report_sxw.rml_parse with something like : class payslip_report(payslip_report): and importing previously the payslip_report with someting like import addons.hr_payroll.report.report_payslip hope this help

Sajin Aziz

try this, https://www.odoo.com/forum/help-1/question/how-output-a-odoo-8-datetime-field-without-time-on-a-qweb-report-67948#answer-67995

Pascal Tremblay

Did you solve this post? I have the same.

Avatar
Pawan
Paras vastaus

Yogesh,

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 :)

2
Avatar
Hylkää
Avatar
Ivan
Paras vastaus

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.

2
Avatar
Hylkää
Yogesh
Tekijä

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.

Avatar
Vinicio Llumiquinga
Paras vastaus

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">
                    <thead>
                        <tr>
                            <th>Code</th>
                            <th>Account</th>
                            <th>Saldo Anterior</th>
                            <th class="text-right">Debit</th>
                            <th class="text-right">Credit</th>
                            <th class="text-right">Balance</th>
                        </tr>
                    </thead>
                    <tbody>
                        <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 t-if="childrenaccount['type'] != 'view'">
                                <t t-set="style" t-value="'font-weight:normal;'"/>
                            </t>
                            <td>
                                <span t-att-style="style" t-esc="childrenaccount['code']"/>                                   
                            </td>
                            <td>
                                <span style="color: white;" t-esc="'.' * (childrenaccount['level'] - 1)"/>
                                <span t-att-style="style" t-esc="childrenaccount['name']"/>
                            </td>
                            <td class="text-right">
                                 <span t-att-style="style" t-esc="childrenaccount['sal_ant']" />
                            </td>
                            <td class="text-right">
                                 <span t-att-style="style" t-esc="childrenaccount['debit']"/>
                            </td>
                            <td class="text-right">
                                <span t-att-style="style" t-esc="childrenaccount['credit']"/>
                            </td>
                            <td class="text-right">
                                <span t-att-style="style" t-esc="formatLang(childrenaccount['balance'], currency_obj=res_company.currency_id)"/>
                            </td>
                        </tr>
                    </tbody>
                </table>          
            </xpath>

        </template>

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 = []
        self.localcontext.update({
            'time': time,
            'lines_comprobacion': self.lines_comprobacion,
            'sum_debit': self._sum_debit,
            'sum_credit': self._sum_credit,
            'get_fiscalyear':self._get_fiscalyear,
            '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_start_date':self._get_start_date,
            'get_end_date':self._get_end_date,
            'get_target_move': self._get_target_move,
        })
        self.context = context


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

        #NEW METHOD THAT INCREASES FUNCTIONALITY


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

Regards.

0
Avatar
Hylkää
Avatar
Axel Mendoza
Paras vastaus

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

https://www.odoo.com/es_ES/forum/help-1/question/how-to-define-a-custom-methods-functions-to-be-used-in-a-qweb-report-how-to-define-and-use-a-report-parser-92244

0
Avatar
Hylkää
Nautitko keskustelusta? Älä vain lue, vaan osallistu!

Luo tili jo tänään nauttiaksesi yksinoikeusominaisuuksista ja osallistuaksesi mahtavaan yhteisöömme!

Rekisteröidy
Yhteisö
  • Kurssit
  • Dokumentaatio
  • Foorumi
Avoin lähdekoodi
  • Lataa
  • Github
  • Runbot
  • Käännökset
Palvelut
  • Odoo.sh hosting
  • Tuki
  • Versionkorotus
  • Räätälöidyt kehitykset
  • Koulutus
  • Löydä kirjanpitäjä
  • Löydä kumppani
  • Ryhdy kumppaniksi
Meistä
  • Yrityksemme
  • Brändiominaisuudet
  • Ota yhteyttä
  • Työpaikat
  • Tapahtumat
  • Podcast
  • Blogi
  • Asiakkaat
  • Oikeudellinen ilmoitus • Yksityisyys
  • Tietoturva
الْعَرَبيّة 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 on kokoelma avoimen lähdekoodin yrityssovelluksia, jotka kattavat kaikki yrityksesi tarpeet: asiakkuudenhallinta eli CRM, verkkokauppa, kirjanpito, varastointi, kassajärjestelmä, projektinhallinta, jne.

Odoon uniikki arvolupaus on olla samanaikaisesti erittäin helppokäyttöinen ja täysin integroitu.

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