Přejít na obsah
Odoo Menu
  • Přihlásit se
  • Vyzkoušejte zdarma
  • Aplikace
    Finance
    • Účetnictví
    • Fakturace
    • Výdaje
    • Spreadsheet (BI)
    • Dokumenty
    • Podpisy
    Prodej
    • CRM
    • Prodej
    • POS Obchod
    • POS Restaurace
    • Předplatné
    • Pronájem
    Webové stránky
    • Webové stránky
    • E-shop
    • Blog
    • Fórum
    • Živý chat
    • eLearning
    Dodavatelský řetězec
    • Sklad
    • Výroba
    • PLM
    • Nákup
    • Údržba
    • Kvalita
    Lidské zdroje
    • Zaměstnanci
    • Nábor
    • Volno
    • Hodnocení zaměstnanců
    • Doporučení
    • Vozový park
    Marketing
    • Marketing sociálních sítí
    • Emailový marketing
    • SMS Marketing
    • Události
    • Marketingová automatizace
    • Dotazníky
    Služby
    • Projekt
    • Časové výkazy
    • Práce v terénu
    • Helpdesk
    • Plánování
    • Schůzky
    Produktivita
    • Diskuze
    • Schvalování
    • IoT
    • VoIP
    • Znalosti
    • WhatsApp
    Aplikace třetích stran Odoo Studio Odoo cloudová platforma
  • Branže
    Maloobchod
    • Knihkupectví
    • Obchod s oblečením
    • Obchod s nábytkem
    • Potraviny
    • Obchod s hardwarem
    • Hračkářství
    Food & Hospitality
    • Bar a Pub
    • Restaurace
    • Fast Food
    • Guest House
    • Distributor nápojů
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektonická firma
    • Stavba
    • Správa nemovitostí
    • Zahradnictví
    • Asociace vlastníků nemovitosti
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketingová agentura
    • Právník
    • Akvizice talentů
    • Audit a certifikace
    Výroba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Korporátní dárky
    Zdraví a fitness
    • Sportovní klub
    • Prodejna brýli
    • Fitness Centrum
    • Wellness praktikové
    • Lékárna
    • Kadeřnictví
    Trades
    • Údržbář
    • IT hardware a podpora
    • Solar Energy Systems
    • Výrobce obuvi
    • Úklidové služby
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agentura pro životní prostředí
    • Pronájem billboardů
    • Fotografování
    • Leasing jízdních kol
    • Prodejce softwaru
    Browse all Industries
  • Komunita
    Edukační program
    • Tutoriály
    • Dokumentace
    • Certifikace
    • Vzdělávání
    • Blog
    • Podcast
    Podpora vzdělávání
    • Vzdělávací program
    • Scale Up! Hra na firmu
    • Navštivte Odoo
    Získat software
    • Stáhnout
    • Porovnejte edice
    • Verze
    Spolupráce
    • Github
    • Fórum
    • Události
    • Překlady
    • Stát se partnerem
    • Services for Partners
    • Registrujte svou účetní firmu
    Získat služby
    • Najít partnera
    • Najít účetní
    • Setkejte se s poradcem
    • Implementační služby
    • Zákaznické reference
    • Podpora
    • Upgrady
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dohodnout demo
  • Ceník
  • Pomoc

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

  • CRM
  • e-Commerce
  • Účetnictví
  • Sklad
  • PoS
  • Projekty
  • MRP
All apps
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
You need to be registered to interact with the community.
All Posts Lidé Odznaky
Štítky (View all)
odoo accounting v14 pos v15
O tomto fóru
Pomoc

How to download .xls file in a single click?

Odebírat

Get notified when there's activity on this post

This question has been flagged
reportexcelpython2.7
6 Odpovědi
29413 Zobrazení
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
Zrušit
Mihai Marius

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

Yogesh
Autor

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
Nejlepší odpověď
@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
Zrušit
osvaldo

the fastest and the most useful answer to me

Avatar
Emipro Technologies Pvt. Ltd.
Nejlepší odpověď

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
Zrušit
Avatar
ameer ashraf
Nejlepší odpověď

 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
Zrušit
Avatar
Bryan Sandoval
Nejlepší odpověď

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
Zrušit
Avatar
Fernando La Chica Mera
Nejlepší odpověď

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
Zrušit
Yogesh
Autor

That would compute each time whenever you open form.

Avatar
Akhil P Sivan
Nejlepší odpověď

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
Zrušit
Yogesh
Autor

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 :)

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Přihlásit se
Related Posts Odpovědi Zobrazení Aktivita
Subtraction in Excell report ODOO 12
report excel Odoo12
Avatar
Avatar
1
srp 24
3251
How to insert image into the excel report? Vyřešeno
report excel images
Avatar
Avatar
Avatar
Avatar
3
říj 23
14764
Error On Saving Excel Report in Odoo V12c
report excel odooV12
Avatar
Avatar
1
dub 19
4120
How to create Excel report in odoo9 ? Vyřešeno
report excel odoo9
Avatar
Avatar
Avatar
Avatar
7
dub 19
16016
Rml Report to Excel Report
rml report excel
Avatar
Avatar
Avatar
2
kvě 18
6645
Komunita
  • Tutoriály
  • Dokumentace
  • Fórum
Open Source
  • Stáhnout
  • Github
  • Runbot
  • Překlady
Služby
  • Odoo.sh hostování
  • Podpora
  • Upgrade
  • Nestandardní vývoj
  • Edukační program
  • Najít účetní
  • Najít partnera
  • Stát se partnerem
O nás
  • Naše společnost
  • Podklady značky
  • Kontakujte nás
  • Práce
  • Události
  • Podcast
  • Blog
  • Zákazníci
  • Právní dokumenty • Soukromí
  • Zabezpečení
الْعَرَبيّة 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 je balíček open-source aplikací, které pokrývají všechny potřeby vaší společnosti: CRM, e-shop, účetnictví, sklady, kasy, projektové řízení a další.

Unikátní nabídka od Odoo poskytuje velmi jednoduché uživatelské rozhraní a vše je integrované na jednom místě.

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