Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

How to download Excel File in Odoo

Naroči se

Get notified when there's activity on this post

This question has been flagged
xmlreportsexceljsodoo11
2 Odgovori
10616 Prikazi
Avatar
Gagandeep Kaur

I Created two buttons one for creating excel file and one for downloading created excel file. My XML code:

<group string="Employee Attendance">
                                          <group>
                                      <button string="Generate Attendance" name="generate_attendance_file" type="object"/>
                                      </group>
                                      <group>
                                        <button string="Download Attendance File" name="download_attendance_file" type="download_file" />

                                          </group>
                                    </group>

And my Python code:

def generate_attendance_file(self):
        workbook = xlsxwriter.Workbook('test.xlsx')
        worksheet1 = workbook.add_worksheet('My 1')
        worksheet1.write('A1','Col 1')
        worksheet1.write('B1','Col 2')
        worksheet1.write('C1','Col 3')
        db = pyodbc.connect('DRIVER={SQL Server};SERVER=OWNER-PC\SQLEXPRESS;DATABASE=etimetracklite;UID=test;PWD=rimt')
        cursor = db.cursor()
        sql = "select StatusCode from AttendanceLogs where EmployeeId='3010' AND AttendanceDate Between '2018-11-1' AND '2018-11-14'"
        cursor.execute(sql)
        results = cursor.fetchall()
        i = 2;
        for row in results:
            worksheet1.write('A' + str(i), row[0])
            i += 1
        bold = workbook.add_format({'bold': True})
        db.close()
        workbook.close()


   
    @api.multi
    def download_attendance_file(self):
        wb = xlrd.open_workbook('test.xlsx')
        output = io.Bytes()
        workbook.save(output)
        output.seek(0)
        data = output.read()
        return data

But I have following issue in downloading button:

Error:
TypeError: this.do_execute_action(...) is undefined

http://localhost:8069/web/content/1960-cc3f4ba/web.assets_backend.js:469
Traceback:
execute_action@http://localhost:8069/web/content/1960-cc3f4ba/web.assets_backend.js:469:620
proxy/<@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:3923:8
trigger@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:3921:166
_trigger_up@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:3927:340
_trigger_up@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:3927:442
trigger_up@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:3927:275
_callButtonAction@http://localhost:8069/web/content/1960-cc3f4ba/web.assets_backend.js:1310:1689
saveAndExecuteAction/<@http://localhost:8069/web/content/1960-cc3f4ba/web.assets_backend.js:1412:648
then/</</<@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:802:678
fire@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:796:281
add@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:797:467
then/</<@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:802:649
each@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:625:758
then/<@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:802:553
Deferred@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:803:189
then@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:802:518
saveAndExecuteAction@http://localhost:8069/web/content/1960-cc3f4ba/web.assets_backend.js:1412:577
_onButtonClicked@http://localhost:8069/web/content/1960-cc3f4ba/web.assets_backend.js:1413:340
proxy/<@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:3923:8
trigger@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:3921:166
_trigger_up@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:3927:340
_trigger_up@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:3927:442
trigger_up@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:3927:275
_addOnClickAction/<@http://localhost:8069/web/content/1960-cc3f4ba/web.assets_backend.js:1372:329
dispatch@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:892:378
add/elemData.handle@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:865:151

0
Avatar
Opusti
Avatar
Manish Bohra
Best Answer

Hello,

Check below code for how to create xls report

class SalesXlsx(ReportXlsx):

    def generate_xlsx_report(self, workbook, data, sales_order):
        sheet = workbook.add_worksheet('Sales Customer Report')
        bold = workbook.add_format({'bold': True})
        sheet.write(0, 0, 'Customer', bold)
        sheet.write(0, 1, 'Number', bold)
        for index, obj in enumerate(rental):
            index = index+1
            if obj.partner_id:sheet.write(index, 0, obj.partner_id)
            if obj.telephone:sheet.write(index, 1, obj.telephone)
           
RentalXlsx('sale.order.xlsx', 'sale.order')


May Be it's help you.

4
Avatar
Opusti
Avatar
Gagandeep Kaur
Avtor Best Answer

same error

Error:
TypeError: this.do_execute_action(...) is undefined

http://localhost:8069/web/content/1960-cc3f4ba/web.assets_backend.js:469
Traceback:
execute_action@http://localhost:8069/web/content/1960-cc3f4ba/web.assets_backend.js:469:620
proxy/<@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:3923:8
trigger@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:3921:166
_trigger_up@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:3927:340
_trigger_up@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:3927:442
trigger_up@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:3927:275
_callButtonAction@http://localhost:8069/web/content/1960-cc3f4ba/web.assets_backend.js:1310:1689
saveAndExecuteAction/<@http://localhost:8069/web/content/1960-cc3f4ba/web.assets_backend.js:1412:648
then/</</<@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:802:678
fire@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:796:281
add@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:797:467
then/</<@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:802:649
each@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:625:758
then/<@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:802:553
Deferred@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:803:189
then@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:802:518
saveAndExecuteAction@http://localhost:8069/web/content/1960-cc3f4ba/web.assets_backend.js:1412:577
_onButtonClicked@http://localhost:8069/web/content/1960-cc3f4ba/web.assets_backend.js:1413:340
proxy/<@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:3923:8
trigger@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:3921:166
_trigger_up@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:3927:340
_trigger_up@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:3927:442
trigger_up@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:3927:275
_addOnClickAction/<@http://localhost:8069/web/content/1960-cc3f4ba/web.assets_backend.js:1372:329
dispatch@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:892:378
add/elemData.handle@http://localhost:8069/web/content/1723-e9a3b9f/web.assets_common.js:865:151

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

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

Prijavi
Related Posts Odgovori Prikazi Aktivnost
Displaying Latitude and Longitude using js, in odoo 11 form.
xml js python3 odoo11
Avatar
Avatar
Avatar
2
sep. 18
7989
Widget creation error in odoo 11
javascript xml widget js odoo11
Avatar
Avatar
1
jan. 19
6137
How to save excel file with the name or id of currently logged user in odoo v11
filename report reports excel odoo11
Avatar
0
dec. 18
4244
Cannot download report with .xls extension Odoo 11.0
reporting report reports excel odoo11
Avatar
Avatar
Avatar
2
apr. 18
8388
How to get field value from javascript to odoo form view in odoo 11 Solved
js odoo11
Avatar
Avatar
Avatar
4
dec. 23
18467
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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