Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

How to register a parser for a qweb report

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
invoiceqwebreportsparserodooV8
1 Răspunde
7112 Vizualizări
Imagine profil
E.M.

Hi,

I have the following report defined:

 <report
id="report_invoice_custom"
model="account.invoice"
string="Custom invoice report"
report_type="qweb-pdf"
name="custom_reports.invoice_custom"
attachment_use="False"
file="custom_reports.invoice_custom"
attachment = "(object.state in ('open','paid')) and ('F_'+(object.number or '').replace('/','')+'.pdf')"
/>

And I am defining a new parser for it:

from openerp.report import report_sxw
from openerp.osv import osv
from openerp import api

class invoice_parser(report_sxw.rml_parse):

def __init__(self, cr, uid, name, context):
super(invoice_parser, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'select_value': self._selection_value,
})

def _selection_value(self, value):
if value:
tax_pool = self.pool.get('account.tax')
tax_ids = tax_pool.search(self.cr, self.uid, [('name', '=', value)])
if tax_ids:
tax_id = tax_pool.browse(self.cr, self.uid, tax_ids[0])
return self._translate(tax_id.description)
return value

class report_custom_invoice_parser(osv.AbstractModel):
_name = 'report.module.invoice.wrapper'
_inherit = 'report.abstract_report'
_template = 'custom_reports.invoice_custom'
_wrapped_report_class = invoice_parser

If I understood how parsers work, I guess I have to add something similar to the following code to register the parser:

report_sxw.report_sxw(
'custom_reports.invoice_custom',
'account.invoice',
'custom/custom_reports/xml/custom_reports.xml',
parser= select_value )

Could someone help me to understand how to register the parser?

Thanks,

0
Imagine profil
Abandonează
Imagine profil
Axel Mendoza
Cel mai bun răspuns

In order for the parser to be picked by Odoo and according for your example you need to define it like this:

class report_custom_invoice_parser(osv.AbstractModel):
_name = 'report.custom_reports.invoice_custom'
_inherit = 'report.abstract_report'
_template = 'custom_reports.invoice_custom'
_wrapped_report_class = invoice_parser

2
Imagine profil
Abandonează
E.M.
Autor

So simple, thanks!!

Axel Mendoza

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

Samantha Cruz

Hi Sir @Axel, why I always got an error that the _name attrbiute is invalid wherein that's the name I defines in my report? But when I remove the module name, dont have an error but the function I created is not callable.

Axel Mendoza

post your error log

Samantha Cruz

Hi Sir @Axel, it was already solved, the problem is the name of the module. I have a question Sir, please refer to this link https://www.odoo.com/es_ES/forum/ayuda-1/question/batch-report-using-report-parser-98789, Your suggestions will be highly appreciated :)

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

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

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
how we design custom report in odoov8.0
invoice qweb reports odooV8
Imagine profil
Imagine profil
1
oct. 15
6395
How to customize contact widget in qweb reports? Rezolvat
qweb reports odooV8
Imagine profil
Imagine profil
2
oct. 22
29892
Invoice Odoo 8 - How to have the subtotal with taxe in Invoice report
invoice qweb odooV8
Imagine profil
0
aug. 16
4230
Invoices doesnt print correctly post migration from openerp 7 to odoo 8 Rezolvat
invoice qweb reports
Imagine profil
Imagine profil
3
nov. 15
6203
how we use python parser file in odoo report Rezolvat
reports parser odooV8
Imagine profil
Imagine profil
Imagine profil
7
oct. 15
13780
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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