Zum Inhalt springen
Odoo Menü
  • Anmelden
  • Jetzt gratis testen
  • Apps
    Finanzen
    • Buchhaltung
    • Rechnungsstellung
    • Spesenabrechnung
    • Tabellenkalkulation (BI)
    • Dokumente
    • E-Signatur
    Vertrieb
    • CRM
    • Vertrieb
    • Kassensystem – Shop
    • Kassensystem – Restaurant
    • Abonnements
    • Vermietung
    Websites
    • Website-Builder
    • E-Commerce
    • Blog
    • Forum
    • Livechat
    • E-Learning
    Lieferkette
    • Lager
    • Fertigung
    • PLM
    • Einkauf
    • Wartung
    • Qualität
    Personalwesen
    • Mitarbeiter
    • Personalbeschaffung
    • Abwesenheiten
    • Mitarbeiterbeurteilung
    • Personalempfehlungen
    • Fuhrpark
    Marketing
    • Social Marketing
    • E-Mail-Marketing
    • SMS-Marketing
    • Veranstaltungen
    • Marketing-Automatisierung
    • Umfragen
    Dienstleistungen
    • Projekte
    • Zeiterfassung
    • Außendienst
    • Kundendienst
    • Planung
    • Termine
    Produktivität
    • Dialog
    • Genehmigungen
    • IoT
    • VoIP
    • Wissensdatenbank
    • WhatsApp
    Apps von Drittanbietern Odoo Studio Odoo Cloud-Plattform
  • Branchen
    Einzelhandel
    • Buchladen
    • Kleidergeschäft
    • Möbelhaus
    • Lebensmittelgeschäft
    • Baumarkt
    • Spielwarengeschäft
    Essen & Gastgewerbe
    • Bar und Kneipe
    • Restaurant
    • Fast Food
    • Gästehaus
    • Getränkehändler
    • Hotel
    Immobilien
    • Immobilienagentur
    • Architekturbüro
    • Baugewerbe
    • Immobilienverwaltung
    • Gartenarbeit
    • Eigentümervereinigung
    Beratung
    • Buchhaltungsfirma
    • Odoo-Partner
    • Marketingagentur
    • Anwaltskanzlei
    • Talentakquise
    • Prüfung & Zertifizierung
    Fertigung
    • Textil
    • Metall
    • Möbel
    • Speisen
    • Brauerei
    • Firmengeschenke
    Gesundheit & Fitness
    • Sportklub
    • Brillengeschäft
    • Fitnessstudio
    • Therapeut
    • Apotheke
    • Friseursalon
    Handel
    • Handyman
    • IT-Hardware & -Support
    • Solarenergiesysteme
    • Schuster
    • Reinigungsdienstleistungen
    • HLK-Dienstleistungen
    Sonstiges
    • Gemeinnützige Organisation
    • Umweltschutzagentur
    • Plakatwandvermietung
    • Fotostudio
    • Fahrrad-Leasing
    • Software-Händler
    Alle Branchen ansehen
  • Community
    Lernen
    • Tutorials
    • Dokumentation
    • Zertifizierungen
    • Schulung
    • Blog
    • Podcast
    Bildung fördern
    • Bildungsprogramm
    • Scale-Up! Planspiel
    • Odoo besuchen
    Software anfragen
    • Herunterladen
    • Editionen vergleichen
    • Releases
    Zusammenarbeiten
    • Github
    • Forum
    • Veranstaltungen
    • Übersetzungen
    • Partner werden
    • Dienstleistungen für Partner
    • Buchhaltungsfirma registrieren
    Services anfragen
    • Partner finden
    • Buchhalter finden
    • Einen Experten treffen
    • Implementierungsservices
    • Kundenreferenzen
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Eine Demo erhalten
  • Preiskalkulation
  • Hilfe

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

  • CRM
  • e-Commerce
  • Buchhaltung
  • Lager
  • PoS
  • Projekte
  • MRP
All apps
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Hilfe

Is it possible to make a file in .txt format?

Abonnieren

Erhalten Sie eine Benachrichtigung, wenn es eine Aktivität zu diesem Beitrag gibt

Diese Frage wurde gekennzeichnet
exportprintfiletxt
9 Antworten
12517 Ansichten
Avatar
Deborah Joy Adeva

wanted to export a txt file but whenever I made one it is downloaded in the server.

Is it possible to print/download it like qweb report where it is saved in the /downloads of the pc you're using.

0
Avatar
Verwerfen
Dan Čermák

