Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Guest House
    • Distributeur de boissons
    • Hotel
    Real Estate
    • Real Estate Agency
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consulting
    • Accounting Firm
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Solar Energy Systems
    • Cordonnier
    • Services de nettoyage
    • HVAC Services
    Others
    • Nonprofit Organization
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

How to download Excel File in Odoo

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
xmlreportsexceljsodoo11
2 Réponses
10606 Vues
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
Ignorer
Avatar
Manish Bohra
Meilleure réponse

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
Ignorer
Avatar
Gagandeep Kaur
Auteur Meilleure réponse

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
Ignorer
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
Displaying Latitude and Longitude using js, in odoo 11 form.
xml js python3 odoo11
Avatar
Avatar
Avatar
2
sept. 18
7980
Widget creation error in odoo 11
javascript xml widget js odoo11
Avatar
Avatar
1
janv. 19
6123
How to save excel file with the name or id of currently logged user in odoo v11
filename report reports excel odoo11
Avatar
0
déc. 18
4235
Cannot download report with .xls extension Odoo 11.0
reporting report reports excel odoo11
Avatar
Avatar
Avatar
2
avr. 18
8382
How to get field value from javascript to odoo form view in odoo 11 Résolu
js odoo11
Avatar
Avatar
Avatar
4
déc. 23
18463
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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