diff --git a/tools_mimetypes_extension/README.rst b/tools_mimetypes_extension/README.rst new file mode 100644 index 000000000..749ad30e6 --- /dev/null +++ b/tools_mimetypes_extension/README.rst @@ -0,0 +1,63 @@ +========================= +Tools mimetypes extension +========================= + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:4b68b8b8182323f53e3fdb17ef17999784ce96f5d117237669d95829646abbbb + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-NuoBiT%2Fodoo--addons-lightgray.png?logo=github + :target: https://github.com/NuoBiT/odoo-addons/tree/18.0/tools_mimetypes_extension + :alt: NuoBiT/odoo-addons + +|badge1| |badge2| |badge3| + +This module extend tools/mimetypes.py + +**Table of contents** + +.. contents:: + :local: + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues `_. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* NuoBiT Solutions SL + +Contributors +------------ + +- `NuoBiT `__: + + - Kilian Niubo kniubo@nuobit.com + - Deniz Gallo dgallo@nuobit.com + +Maintainers +----------- + +This module is part of the `NuoBiT/odoo-addons `_ project on GitHub. + +You are welcome to contribute. diff --git a/tools_mimetypes_extension/__init__.py b/tools_mimetypes_extension/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/tools_mimetypes_extension/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/tools_mimetypes_extension/__manifest__.py b/tools_mimetypes_extension/__manifest__.py new file mode 100644 index 000000000..f14b21b64 --- /dev/null +++ b/tools_mimetypes_extension/__manifest__.py @@ -0,0 +1,14 @@ +# Copyright NuoBiT Solutions - Kilian Niubo +# Copyright 2026 NuoBiT Solutions SL - Deniz Gallo +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) + +{ + "name": "Tools mimetypes extension", + "author": "NuoBiT Solutions SL", + "category": "Tools", + "version": "18.0.1.0.0", + "license": "AGPL-3", + "website": "https://github.com/NuoBiT/odoo-addons", + "depends": [], +} +# modificar a tools mimetypes extension diff --git a/tools_mimetypes_extension/models/__init__.py b/tools_mimetypes_extension/models/__init__.py new file mode 100644 index 000000000..1a9abe7e3 --- /dev/null +++ b/tools_mimetypes_extension/models/__init__.py @@ -0,0 +1 @@ +from . import mimetypes diff --git a/tools_mimetypes_extension/models/mimetypes.py b/tools_mimetypes_extension/models/mimetypes.py new file mode 100644 index 000000000..a59e838b2 --- /dev/null +++ b/tools_mimetypes_extension/models/mimetypes.py @@ -0,0 +1,443 @@ +# Copyright NuoBiT Solutions - Kilian Niubo +# Copyright 2026 NuoBiT Solutions SL - Deniz Gallo +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) +from odoo import _ +from odoo.exceptions import ValidationError +from odoo.tools import mimetypes + +_mimetype_file_extension = { + "application/atom+xml": ".atom", + "application/ecmascript": ".es", + "application/epub+zip": ".epub", + "application/gzip": ".gz", + "application/java-archive": ".jar", + "application/javascript": ".js", + "application/json": ".json", + "application/ld+json": ".jsonld", + "application/mac-binhex40": ".hqx", + "application/msword": ".doc", + "application/octet-stream": ".bin", + "application/ogg": ".ogx", + "application/pdf": ".pdf", + "application/postscript": ".ps", + "application/rtf": ".rtf", + "application/smil+xml": ".smi", + "application/vnd.amazon.ebook": ".azw", + "application/vnd.apple.installer+xml": ".mpkg", + "application/vnd.apple.mpegurl": ".m3u8", + "application/vnd.google-earth.kml+xml": ".kml", + "application/vnd.google-earth.kmz": ".kmz", + "application/vnd.mozilla.xul+xml": ".xul", + "application/vnd.ms-excel": ".xls", + "application/vnd.ms-powerpoint": ".ppt", + "application/vnd.oasis.opendocument.presentation": ".odp", + "application/vnd.oasis.opendocument.spreadsheet": ".ods", + "application/vnd.oasis.opendocument.text": ".odt", + "application/vnd.openxmlformats-officedocument.presentationml.presentation": ".pptx", # noqa: E501 + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": ".xlsx", + "application/vnd.openxmlformats-officedocument.wordprocessingml.document": ".docx", + "application/vnd.rar": ".rar", + "application/vnd.wap.wmlc": ".wmlc", + "application/x-7z-compressed": ".7z", + "application/x-7z": ".7z", + "application/x-ace-compressed": ".ace", + "application/x-ace": ".ace", + "application/x-alz": ".alz", + "application/x-apple-diskimage": ".dmg", + "application/x-ar": ".a", + "application/x-arc": ".arc", + "application/x-archive": ".a", + "application/x-arj": ".arj", + "application/x-awk": ".awk", + "application/x-bash": ".sh", + "application/x-bat": ".bat", + "application/x-bin": ".bin", + "application/x-binhex40": ".hqx", + "application/x-boo": ".boo", + "application/x-brotli": ".br", + "application/x-bzip-compressed-tar": ".tar.bz2", + "application/x-bzip": ".bz", + "application/x-bzip2": ".bz2", + "application/x-c++header": ".hpp", + "application/x-c++source": ".cpp", + "application/x-cab": ".cab", + "application/x-cdf": ".cdf", + "application/x-cheader": ".h", + "application/x-com": ".com", + "application/x-compress-compressed-tar": ".tar.Z", + "application/x-compress": ".Z", + "application/x-cpio": ".cpio", + "application/x-csh": ".csh", + "application/x-csharp": ".cs", + "application/x-csource": ".c", + "application/x-css": ".css", + "application/x-dar": ".dar", + "application/x-dash": ".sh", + "application/x-deb": ".deb", + "application/x-debian-package": ".deb", + "application/x-diskcopy": ".dsk", + "application/x-dms": ".dms", + "application/x-dvi": ".dvi", + "application/x-elf": ".elf", + "application/x-envoy": ".evy", + "application/x-eva": ".eva", + "application/x-fdisk": ".fdisk", + "application/x-font-eot": ".eot", + "application/x-font-opentype": ".otf", + "application/x-font-otf": ".otf", + "application/x-font-truetype": ".ttf", + "application/x-font-ttf": ".ttf", + "application/x-font-woff": ".woff", + "application/x-font-woff2": ".woff2", + "application/x-fractals": ".fif", + "application/x-freearc": ".arc", + "application/x-gtar": ".gtar", + "application/x-gzip-compressed-tar": ".tar.gz", + "application/x-gzip": ".gz", + "application/x-ha": ".ha", + "application/x-html": ".html", + "application/x-httpd-imap": ".imap", + "application/x-httpd-php-source": ".phps", + "application/x-httpd-php": ".php", + "application/x-httpd-php3": ".php3", + "application/x-httpd-php4": ".php4", + "application/x-httpd-php5": ".php5", + "application/x-hyper-v-vhd": ".vhd", + "application/x-iso": ".iso", + "application/x-iso9660-image": ".iso", + "application/x-iso9660": ".iso", + "application/x-java-jnlp-file": ".jnlp", + "application/x-java-source": ".java", + "application/x-java": ".java", + "application/x-javascript": ".js", + "application/x-latex": ".latex", + "application/x-lha": ".lha", + "application/x-lrzip-compressed-tar": ".tar.lrz", + "application/x-lrzip": ".lrz", + "application/x-lz4": ".lz4", + "application/x-lzh": ".lzh", + "application/x-lzip-compressed-tar": ".tar.lz", + "application/x-lzip": ".lz", + "application/x-lzma-compressed-tar": ".tar.lzma", + "application/x-lzma-compressed": ".xz", + "application/x-lzma": ".lzma", + "application/x-lzop-compressed-tar": ".tar.lzo", + "application/x-lzop": ".lzo", + "application/x-macbinary": ".bin", + "application/x-macbinhex40": ".hqx", + "application/x-mathcad": ".mcd", + "application/x-mplayer2": ".asx", + "application/x-ms-dos-executable": ".exe", + "application/x-ms-installer": ".msi", + "application/x-msaccess": ".mdb", + "application/x-msdos-program": ".exe", + "application/x-msdownload": ".exe", + "application/x-msi": ".msi", + "application/x-msmetafile": ".wmf", + "application/x-msmoney": ".mny", + "application/x-mspowerpoint": ".ppt", + "application/x-mspublisher": ".pub", + "application/x-mswrite": ".wri", + "application/x-netcdf": ".nc", + "application/x-ns-proxy-autoconfig": ".pac", + "application/x-pagemaker": ".pmd", + "application/x-pdf": ".pdf", + "application/x-pe": ".exe", + "application/x-perl": ".pl", + "application/x-php": ".php", + "application/x-pilot": ".prc", + "application/x-pkcs12": ".p12", + "application/x-pkcs7-certificates": ".p7b", + "application/x-pkcs7-certreqresp": ".p7r", + "application/x-python": ".py", + "application/x-qemu-img": ".qcow2", + "application/x-rar-compressed": ".rar", + "application/x-rar": ".rar", + "application/x-redhat-package-manager": ".rpm", + "application/x-research-info-systems": ".ris", + "application/x-rpm": ".rpm", + "application/x-ruby": ".rb", + "application/x-safari-safariextz": ".safariextz", + "application/x-sas-access": ".sas7bdat", + "application/x-sas-audit": ".sl", + "application/x-sas-backup": ".sbk", + "application/x-sas-catalog": ".sas7bcat", + "application/x-sas-data": ".sas7bdat", + "application/x-sas-metadata": ".sas7bcat", + "application/x-sas-template": ".sas7bdat", + "application/x-sas-xpt": ".xpt", + "application/x-sas": ".sas", + "application/x-sh": ".sh", + "application/x-shar": ".shar", + "application/x-shellscript": ".sh", + "application/x-shockwave-flash": ".swf", + "application/x-silverlight-app": ".xap", + "application/x-sit": ".sit", + "application/x-snappy-compressed-tar": ".tar.sz", + "application/x-snappy-framed": ".sz", + "application/x-snappy": ".snappy", + "application/x-sqlite3": ".sqlite3", + "application/x-stuffit": ".sit", + "application/x-stuffitx": ".sitx", + "application/x-subrip": ".srt", + "application/x-sv4cpio": ".sv4cpio", + "application/x-sv4crc": ".sv4crc", + "application/x-t3vm-image": ".t3", + "application/x-tads": ".gam", + "application/x-tar-bzip2": ".tar.bz2", + "application/x-tar-compressed": ".tar.gz", + "application/x-tar-lzop": ".tar.lzo", + "application/x-tar-xz": ".tar.xz", + "application/x-tar-zstd": ".tar.zst", + "application/x-tar": ".tar", + "application/x-tcl": ".tcl", + "application/x-tex": ".tex", + "application/x-texinfo": ".texi", + "application/x-tgif": ".obj", + "application/x-udf": ".udf", + "application/x-ustar": ".ustar", + "application/x-uue": ".uue", + "application/x-vhd": ".vhd", + "application/x-vhdx": ".vhdx", + "application/x-virtualbox-vdi": ".vdi", + "application/x-virtualbox-vhd": ".vhd", + "application/x-virtualbox-vmdk": ".vmdk", + "application/x-vmdk": ".vmdk", + "application/x-vmware-vmdk": ".vmdk", + "application/x-wais-source": ".src", + "application/x-web-app-manifest+json": ".webapp", + "application/x-www-form-urlencoded": ".urlencoded", + "application/x-x509-ca-cert": ".crt", + "application/x-xar": ".xar", + "application/x-xcf": ".xcf", + "application/x-xfig": ".fig", + "application/x-xliff+xml": ".xlf", + "application/x-xpinstall": ".xpi", + "application/x-xz-compressed-tar": ".tar.xz", + "application/x-xz": ".xz", + "application/x-zmachine": ".z1", + "application/x-zoo": ".zoo", + "application/x-zopfli-compressed-tar": ".tar.zopfli", + "application/x-zopfli": ".zopfli", + "application/x-zpaq-compressed-tar": ".tar.zpaq", + "application/x-zpaq": ".zpaq", + "application/x-zstd-compressed-tar": ".tar.zst", + "application/x-zstd": ".zst", + "application/xaml+xml": ".xaml", + "application/xcap-diff+xml": ".xdf", + "application/xenc+xml": ".xenc", + "application/xhtml+xml": ".xhtml", + "application/xml-dtd": ".dtd", + "application/xml": ".xml", + "application/xop+xml": ".xop", + "application/xproc+xml": ".xpl", + "application/xslt+xml": ".xslt", + "application/xspf+xml": ".xspf", + "application/xv+xml": ".mxml", + "application/yang": ".yang", + "application/yin+xml": ".yin", + "application/zip": ".zip", + "audio/3gpp": ".3gp", + "audio/3gpp2": ".3g2", + "audio/aac": ".aac", + "audio/adpcm": ".adp", + "audio/basic": ".au", + "audio/midi": ".midi", + "audio/mp4": ".mp4a", + "audio/mpeg": ".mp3", + "audio/ogg": ".oga", + "audio/opus": ".opus", + "audio/s3m": ".s3m", + "audio/silk": ".sil", + "audio/vnd.dece.audio": ".uva", + "audio/vnd.digital-winds": ".eol", + "audio/vnd.dra": ".dra", + "audio/vnd.dts.hd": ".dtshd", + "audio/vnd.dts": ".dts", + "audio/vnd.lucent.voice": ".lvp", + "audio/vnd.ms-playready.media.pya": ".pya", + "audio/vnd.nuera.ecelp4800": ".ecelp4800", + "audio/vnd.nuera.ecelp7470": ".ecelp7470", + "audio/vnd.nuera.ecelp9600": ".ecelp9600", + "audio/wav": ".wav", + "audio/webm": ".weba", + "audio/x-aac": ".aac", + "audio/x-aiff": ".aif", + "audio/x-caf": ".caf", + "audio/x-flac": ".flac", + "audio/x-matroska": ".mka", + "audio/x-mpegurl": ".m3u", + "audio/x-ms-wax": ".wax", + "audio/x-ms-wma": ".wma", + "audio/x-pn-realaudio-plugin": ".rmp", + "audio/x-pn-realaudio": ".ram", + "audio/x-wav": ".wav", + "audio/xm": ".xm", + "chemical/x-cdx": ".cdx", + "chemical/x-cif": ".cif", + "chemical/x-cmdf": ".cmdf", + "chemical/x-cml": ".cml", + "chemical/x-csml": ".csml", + "chemical/x-xyz": ".xyz", + "font/otf": ".otf", + "font/ttf": ".ttf", + "font/woff": ".woff", + "font/woff2": ".woff2", + "image/bmp": ".bmp", + "image/cgm": ".cgm", + "image/g3fax": ".g3", + "image/gif": ".gif", + "image/ief": ".ief", + "image/jpeg": ".jpeg", + "image/ktx": ".ktx", + "image/png": ".png", + "image/prs.btif": ".btif", + "image/sgi": ".sgi", + "image/svg+xml": ".svg", + "image/tiff": ".tiff", + "image/vnd.adobe.photoshop": ".psd", + "image/vnd.dece.graphic": ".uvi", + "image/vnd.djvu": ".djvu", + "image/vnd.dvb.subtitle": ".sub", + "image/vnd.dwg": ".dwg", + "image/vnd.dxf": ".dxf", + "image/vnd.fastbidsheet": ".fbs", + "image/vnd.fpx": ".fpx", + "image/vnd.fst": ".fst", + "image/vnd.fujixerox.edmics-mmr": ".mmr", + "image/vnd.fujixerox.edmics-rlc": ".rlc", + "image/vnd.microsoft.icon": ".ico", + "image/vnd.ms-modi": ".mdi", + "image/vnd.ms-photo": ".wdp", + "image/vnd.net-fpx": ".npx", + "image/vnd.wap.wbmp": ".wbmp", + "image/vnd.xiff": ".xif", + "image/webp": ".webp", + "image/x-3ds": ".3ds", + "image/x-cmu-raster": ".ras", + "image/x-cmx": ".cmx", + "image/x-freehand": ".fh", + "image/x-icon": ".ico", + "image/x-mrsid-image": ".sid", + "image/x-pcx": ".pcx", + "image/x-pict": ".pic", + "image/x-portable-anymap": ".pnm", + "image/x-portable-bitmap": ".pbm", + "image/x-portable-graymap": ".pgm", + "image/x-portable-pixmap": ".ppm", + "image/x-rgb": ".rgb", + "image/x-tga": ".tga", + "image/x-xbitmap": ".xbm", + "image/x-xpixmap": ".xpm", + "image/x-xwindowdump": ".xwd", + "message/rfc822": ".eml", + "model/iges": ".igs", + "model/mesh": ".msh", + "model/vnd.collada+xml": ".dae", + "model/vnd.dwf": ".dwf", + "model/vnd.gdl": ".gdl", + "model/vnd.gtw": ".gtw", + "model/vnd.mts": ".mts", + "model/vnd.vtu": ".vtu", + "model/vrml": ".wrl", + "model/x3d+binary": ".x3db", + "model/x3d+vrml": ".x3dv", + "model/x3d+xml": ".x3d", + "text/cache-manifest": ".appcache", + "text/calendar": ".ics", + "text/css": ".css", + "text/csv": ".csv", + "text/html": ".html", + "text/javascript": ".js", + "text/n3": ".n3", + "text/plain": ".txt", + "text/prs.lines.tag": ".dsc", + "text/richtext": ".rtx", + "text/sgml": ".sgml", + "text/tab-separated-values": ".tsv", + "text/troff": ".t", + "text/turtle": ".ttl", + "text/uri-list": ".uri", + "text/vcard": ".vcard", + "text/vnd.curl.dcurl": ".dcurl", + "text/vnd.curl.mcurl": ".mcurl", + "text/vnd.curl.scurl": ".scurl", + "text/vnd.curl": ".curl", + "text/vnd.dvb.subtitle": ".sub", + "text/vnd.fly": ".fly", + "text/vnd.fmi.flexstor": ".flx", + "text/vnd.graphviz": ".gv", + "text/vnd.in3d.3dml": ".3dml", + "text/vnd.in3d.spot": ".spot", + "text/vnd.sun.j2me.app-descriptor": ".jad", + "text/vnd.wap.wml": ".wml", + "text/vnd.wap.wmlscript": ".wmls", + "text/x-asm": ".s", + "text/x-c": ".c", + "text/x-fortran": ".f", + "text/x-java-source": ".java", + "text/x-nfo": ".nfo", + "text/x-opml": ".opml", + "text/x-pascal": ".p", + "text/x-setext": ".etx", + "text/x-sfv": ".sfv", + "text/x-uuencode": ".uu", + "text/x-vcalendar": ".vcs", + "text/x-vcard": ".vcf", + "text/xml": ".xml", + "video/3gpp": ".3gp", + "video/3gpp2": ".3g2", + "video/h261": ".h261", + "video/h263": ".h263", + "video/h264": ".h264", + "video/jpeg": ".jpgv", + "video/jpm": ".jpm", + "video/mj2": ".mj2", + "video/mp2t": ".ts", + "video/mp4": ".mp4", + "video/mpeg": ".mpeg", + "video/ogg": ".ogv", + "video/quicktime": ".qt", + "video/vnd.dece.hd": ".uvh", + "video/vnd.dece.mobile": ".uvm", + "video/vnd.dece.pd": ".uvp", + "video/vnd.dece.sd": ".uvs", + "video/vnd.dece.video": ".uvv", + "video/vnd.dvb.file": ".dvb", + "video/vnd.fvt": ".fvt", + "video/vnd.mpegurl": ".mxu", + "video/vnd.ms-playready.media.pyv": ".pyv", + "video/vnd.uvvu.mp4": ".uvu", + "video/vnd.vivo": ".viv", + "video/webm": ".webm", + "video/x-f4v": ".f4v", + "video/x-fli": ".fli", + "video/x-flv": ".flv", + "video/x-m4v": ".m4v", + "video/x-matroska": ".mkv", + "video/x-mng": ".mng", + "video/x-ms-asf": ".asf", + "video/x-ms-vob": ".vob", + "video/x-ms-wm": ".wm", + "video/x-ms-wmv": ".wmv", + "video/x-ms-wmx": ".wmx", + "video/x-ms-wvx": ".wvx", + "video/x-msvideo": ".avi", + "video/x-sgi-movie": ".movie", + "video/x-smv": ".smv", + "x-conference/x-cooltalk": ".ice", +} + + +def guess_extension(mimetype): + if mimetype not in _mimetype_file_extension: + raise ValidationError( + _("Mimetype %(mimetype)s is not mapped.") + % { + "mimetype": mimetype, + } + ) + return _mimetype_file_extension[mimetype] + + +mimetypes.guess_extension = guess_extension diff --git a/tools_mimetypes_extension/pyproject.toml b/tools_mimetypes_extension/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/tools_mimetypes_extension/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/tools_mimetypes_extension/readme/CONTRIBUTORS.md b/tools_mimetypes_extension/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..5d535bfca --- /dev/null +++ b/tools_mimetypes_extension/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- [NuoBiT](https://www.nuobit.com): + - Kilian Niubo + - Deniz Gallo diff --git a/tools_mimetypes_extension/readme/DESCRIPTION.md b/tools_mimetypes_extension/readme/DESCRIPTION.md new file mode 100644 index 000000000..69fa4280c --- /dev/null +++ b/tools_mimetypes_extension/readme/DESCRIPTION.md @@ -0,0 +1 @@ +This module extend tools/mimetypes.py diff --git a/tools_mimetypes_extension/static/description/icon.png b/tools_mimetypes_extension/static/description/icon.png new file mode 100644 index 000000000..1cd641e79 Binary files /dev/null and b/tools_mimetypes_extension/static/description/icon.png differ diff --git a/tools_mimetypes_extension/static/description/index.html b/tools_mimetypes_extension/static/description/index.html new file mode 100644 index 000000000..43287dd3f --- /dev/null +++ b/tools_mimetypes_extension/static/description/index.html @@ -0,0 +1,420 @@ + + + + + +Tools mimetypes extension + + + +
+

Tools mimetypes extension

+ + +

Beta License: AGPL-3 NuoBiT/odoo-addons

+

This module extend tools/mimetypes.py

+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub Issues. +In case of trouble, please check there if your issue has already been reported. +If you spotted it first, help us to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • NuoBiT Solutions SL
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is part of the NuoBiT/odoo-addons project on GitHub.

+

You are welcome to contribute.

+
+
+
+ +