Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Diskusi
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

How do I get a PDF of an Invoice via PHP?

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
xmlrpcreports
2 Replies
9301 Tampilan
Avatar
Yaidel Ferrales

I'm trying to get an invoice in it's pdf version , but the example en the docs only guide me to this result:

array (size=2)
  'faultCode' => int 2
  'faultString' => string 'None' (length=4)

I've been trying to find what the faultCode 2 means but no luck at all. Can you provide me any working example or documentation? I'm using this source code:

<?php

require_once('ripcord.php');

$url = "http://xxx.viennaresidence.com";

$db = "odoo.yaidel";

$username = "development@worldwideresidence.com";

$password = "xxx";

$common = ripcord::client("$url/xmlrpc/2/common");

$uid = $common->authenticate($db, $username, $password, array());

$models = ripcord::client("$url/xmlrpc/2/object");

$invoice_ids = $models->execute_kw(

$db, $uid, $password,

'account.invoice', 'search',

array(

array(

array(

'type',

'=',

'out_invoice'

),

array(

'state',

'=',

'open'

)

)

)

);

/*

var_dump($models->execute_kw(

$db, $uid, $password,

'ir.actions.report.xml', 'fields_get',

array(),

array('attributes' => array('string', 'help', 'type'))

));

*/

echo "<b>Invoices Opened</b>";

var_dump($invoice_ids);

$report = ripcord::client("$url/xmlrpc/2/report");

/*

echo "<b>Report XMLRPC Object</b>";

var_dump ($report);

*/

$result = $report->render_report(

$db, $uid, $password,

'account.report_invoice', 8);

/*

echo "<b>Report XMLRPC Object after Call</b>";

var_dump ($report);

*/

echo "<b>Result of calling the Render Report</b>";

if (isset($result['faultCode'])) {

var_dump($result);

} else {

$report_data = base64_decode($result['result']);

}

?>

Thanks in advance.

1
Avatar
Buang
Avatar
Jérémy Kersten (jke)
Jawaban Terbai

Hello, I have just tested on 9.0 and master and it works without any problem.


Could you check your log to see the tracebackthat is raised... ?


Here my test on runbot.


<?php
    // V9
$url = "http://148681-9-0-7f9942-all.runbot8.odoo.com";
$db = "148681-9-0-7f9942-all";

// master
$url = "http://148647-master-6a4306-all.runbot9.odoo.com";
$db = "148647-master-6a4306-all";

$username = "admin";
$password = "admin";

require_once('ripcord.php');
$common = ripcord::client("$url/xmlrpc/2/common");
$uid = $common->authenticate($db, $username, $password, array());
$models = ripcord::client("$url/xmlrpc/2/object");
$invoice_ids = $models->execute_kw($db, $uid, $password, 'account.invoice', 'search', array(
array(
array('type', '=', 'out_invoice'),
array('state', '=', 'open')
)
));
$report = ripcord::client("$url/xmlrpc/2/report");
$result = $report->render_report($db, $uid, $password, 'account.report_invoice', array($invoice_ids[0]));
$report_data = base64_decode($result['result']);
header('Content-Type: application/pdf');
echo $report_data;
?> 

UPDATE MY PREVIOUS ANSWER

After some investigations in your database, it appears that you customize the report invoice and delete the default one. So 'account.report_invoice' doesn't exists anymore and has been replaced by report 'customized_invoice.invoice_report'.

You probably have some tracebacks in your log with msg like "ValueError: "Required report does not exist: account.report_invoice" "  :)

So just replace:

$result = $report->render_report($db, $uid, $password, 'account.report_invoice', array($invoice_ids[0]));

by

$result = $report->render_report($db, $uid, $password, 'customized_invoice.invoice_report', array($invoice_ids[0]));

And it should work... like a charm


1
Avatar
Buang
Avatar
Yaidel Ferrales
Penulis Jawaban Terbai

Thanks, for the reply. Just as you said, the problem was the template. I changed the account.invoice and I got my first PDF. So once again thank you.

0
Avatar
Buang
Jérémy Kersten (jke)

Hello Seems that I forgot to post my last answer :( But after some investigations, I found the error ... You have renamed the default report 'account.report_invoice' by customized_invoice.xxx! So the error was because it doesn't find the report name !

Jérémy Kersten (jke)

I find it... So I have uptaded the previous answer. Have fun with Odoo !

Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
Odoo Reports
xmlrpc reports PHP
Avatar
1
Feb 24
1820
Code for page number in Body of Pdf report
reports
Avatar
Avatar
Avatar
2
Okt 25
3191
How to increase the width of a column on odoo quotation PDF?
reports
Avatar
Avatar
1
Okt 25
1006
Odoo Online (SaaS 18.4 Enterprise) – How to modify invoice report header without affecting other reports but keep default table content
reports
Avatar
Avatar
1
Agu 25
1608
xmlrpc Error when attempting to connect to my local instance Diselesaikan
xmlrpc
Avatar
Avatar
Avatar
3
Jul 25
4201
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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