I think this should be possible in the following way: you save the file on your server and generate a new http route that will send the file to the user. See: https://www.odoo.com/documentation/9.0/reference/http.html (the v10 documentation is pretty scarce). There might be a better way though and I have never done something like that, so no guarantees, that it will work.

Avatar
Jainesh Shah(Aktiv Software)
Beste Antwort
Hello, 

You can try below code for downloading your file as odoo default report (sale order report)

f_read = Your test file # Test file 
file_data = f_read.read()
#Pass your text file data using encoding.
values = {
            'name': "Name of text file.txt",
            'datas_fname': 'print_file_name.txt',
            'res_model': 'ir.ui.view',
            'res_id': False,
            'type': 'binary',
            'public': True,
            'datas': file_data.encode('utf8').encode('base64'),
        }
Using your data create as attachment
attachment_id = self.env['ir.attachment'].sudo().create(values)
#Prepare your download URL
download_url = '/web/content/' + str(\attachment_id.id) + '?download=True'
base_url = self.env['ir.config_parameter'].get_param('web.base.url')
Return so it will download in your system
return {
        "type": "ir.actions.act_url",
        "url": str(base_url)  +  str(download_url),
        "target": "new",
     }

Hope this will help you!
Thanks.
4
Avatar
Verwerfen
Deborah Joy Adeva
Autor

i've tested your code, but whenever i tried to print whats inside 'file_data', it prints nothing. does it mean that theres no data passed in 'file_data'?

Deborah Joy Adeva
Autor

It already worked. thank you so much.

Deborah Joy Adeva
Autor

Now I'm trying to put multiple rows in my txt file. but instead of making a new line, it's just in one line/row. what should I do? is the line: 'datas': file_data.encode('utf8').encode('base64'),

gave that result? I used \n and \t, I tried printing the file_data and it has the right output but in the txt file downloaded it's in one line only. thank you so much for helping me.

Jainesh Shah(Aktiv Software)

Are you trying write using python code then you can put code like this,

f_read.write("\tTest line\n") It will evaluate "\n",

And if you are using exisiting ".text" file then no need to write "\n" simply put your lines as per your format.

After encoding, you can see your file content using decode as below.

data_encode = file_data.encode('utf8').encode('base64')

data_decode = data_encode.decode('base64','strict').

Hope this will help you.

Deborah Joy Adeva
Autor

Hello.. should I put it in the values {} ?

I don't know where I should put

data_encode = file_data.encode('utf8').encode('base64')

data_decode = data_encode.decode('base64','strict')

thanks in advance.

Deborah Joy Adeva
Autor

Hello, I still have the same problem and when I tried that one it shows 'Incorrect padding' error.

Avatar
DaSchloz
Beste Antwort

Aktiv Softwares solution worked for me with one twist: 

import base64

...
base64.b64encode(file_data.encode('utf8'))


0
Avatar
Verwerfen
Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!

Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!

Registrieren
Verknüpfte Beiträge Antworten Ansichten Aktivität
Syntax Error When Printing Quotes
export print
Avatar
0
März 15
4950
How to generate a txt file and save it to Downloads directory
python file txt
Avatar
0
Sept. 17
6012
Export or Print Inventory on Hand as of 1/1/22 - Odoo 14EE Gelöst
export print inventory reporting
Avatar
Avatar
1
Apr. 22
2737
A way to print/export reports from reporting module
export print csv report
Avatar
Avatar
Avatar
2
Nov. 15
7882
create export csv file with new button
export create csv file
Avatar
Avatar
1
März 15
7054
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Herunterladen
  • Github
  • Runbot
  • Übersetzungen
Dienstleistungen
  • Odoo.sh-Hosting
  • Support
  • Upgrade
  • Individuelle Entwicklungen
  • Bildung
  • Buchhalter finden
  • Partner finden
  • Partner werden
Über uns
  • Unsere Firma
  • Markenwerte
  • Kontakt
  • Karriere
  • Veranstaltungen
  • Podcast
  • Blog
  • Kunden
  • Rechtliches • Datenschutz
  • Sicherheit
الْعَرَبيّة 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 ist eine Suite von Open-Source-Betriebsanwendungen, die alle Bedürfnisse Ihres Unternehmens abdecken: CRM, E-Commerce, Buchhaltung, Lager, Kassensystem, Projektmanagement etc.

Das einzigartige Wertversprechen von Odoo ist, dass es gleichzeitig sehr einfach zu bedienen und voll integriert ist.

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