콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2160 화면

Hi, 
I am using Odoo 17 and have integrated Odoo into my Laravel Website. I am able to get all the Inovices and relevent details, but some how I am not able to get the PDF file for the invoice. 

public function getPdfInvoice(Invoice $invoice, $entityID) { // Authenticate and setup headers $this->setHeaders($entityID);

// Get the reference ID for the invoice $invoice_id = $invoice->reference_id;

// Determine the report type based on the invoice status if ($invoice->status == 1) { $report_name = 'account.report_invoice_with_payments'; // For paid invoices } else { $report_name = 'account.report_invoice'; // For unpaid invoices }

// Use the 'execute_report' method to generate the PDF $params = [ $this->encoder->encode($this->db), $this->encoder->encode($this->uid), $this->encoder->encode($this->password), $this->encoder->encode('report'), $this->encoder->encode('render_report'), $this->encoder->encode([$report_name, [$invoice_id]]) ];

$request = new Request('execute_kw', $params); $response = $this->models->send($request); Log::info("Odoo getPdfInvoice", ['response' => $response]);

// Check for errors in the response if ($response->faultCode()) { throw new \Exception('Error fetching PDF for invoice: ' . $response->faultString()); }

// Check if the response is valid and contains PDF data if (empty($response->value()->scalarval())) { throw new \Exception('Empty response, unable to fetch PDF'); }

// Decode the PDF binary data $pdfContent = base64_decode($response->value()->scalarval());

if (!$pdfContent) { throw new \Exception('Error fetching PDF for invoice: ' . $response->faultString()); } else { return $pdfContent; } }

I am always getting Object report doesn't exist

kindly check and help me out on this.

아바타
취소
관련 게시물 답글 화면 활동
2
7월 25
754
1
8월 25
1508
1
6월 24
2427
0
1월 25
1141
11
10월 24
30642