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

Trying to get a pdf with xmlrpc api gives 500 INTERNAL SERVER ERROR

Abonare

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

Această întrebare a fost marcată
printingxmlrpc
3 Răspunsuri
11316 Vizualizări
Imagine profil
Jacob Steringa

So I am trying to print an invoice with the xmlrpc api. I used the example from the api docs (https://doc.odoo.com/6.1/developer/12_api/#python-example) but it seems not to work.

Code:

import xmlrpclib
import time
import base64

u = '****'
pwd = '****'
db = '****'

sock_common = xmlrpclib.ServerProxy('http://*********:8069/xmlrpc/common')
uid = sock_common.login(db, u, pwd)

sock_print = xmlrpclib.ServerProxy('http://*********:8069/xmlrpc/report')
report_id = sock_print.report(db, uid, pwd, 'account.invoice', [1], {'model': 'account.invoice', 'id': 1, 'report_type': 'pdf'})

time.sleep(3);

state = False
attempt = 0

while not state:
    report = sock_print.report_get(db, uid, pwd, report_id)
    state = report['state']
    if not state:
        time.sleep(1)
        attempt += 1
    if attempt > 200:
        print 'Abort, too long delay'

pdf_string = base64.decodestring(report['result'])
pdf_file = open('/tmp/file.pdf', 'w')
pdf_file.write(pdf_string);
pdf_file.close()

Log:

2014-07-22 10:25:08,644 21122 ERROR jacob openerp.service.report: Exception: Required report does not e
xist: None
Traceback (most recent call last):
  File "/home/odoo/openerp/service/report.py", line 93, in go
    result, format = openerp.report.render_report(cr, uid, ids, object, datas, context)
  File "/home/odoo/openerp/report/__init__.py", line 40, in render_report
    return registry['ir.actions.report.xml'].render_report(cr, uid, ids, name, data, context)
  File "/home/odoo/openerp/api.py", line 204, in wrapper
    return old_api(self, *args, **kwargs)
  File "/home/odoo/openerp/addons/base/ir/ir_actions.py", line 139, in render_report
    new_report = self._lookup_report(cr, name)
  File "/home/odoo/openerp/api.py", line 204, in wrapper
    return old_api(self, *args, **kwargs)
  File "/home/odoo/openerp/addons/base/ir/ir_actions.py", line 131, in _lookup_report
    raise Exception, "Required report does not exist: %s" % r
Exception: Required report does not exist: None

Does anyone know what the problem might be?

0
Imagine profil
Abandonează
Imagine profil
Ludo - 21South
Cel mai bun răspuns

Well, the error tells you the report does not exist, so it is most likely looking for a report name that is not present in the database.

You are most likely using Odoo 8 or up (because I spotted the old_api in the stack trace) and when I search my own database, there is indeed no such report.

Try replacing the search line:

report_id = sock_print.report(db, uid, pwd, 'account.invoice', [1], {'model': 'account.invoice', 'id': 1, 'report_type': 'pdf'})
with
report_id = sock_print.report(db, uid, pwd, 'account.invoice', [1], {'model': 'account.invoice', 'id': 1, 'report_type': 'qweb-pdf'})

 

And see if that works. I can't check it for you now, so it is a guess.

1
Imagine profil
Abandonează
Imagine profil
klacus
Cel mai bun răspuns

The trouble is the name of the report.

"Required report does not exist: NoneTraceback (most recent call last):"

MAy you can check your report name and path line by line with print... so some debuging process must in this case.

 

0
Imagine profil
Abandonează
Imagine profil
Jacob Steringa
Autor Cel mai bun răspuns

Thank you for your answers, it helped me understand the problem better. After fooling around with erppeek and studying the source code, i've come to the conclusion that the report for account.invoice does not exist. I used account.report_invoice instead and it works like a charm!

And indeed, the report_type should be qweb-pdf. The resulting call:

report_id = sock_print.report(db, uid, pwd, 'account.report_invoice', [1], {'model': 'account.report_invoice', 'id': 1, 'report_type': 'qweb-pdf'})

Thanks again :)

0
Imagine profil
Abandonează
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
Product Labels Configuration
printing
Imagine profil
Imagine profil
Imagine profil
Imagine profil
4
sept. 25
7475
xmlrpc Error when attempting to connect to my local instance Rezolvat
xmlrpc
Imagine profil
Imagine profil
Imagine profil
3
iul. 25
4337
Cannot marshal None unless allow_none is enabled
xmlrpc
Imagine profil
1
oct. 24
3138
How to run a method from external api as the superuser
xmlrpc
Imagine profil
Imagine profil
1
apr. 24
3191
<methodName>execute</methodName>
xmlrpc
Imagine profil
0
sept. 23
2531
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