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
    • Discuss
    • 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 to pass context from JS to pdf report(ir.actions.report)

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
javascriptreportjsir.actions.reportqweb-pdf
1 Balas
4801 Tampilan
Avatar
Rodolphe CHABI ILOUGBADE

Hi everyone,

I created a qweb-pdf template that works pretty (PDF file is generate without error) well except for one thing : a field (customer_name) value is not displayed.


This is report template code snippet :

..
t-if="customer_name">
The custom value is: t-esc="customer_name"/>

..

I call this qweb-pdf from JS file (on POS environment) like this : 

..
await this.env.pos.do_action('my_module.pos_custom_report', {
additional_context: {
active_ids: [119], // 119 is value for my test..
customer_name: this.props.customer_name, // This is the value I want to display in my customer_name field on the report
},
});
..


In _get_report_values method, when i print context, i don't see 'customer_name' i pass in my JS. So i don't know how to pass value i don't see here inside my report template.

..
@api.model
def _get_report_values
(self, docids, data=None):
print("a+A _get_report_values _context :", self._context)

docs = self.env['pos.order'].browse(docids)

return {
'doc_ids': docids,
'doc_model': 'pos.order',
'docs'
: docs,
}
..

How can i do to pass customer_name from JS to my custom report template ?

What am I missing ?

Thanks for any help !

0
Avatar
Buang
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Jawaban Terbai

Hi,

Instead of calling "customer_name" from the template try calling "o.partner_id.name" or "itrator_variable_of_docs.partner_id.name"

if the above method doesn't work, Instead of passing value from js, we can do it from python as,

customer_names = docs.mapped('partner_id.name')

"customer_names" will have the list of the customer names

then change the return into,

return {
'doc_ids' : docids,
'doc_model' : 'pos.order',
'docs' : docs ,
'data' : customer_names,
}

then try calling "data" from template, you will be able to receive values of the customer_names variable

Regards

0
Avatar
Buang
Rodolphe CHABI ILOUGBADE
Penulis

Thank you for your answer.

I understand what you are saying, but customer_name I am trying to display in my template is from JS. It's not a value I'm storing in a field. It's the value of an input field that I've added to the POS.
So when the input field is filled in and I click a button, I generate a report with my template.

Do you understand what I am saying ?

P.S : The name of the variable may be a bit misleading

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
Pass more data to report from JavaScript
javascript report
Avatar
0
Mar 23
2494
how to read field values using js Diselesaikan
javascript js
Avatar
Avatar
1
Mei 25
9195
Patch JS function that doesn't belong to a class Diselesaikan
javascript js patch
Avatar
1
Nov 24
6426
Trouble Importing JavaScript Between Custom Odoo Modules
javascript inheritance js
Avatar
0
Mei 24
3552
Odoo 14: Reload Point Of Sale Diselesaikan
javascript js point_of_sale
Avatar
Avatar
1
Apr 24
2906
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