Browse Source

update

pull/6/head
Mathias Markl 7 years ago
parent
commit
07a0420765
  1. 1
      muk_converter/__init__.py
  2. 4
      muk_converter/__manifest__.py
  3. 5
      muk_converter/doc/changelog.rst
  4. 678
      muk_converter/i18n/de.po
  5. 676
      muk_converter/i18n/muk_converter.pot
  6. 3
      muk_converter/security/ir.model.access.csv
  7. 55
      muk_converter/service/unoconv.py
  8. 6
      muk_converter/tools/converter.py
  9. 72
      muk_converter/views/convert.xml
  10. 20
      muk_converter/wizards/__init__.py
  11. 109
      muk_converter/wizards/convert.py

1
muk_converter/__init__.py

@ -20,3 +20,4 @@
from . import service
from . import tools
from . import models
from . import wizards

4
muk_converter/__manifest__.py

@ -20,7 +20,7 @@
{
"name": "MuK Converter",
"summary": """Universal Converter""",
"version": '11.0.1.0.0',
"version": '11.0.1.1.0',
"category": 'Extra Tools',
"license": "AGPL-3",
"website": "https://www.mukit.at",
@ -34,6 +34,8 @@
"muk_fields_lobject",
],
"data": [
"security/ir.model.access.csv",
"views/convert.xml",
"data/params.xml",
],
"qweb": [

5
muk_converter/doc/changelog.rst

@ -1,3 +1,8 @@
`1.1.0`
-------
- Added converter wizard
`1.0.0`
-------

678
muk_converter/i18n/de.po

@ -0,0 +1,678 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * muk_converter
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-05-17 19:15+0000\n"
"PO-Revision-Date: 2018-05-17 21:18+0200\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: \n"
"Language: de\n"
"X-Generator: Poedit 2.0.6\n"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "BIB"
msgstr "BIB"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "BMP"
msgstr "BMP"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "CSV"
msgstr "CSV"
#. module: muk_converter
#: model:ir.ui.view,arch_db:muk_converter.view_converter_convert_form
msgid "Cancel"
msgstr "Abbrechen"
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_checksum
msgid "Checksum"
msgstr "Checksum"
#. module: muk_converter
#: model:ir.ui.view,arch_db:muk_converter.view_converter_convert_form
msgid "Close"
msgstr "Schließen"
#. module: muk_converter
#: model:ir.ui.view,arch_db:muk_converter.view_converter_convert_form
msgid "Conversion Complete"
msgstr "Konvertierung abgeschlossen"
#. module: muk_converter
#: model:ir.ui.view,arch_db:muk_converter.view_converter_convert_form
msgid "Convert"
msgstr "Konvertieren"
#. module: muk_converter
#: code:addons/muk_converter/wizards/convert.py:86
#: model:ir.actions.act_window,name:muk_converter.action_converter_convert
#: model:ir.ui.view,arch_db:muk_converter.view_converter_convert_form
#, python-format
msgid "Convert File"
msgstr "Konverter Datei"
#. module: muk_converter
#: model:ir.model,name:muk_converter.model_muk_converter_converter
msgid "Converter"
msgstr "Konverter"
#. module: muk_converter
#: model:ir.model,name:muk_converter.model_muk_converter_store
msgid "Converter Store"
msgstr "Konverter Speicher"
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_create_uid
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_create_uid
msgid "Created by"
msgstr "Erstellt von"
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_create_date
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_create_date
msgid "Created on"
msgstr "Erstellt am"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "DBF"
msgstr "DBF"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "DIF"
msgstr "DIF"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "DOC"
msgstr "DOC"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "DOC6"
msgstr "DOC6"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "DOC95"
msgstr "DOC95"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "DOCBOOK"
msgstr "DOCBOOK"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "DOCX"
msgstr "DOCX"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "DOCX7"
msgstr "DOCX7"
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_content
msgid "Data"
msgstr "Persönliche Daten"
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_display_name
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_converter_display_name
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_display_name
msgid "Display Name"
msgstr "Anzeigename"
#. module: muk_converter
#: selection:muk_converter.convert,state:0
msgid "Download"
msgstr "Download"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "EMF"
msgstr "EMF"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "EPS"
msgstr "EPS"
#. module: muk_converter
#: model:ir.model.fields,help:muk_converter.field_muk_converter_convert_type
msgid "Either a binary file or an url can be converted"
msgstr "Es kann entweder eine Binärdatei oder eine URL konvertiert werden."
#. module: muk_converter
#: selection:muk_converter.convert,state:0
msgid "Export"
msgstr "Export"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "FODG"
msgstr "FODG"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "FODP"
msgstr "FODP"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "FODS"
msgstr "FODS"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "FODT"
msgstr "FODT"
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_input_binary
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_output_binary
#: selection:muk_converter.convert,type:0
msgid "File"
msgstr "Datei"
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_input_name
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_output_name
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_content_fname
msgid "Filename"
msgstr "Dateiname"
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_format
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_format
msgid "Format"
msgstr "Format"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "GIF"
msgstr "GIF"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "HTML"
msgstr "HTML"
#. module: muk_converter
#: model:ir.ui.view,arch_db:muk_converter.view_converter_convert_form
msgid "Here is the converted file:"
msgstr "Hier ist die konvertierte Datei:"
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_id
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_converter_id
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_id
msgid "ID"
msgstr "ID"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "JPG"
msgstr "JPG"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "LATEX"
msgstr "LATEX"
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert___last_update
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_converter___last_update
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store___last_update
msgid "Last Modified on"
msgstr "Zuletzt geändert am"
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_write_uid
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_write_uid
msgid "Last Updated by"
msgstr "Zuletzt aktualisiert durch"
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_write_date
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_write_date
msgid "Last Updated on"
msgstr "Zuletzt aktualisiert am"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "MEDIAWIKI"
msgstr "MEDIAWIKI"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "MET"
msgstr "MET"
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_name
msgid "Name"
msgstr "Name"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "ODD"
msgstr "ODD"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "ODG"
msgstr "ODG"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "ODP"
msgstr "ODP"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "ODS"
msgstr "ODS"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "ODT"
msgstr "ODT"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "OOXML"
msgstr "OOXML"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "OTG"
msgstr "OTG"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "OTP"
msgstr "OTP"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "OTS"
msgstr "OTS"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "OTT"
msgstr "OTT"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PBM"
msgstr "PBM"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PCT"
msgstr "PCT"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PDB"
msgstr "PDB"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PDF"
msgstr "PDF"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PGM"
msgstr "PGM"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PNG"
msgstr "PNG"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "POT"
msgstr "POT"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "POTM"
msgstr "POTM"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PPM"
msgstr "PPM"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PPS"
msgstr "PPS"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PPT"
msgstr "PPT"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PPTX"
msgstr "PPTX"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PSW"
msgstr "PSW"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PWP"
msgstr "PWP"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PXL"
msgstr "PXL"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "RAS"
msgstr "RAS"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "RTF"
msgstr "RTF"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SDA"
msgstr "SDA"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SDC"
msgstr "SDC"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SDC3"
msgstr "SDC3"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SDC4"
msgstr "SDC4"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SDD"
msgstr "SDD"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SDD3"
msgstr "SDD3"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SDD4"
msgstr "SDD4"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SDW"
msgstr "SDW"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SDW3"
msgstr "SDW3"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SDW4"
msgstr "SDW4"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SLK"
msgstr "SLK"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "STC"
msgstr "STC"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "STD"
msgstr "STD"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "STI"
msgstr "STI"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "STW"
msgstr "STW"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SVG"
msgstr "SVG"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SVM"
msgstr "SVM"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SWF"
msgstr "SWF"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SXC"
msgstr "SXC"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SXD"
msgstr "SXD"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SXD3"
msgstr "SXD3"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SXD5"
msgstr "SXD5"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SXI"
msgstr "SXI"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SXW"
msgstr "SXW"
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_state
msgid "State"
msgstr "Status"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "TEXT"
msgstr "TEXT"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "TIFF"
msgstr "TIFF"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "TXT"
msgstr "TXT"
#. module: muk_converter
#: model:ir.ui.view,arch_db:muk_converter.view_converter_convert_form
msgid ""
"The file has been successfully converted and can now be used.\n"
"\t\t\t\t\t\tYou can download the file by clicking on the link below."
msgstr "Die Datei wurde erfolgreich konvertiert und kann nun verwendet werden. Mit einem Klick auf den angeführten Link kann die Datei heruntergeladen werden."
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_type
msgid "Type"
msgstr "Typ"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "UOP"
msgstr "UOP"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "UOS"
msgstr "UOS"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "UOT"
msgstr "UOT"
#. module: muk_converter
#: selection:muk_converter.convert,type:0
msgid "URL"
msgstr "URL"
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_input_url
msgid "Url"
msgstr "URL"
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_used_date
msgid "Used on"
msgstr "Used on"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "VOR"
msgstr "VOR"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "VOR3"
msgstr "VOR3"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "VOR4"
msgstr "VOR4"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "VOR5"
msgstr "VOR5"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "WMF"
msgstr "WMF"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "WPS"
msgstr "WPS"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "XHTML"
msgstr "XHTML"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "XLS"
msgstr "XLS"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "XLS5"
msgstr "XLS5"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "XLS95"
msgstr "XLS95"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "XLSX"
msgstr "XLSX"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "XLT"
msgstr "XLT"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "XLT5"
msgstr "XLT5"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "XLT95"
msgstr "XLT95"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "XPM"
msgstr "XPM"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "XPMBIB"
msgstr "XPMBIB"
#. module: muk_converter
#: model:ir.model,name:muk_converter.model_ir_autovacuum
msgid "ir.autovacuum"
msgstr "ir.autovacuum"
#. module: muk_converter
#: model:ir.model,name:muk_converter.model_muk_converter_convert
msgid "muk_converter.convert"
msgstr "muk_converter.convert"

676
muk_converter/i18n/muk_converter.pot

@ -0,0 +1,676 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * muk_converter
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-05-17 19:15+0000\n"
"PO-Revision-Date: 2018-05-17 19:15+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "BIB"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "BMP"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "CSV"
msgstr ""
#. module: muk_converter
#: model:ir.ui.view,arch_db:muk_converter.view_converter_convert_form
msgid "Cancel"
msgstr ""
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_checksum
msgid "Checksum"
msgstr ""
#. module: muk_converter
#: model:ir.ui.view,arch_db:muk_converter.view_converter_convert_form
msgid "Close"
msgstr ""
#. module: muk_converter
#: model:ir.ui.view,arch_db:muk_converter.view_converter_convert_form
msgid "Conversion Complete"
msgstr ""
#. module: muk_converter
#: model:ir.ui.view,arch_db:muk_converter.view_converter_convert_form
msgid "Convert"
msgstr ""
#. module: muk_converter
#: code:addons/muk_converter/wizards/convert.py:86
#: model:ir.actions.act_window,name:muk_converter.action_converter_convert
#: model:ir.ui.view,arch_db:muk_converter.view_converter_convert_form
#, python-format
msgid "Convert File"
msgstr ""
#. module: muk_converter
#: model:ir.model,name:muk_converter.model_muk_converter_converter
msgid "Converter"
msgstr ""
#. module: muk_converter
#: model:ir.model,name:muk_converter.model_muk_converter_store
msgid "Converter Store"
msgstr ""
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_create_uid
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_create_uid
msgid "Created by"
msgstr ""
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_create_date
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_create_date
msgid "Created on"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "DBF"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "DIF"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "DOC"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "DOC6"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "DOC95"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "DOCBOOK"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "DOCX"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "DOCX7"
msgstr ""
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_content
msgid "Data"
msgstr ""
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_display_name
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_converter_display_name
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_display_name
msgid "Display Name"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,state:0
msgid "Download"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "EMF"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "EPS"
msgstr ""
#. module: muk_converter
#: model:ir.model.fields,help:muk_converter.field_muk_converter_convert_type
msgid "Either a binary file or an url can be converted"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,state:0
msgid "Export"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "FODG"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "FODP"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "FODS"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "FODT"
msgstr ""
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_input_binary
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_output_binary
#: selection:muk_converter.convert,type:0
msgid "File"
msgstr ""
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_input_name
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_output_name
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_content_fname
msgid "Filename"
msgstr ""
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_format
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_format
msgid "Format"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "GIF"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "HTML"
msgstr ""
#. module: muk_converter
#: model:ir.ui.view,arch_db:muk_converter.view_converter_convert_form
msgid "Here is the converted file:"
msgstr ""
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_id
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_converter_id
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_id
msgid "ID"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "JPG"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "LATEX"
msgstr ""
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert___last_update
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_converter___last_update
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store___last_update
msgid "Last Modified on"
msgstr ""
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_write_uid
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_write_uid
msgid "Last Updated by"
msgstr ""
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_write_date
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_write_date
msgid "Last Updated on"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "MEDIAWIKI"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "MET"
msgstr ""
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_name
msgid "Name"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "ODD"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "ODG"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "ODP"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "ODS"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "ODT"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "OOXML"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "OTG"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "OTP"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "OTS"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "OTT"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PBM"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PCT"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PDB"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PDF"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PGM"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PNG"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "POT"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "POTM"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PPM"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PPS"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PPT"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PPTX"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PSW"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PWP"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "PXL"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "RAS"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "RTF"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SDA"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SDC"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SDC3"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SDC4"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SDD"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SDD3"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SDD4"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SDW"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SDW3"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SDW4"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SLK"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "STC"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "STD"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "STI"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "STW"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SVG"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SVM"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SWF"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SXC"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SXD"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SXD3"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SXD5"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SXI"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "SXW"
msgstr ""
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_state
msgid "State"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "TEXT"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "TIFF"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "TXT"
msgstr ""
#. module: muk_converter
#: model:ir.ui.view,arch_db:muk_converter.view_converter_convert_form
msgid "The file has been successfully converted and can now be used.\n"
" You can download the file by clicking on the link below."
msgstr ""
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_type
msgid "Type"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "UOP"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "UOS"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "UOT"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,type:0
msgid "URL"
msgstr ""
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_convert_input_url
msgid "Url"
msgstr ""
#. module: muk_converter
#: model:ir.model.fields,field_description:muk_converter.field_muk_converter_store_used_date
msgid "Used on"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "VOR"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "VOR3"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "VOR4"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "VOR5"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "WMF"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "WPS"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "XHTML"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "XLS"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "XLS5"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "XLS95"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "XLSX"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "XLT"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "XLT5"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "XLT95"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "XPM"
msgstr ""
#. module: muk_converter
#: selection:muk_converter.convert,format:0
msgid "XPMBIB"
msgstr ""
#. module: muk_converter
#: model:ir.model,name:muk_converter.model_ir_autovacuum
msgid "ir.autovacuum"
msgstr ""
#. module: muk_converter
#: model:ir.model,name:muk_converter.model_muk_converter_convert
msgid "muk_converter.convert"
msgstr ""

3
muk_converter/security/ir.model.access.csv

@ -0,0 +1,3 @@
id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink
access_muk_converter_store,access_muk_converter_store,model_muk_converter_store,base.group_erp_manager,1,1,1,1

55
muk_converter/service/unoconv.py

@ -38,27 +38,52 @@ from odoo.tools.mimetypes import guess_mimetype
_logger = logging.getLogger(__name__)
FORMATS = [
"bib", "doc", "doc6", "doc95", "docbook", "docx", "docx7", "fodt", "html", "latex", "mediawiki",
"odt", "ooxml", "ott", "pdb", "pdf", "psw", "rtf", "sdw", "sdw4", "sdw3", "stw", "sxw", "text",
"txt", "uot", "vor", "vor4", "vor3", "wps", "xhtml", "bmp", "emf", "eps", "fodg", "gif", "html",
"jpg", "met", "odd", "otg", "pbm", "pct", "pdf", "pgm", "png", "ppm", "ras", "std", "svg", "svm",
"swf", "sxd", "sxd3", "sxd5", "sxw", "tiff", "vor", "vor3", "wmf", "xhtml", "xpm", "bmp", "emf",
"eps", "fodp", "gif", "html", "jpg", "met", "odg", "odp", "otp", "pbm", "pct", "pdf", "pgm", "png",
"potm", "pot", "ppm", "pptx", "pps", "ppt", "pwp", "ras", "sda", "sdd", "sdd3", "sdd4", "sxd",
"sti", "svg", "svm", "swf", "sxi", "tiff", "uop", "vor", "vor3", "vor4", "vor5", "wmf", "xhtml",
"xpm", "csv", "dbf", "dif", "fods", "html", "ods", "ooxml", "ots", "pdf", "pxl", "sdc", "sdc4",
"sdc3", "slk", "stc", "sxc", "uos", "vor3", "vor4", "vor", "xhtml", "xls", "xls5", "xls95", "xlt",
"xlt5", "xlt95", "xlsx",
"bib", "bmp", "csv", "dbf", "dif", "doc", "doc6", "doc95", "docbook", "docx", "docx7", "emf",
"eps", "fodg", "fodp", "fods", "fodt", "gif", "html", "jpg", "latex", "mediawiki", "met", "odd",
"odg", "odp", "ods", "odt", "ooxml", "otg", "otp", "ots", "ott", "pbm", "pct", "pdb", "pdf", "pgm",
"png", "pot", "potm", "ppm", "pps", "ppt", "pptx", "psw", "pwp", "pxl", "ras", "rtf", "sda", "sdc",
"sdc3", "sdc4", "sdd", "sdd3", "sdd4", "sdw", "sdw3", "sdw4", "slk", "stc", "std", "sti", "stw",
"svg", "svm", "swf", "sxc", "sxd", "sxd3", "sxd5", "sxi", "sxw", "text", "tiff", "txt", "uop", "uos",
"uot", "vor", "vor3", "vor4", "vor5", "wmf", "wps", "xhtml", "xls", "xls5", "xls95", "xlsx", "xlt",
"xlt5", "xlt95", "xpm""bib", "bmp", "csv", "dbf", "dif", "doc", "doc6", "doc95", "docbook", "docx",
"docx7", "emf", "eps", "fodg", "fodp", "fods", "fodt", "gif", "html", "jpg", "latex", "mediawiki",
"met", "odd", "odg", "odp", "ods", "odt", "ooxml", "otg", "otp", "ots", "ott", "pbm", "pct", "pdb",
"pdf", "pgm", "png", "pot", "potm", "ppm", "pps", "ppt", "pptx", "psw", "pwp", "pxl", "ras", "rtf",
"sda", "sdc", "sdc3", "sdc4", "sdd", "sdd3", "sdd4", "sdw", "sdw3", "sdw4", "slk", "stc", "std",
"sti", "stw", "svg", "svm", "swf", "sxc", "sxd", "sxd3", "sxd5", "sxi", "sxw", "text", "tiff",
"txt", "uop", "uos", "uot", "vor", "vor3", "vor4", "vor5", "wmf", "wps", "xhtml", "xls", "xls5",
"xls95", "xlsx", "xlt", "xlt5", "xlt95", "xpm"
]
IMPORTS = [
"bmp", "csv", "dbf", "dif", "doc", "docx", "dot", "emf", "eps", "epub", "fodg", "fodp", "fods",
"fodt", "gif", "gnm", "gnumeric", "htm", "html", "jpeg", "jpg", "met", "mml", "odb", "odf", "odg",
"odp", "ods", "odt", "pbm", "pct", "pdb", "pdf", "pgm", "png", "pot", "ppm", "pps", "ppt", "pptx",
"psw", "pxl", "ras", "rtf", "sda", "sdc", "sdd", "sdp", "sdw", "sgl", "slk", "stc", "std", "sti",
"stw", "svg", "svm", "swf", "sxc", "sxd", "sxi", "sxm", "sxw", "tif", "tiff", "txt", "uof", "uop",
"uos", "uot", "vor", "wmf", "wri", "xls", "xlsx", "xlt", "xlw", "xml", "xpm""bmp", "csv", "dbf",
"dif", "doc", "docx", "dot", "emf", "eps", "epub", "fodg", "fodp", "fods", "fodt", "gif", "gnm",
"gnumeric", "htm", "html", "jpeg", "jpg", "met", "mml", "odb", "odf", "odg", "odp", "ods", "odt",
"pbm", "pct", "pdb", "pdf", "pgm", "png", "pot", "ppm", "pps", "ppt", "pptx", "psw", "pxl", "ras",
"rtf", "sda", "sdc", "sdd", "sdp", "sdw", "sgl", "slk", "stc", "std", "sti", "stw", "svg", "svm",
"swf", "sxc", "sxd", "sxi", "sxm", "sxw", "tif", "tiff", "txt", "uof", "uop", "uos", "uot", "vor",
"wmf", "wri", "xls", "xlsx", "xlt", "xlw", "xml", "xpm"
]
def formats():
return FORMATS
def imports():
return IMPORTS
def unoconv_environ():
env = os.environ.copy()
uno_path = config.get('uno_path', False)
if uno_path:
env['UNO_PATH'] = config['uno_path']
env['UNO_PATH'] = "C:\\Program Files\\LibreOffice 5\\program"
return env
def convert(input_path, output_path, doctype="document", format="pdf"):
@ -103,9 +128,9 @@ def convert_binary(binary, mimetype=None, filename=None, export="binary", doctyp
"""
def get_extension(filename, mimetype):
if not filename and mimetype:
return mimetypes.guess_extension(mimetype)
return mimetypes.guess_extension(mimetype)[1:].strip().lower()
elif filename:
return os.path.splitext(filename)[1]
return os.path.splitext(filename)[1][1:].strip().lower()
return None
if not mimetype and not filename:
mimetype = guess_mimetype(binary, default=False)
@ -116,9 +141,11 @@ def convert_binary(binary, mimetype=None, filename=None, export="binary", doctyp
raise ValueError("The file extension could not be determined.")
if format not in FORMATS:
raise ValueError("Invalid export format.")
if extension not in IMPORTS:
raise ValueError("Invalid import format.")
tmp_dir = tempfile.mkdtemp()
try:
tmp_wpath = os.path.join(tmp_dir, "tmpfile" + extension)
tmp_wpath = os.path.join(tmp_dir, "tmpfile." + extension)
tmp_ppath = os.path.join(tmp_dir, "tmpfile." + format)
if os.name == 'nt':
tmp_wpath = tmp_wpath.replace("\\", "/")

6
muk_converter/tools/converter.py

@ -28,6 +28,12 @@ _logger = logging.getLogger(__name__)
def formats():
return unoconv.formats()
def selection_formats():
return list(map(lambda format: (format, format.upper()), unoconv.formats()))
def imports():
return unoconv.imports()
def convert(filename, content, format):
return unoconv.convert_binary(binary=content, filename=filename, format=format)

72
muk_converter/views/convert.xml

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2017 MuK IT GmbH
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<odoo>
<record id="view_converter_convert_form" model="ir.ui.view">
<field name="name">muk_converter_convert.form</field>
<field name="model">muk_converter.convert</field>
<field name="arch" type="xml">
<form string="Convert File">
<group states="export">
<field invisible="1" name="state" />
<group>
<field name="type" />
<field name="input_url" widget="url"
attrs="{'required':[('type','=','url')], 'invisible':[('type','=','binary')]}" />
<field name="input_name" invisible="1" />
<field name="input_binary" filename="input_name"
attrs="{'required':[('type','=','binary')], 'invisible':[('type','=','url')]}" />
</group>
<group>
<field name="format" />
</group>
</group>
<div states="download">
<field name="output_name" invisible="1" />
<h3>Conversion Complete</h3>
<p>The file has been successfully converted and can now be used.
You can download the file by clicking on the link below.
</p>
<p>
Here is the converted file: <field name="output_binary" filename="output_name"/>
</p>
</div>
<footer states="export">
<button name="convert" string="Convert" type="object" class="btn-primary" />
<button special="cancel" string="Cancel" type="object"
class="btn-default" />
</footer>
<footer states="download">
<button special="cancel" string="Close" type="object" class="btn-primary" />
</footer>
</form>
</field>
</record>
<record id="action_converter_convert" model="ir.actions.act_window">
<field name="name">Convert File</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">muk_converter.convert</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</odoo>

20
muk_converter/wizards/__init__.py

@ -0,0 +1,20 @@
###################################################################################
#
# Copyright (C) 2018 MuK IT GmbH
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###################################################################################
from . import convert

109
muk_converter/wizards/convert.py

@ -0,0 +1,109 @@
###################################################################################
#
# Copyright (C) 2017 MuK IT GmbH
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###################################################################################
import os
import base64
import uuid
import logging
import mimetypes
from odoo import _, api, fields, models
from odoo.addons.muk_utils.http import get_response
from odoo.addons.muk_converter.tools import converter
_logger = logging.getLogger(__name__)
class ConverterWizard(models.TransientModel):
_name = "muk_converter.convert"
state = fields.Selection(
selection=[("export", "Export"), ("download", "Download")],
string="State",
required=True,
default="export")
type = fields.Selection(
selection=[("url", "URL"), ("binary", "File")],
string="Type",
default="binary",
change_default=True,
states={'export': [('required', True)]},
help="Either a binary file or an url can be converted")
input_url = fields.Char(
string="Url")
input_name = fields.Char(
string="Filename")
input_binary = fields.Binary(
string="File")
format = fields.Selection(
selection=converter.selection_formats(),
string="Format",
default="pdf",
states={'export': [('required', True)]})
output_name = fields.Char(
string="Filename",
readonly=True,
states={'download': [('required', True)]})
output_binary = fields.Binary(
string="File",
readonly=True,
states={'download': [('required', True)]})
@api.multi
def convert(self):
def export(record, content, filename):
name = "%s.%s" % (os.path.splitext(filename)[0], record.format)
output = record.env['muk_converter.converter'].convert(filename, content)
record.write({
'state': 'download',
'output_name': name,
'output_binary': base64.b64encode(output)})
return {
"name": _("Convert File"),
'type': 'ir.actions.act_window',
'res_model': 'muk_converter.convert',
'view_mode': 'form',
'view_type': 'form',
'res_id': record.id,
'views': [(False, 'form')],
'target': 'new',
}
record = self[0]
if record.input_url:
status, headers, content = get_response(record.input_url)
if status != 200:
raise ValueError("Failed to retrieve the file from the url.")
else:
extension = mimetypes.guess_extension(headers['content-type'])[1:].strip().lower()
if extension not in converter.imports():
raise ValueError("Invalid import format.")
else:
return export(record, content, "%s.%s" % (uuid.uuid4(), extension))
elif record.input_name and record.input_binary:
return export(record, base64.b64decode(record.input_binary), record.input_name)
else:
raise ValueError("The conversion requires either a valid url or a filename and a file.")
Loading…
Cancel
Save