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 to download .xls file in a single click?

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
reportexcelpython2.7
6 Replies
29414 Tampilan
Avatar
Yogesh

Hello, I am generating a .xls file with xlwt python-package and writing generated .xls in a binary field. To see that .xls I need to click on binary field then it gives me file to download and after download I can open.  I want to omit this step of clicking binary to download file.

I would prefer to click on "Generate Excel" button and it should show me dialogue box to download file. ( without clicking the binary field where file is being saved)

Thanks in advance , any help would be appreciated!!

1
Avatar
Buang
Mihai Marius

Hi, Did you manage to resolve? I have the same issue and not able to find an answer. Many thanks,

Yogesh
Penulis

Yes, I managed to do ,I am out will post answer as soon as I get back to computer.

Sehrish

Downloading file on button click: http://learnopenerp.blogspot.com/2020/06/write-binary-data-nto-zip-file-and-downlaod-it-on-button-click-in-odoo.html

Avatar
Maroua ROMDHANE
Jawaban Terbai
@api.one
def _get_template(self):
self.contract_template = base64.b64encode(open("/path/contract_template.xls", "rb").read())

contract_template = fields.Binary('Template', compute="_get_template")

@api.multi
def get_contract_template(self):
return {
'type': 'ir.actions.act_url',
'name': 'contract',
'url': '/web/content/model.name/%s/contract_template/contract_template.xls?download=true' %(self.id),

}

XML:

<button name="get_contract_template" string="Download Template" type="object" class="oe_link oe_right"/>
4
Avatar
Buang
osvaldo

the fastest and the most useful answer to me

Avatar
Emipro Technologies Pvt. Ltd.
Jawaban Terbai

Hello,

Please have a look on the complete blog "How to Download any File on Button Click".

I am sure that it will help a lot.

Thanks.

1
Avatar
Buang
Avatar
ameer ashraf
Jawaban Terbai

 Hello, u managed to solve this problem? kindly share with me how u solved it. i had the same problem but still did not able to solve it. thank you.

0
Avatar
Buang
Avatar
Bryan Sandoval
Jawaban Terbai

def get_contract_template(self):

    url = str('/madel_name/static/src/xls/template.xlsx')

    return {'type' : 'ir.actions.act_url','url': url,'target': 'self','tag': 'reload', }

0
Avatar
Buang
Avatar
Fernando La Chica Mera
Jawaban Terbai

You need to create a computed binary field. On the property compute assign the name of the function that calculates the field value of this field. '_compute_field' in this example.


@api.one
def _compute_field(self):
r = open(filename, 'rb').read().encode('base64')
self.computed_field = r

 

-1
Avatar
Buang
Yogesh
Penulis

That would compute each time whenever you open form.

Avatar
Akhil P Sivan
Jawaban Terbai

Hi, this is one more option. On clicking the "Generate Excel" button, you can open a wizard, which contains a button "print xls" (and possibly some entries to pass to the report parser if needed), on that button call a python method, which is defined on the transient model, for eg:

- this is my button on wizard:

<button icon="gtk-execute" name="get_report" string="Export xls" type="object" context="{'xls_export':1}"/>;

- the method in transient model, in my case I have both pdf or excel report, thats why am passing context in button:

    @api.v7
def get_report(self, cr, uid, ids, context=None):
if context is None:
context = {}
data = {}
data['ids'] = context.get('active_ids', [])
data['model'] = context.get('active_model', 'ir.ui.menu')
data['form'] = self.read(cr, uid, ids, ['pricelist_type', 'hek', 'pek', 'dek'], context=context)[0]

if context.get('xls_export'):
return {'type': 'ir.actions.report.xml',
'report_name': 'product.pricelist.xls',
'datas': data['form']
}
else:
return self.pool['report'].get_action(cr, uid, [], 'custom_module.report_pricelist', data=data, context=context)

then you just need to create one .py file containing the parser and code to generate the excel report. In my case I want to generate excel report of the products pricelist. I suppose you have the parser and code to generate xls. If you don't have, I can send you the code for reference, by email.

Hope this helps you.

-1
Avatar
Buang
Yogesh
Penulis

Which reporting engine you are using? It doesn't make any difference you are generating report through for or wizard.

Akhil P Sivan

I thought you want to have a pop-up and print xls, as you might have seen with some financial report module. Am also talking about generating .xls file with xlwt python-package. Anyway if you solved your issue, none of these matters :)

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
Subtraction in Excell report ODOO 12
report excel Odoo12
Avatar
Avatar
1
Agu 24
3251
How to insert image into the excel report? Diselesaikan
report excel images
Avatar
Avatar
Avatar
Avatar
3
Okt 23
14764
Error On Saving Excel Report in Odoo V12c
report excel odooV12
Avatar
Avatar
1
Apr 19
4120
How to create Excel report in odoo9 ? Diselesaikan
report excel odoo9
Avatar
Avatar
Avatar
Avatar
7
Apr 19
16017
Rml Report to Excel Report
rml report excel
Avatar
Avatar
Avatar
2
Mei 18
6646
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