From e929db2e35eb9f1964552630fc736077073a875e Mon Sep 17 00:00:00 2001 From: Krylov Sergey Date: Wed, 15 Jan 2025 17:13:41 +0300 Subject: [PATCH] Initial commit --- __init__.py | 4 + __manifest__.py | 18 ++++ i18n/ar.po | 25 ++++++ i18n/attachment_indexation.pot | 21 +++++ i18n/cs.po | 25 ++++++ i18n/da.po | 25 ++++++ i18n/de.po | 25 ++++++ i18n/es.po | 25 ++++++ i18n/fr.po | 25 ++++++ i18n/he.po | 25 ++++++ i18n/hr.po | 25 ++++++ i18n/hu.po | 25 ++++++ i18n/it.po | 25 ++++++ i18n/lb.po | 21 +++++ i18n/lt.po | 25 ++++++ i18n/mn.po | 25 ++++++ i18n/nb.po | 25 ++++++ i18n/nl.po | 25 ++++++ i18n/pl.po | 25 ++++++ i18n/pt.po | 21 +++++ i18n/pt_BR.po | 25 ++++++ i18n/ro.po | 21 +++++ i18n/ru.po | 23 ++++++ i18n/tr.po | 25 ++++++ i18n/uk.po | 25 ++++++ i18n/vi.po | 25 ++++++ i18n/zh_CN.po | 25 ++++++ i18n/zh_TW.po | 25 ++++++ models/__init__.py | 4 + models/ir_attachment.py | 146 +++++++++++++++++++++++++++++++++ tests/__init__.py | 3 + tests/files/test_content.pdf | Bin 0 -> 7497 bytes tests/test_indexation.py | 24 ++++++ 33 files changed, 831 insertions(+) create mode 100644 __init__.py create mode 100644 __manifest__.py create mode 100644 i18n/ar.po create mode 100644 i18n/attachment_indexation.pot create mode 100644 i18n/cs.po create mode 100644 i18n/da.po create mode 100644 i18n/de.po create mode 100644 i18n/es.po create mode 100644 i18n/fr.po create mode 100644 i18n/he.po create mode 100644 i18n/hr.po create mode 100644 i18n/hu.po create mode 100644 i18n/it.po create mode 100644 i18n/lb.po create mode 100644 i18n/lt.po create mode 100644 i18n/mn.po create mode 100644 i18n/nb.po create mode 100644 i18n/nl.po create mode 100644 i18n/pl.po create mode 100644 i18n/pt.po create mode 100644 i18n/pt_BR.po create mode 100644 i18n/ro.po create mode 100644 i18n/ru.po create mode 100644 i18n/tr.po create mode 100644 i18n/uk.po create mode 100644 i18n/vi.po create mode 100644 i18n/zh_CN.po create mode 100644 i18n/zh_TW.po create mode 100644 models/__init__.py create mode 100644 models/ir_attachment.py create mode 100644 tests/__init__.py create mode 100644 tests/files/test_content.pdf create mode 100644 tests/test_indexation.py diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..dc5e6b6 --- /dev/null +++ b/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import models diff --git a/__manifest__.py b/__manifest__.py new file mode 100644 index 0000000..180b772 --- /dev/null +++ b/__manifest__.py @@ -0,0 +1,18 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. +{ + 'name': 'Attachments List and Document Indexation', + 'version': '2.1', + 'category': 'Hidden/Tools', + 'description': """ +Attachments list and document indexation +======================================== +* Show attachment on the top of the forms +* Document Indexation: odt, pdf, xlsx, docx + +The `pdfminer.six` Python library has to be installed in order to index PDF files +""", + 'depends': ['web'], + 'installable': True, + 'license': 'LGPL-3', +} diff --git a/i18n/ar.po b/i18n/ar.po new file mode 100644 index 0000000..b47fdfb --- /dev/null +++ b/i18n/ar.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# Martin Trigaux, 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: Martin Trigaux, 2019\n" +"Language-Team: Arabic (https://www.transifex.com/odoo/teams/41243/ar/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: ar\n" +"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "مرفق" diff --git a/i18n/attachment_indexation.pot b/i18n/attachment_indexation.pot new file mode 100644 index 0000000..70cdb76 --- /dev/null +++ b/i18n/attachment_indexation.pot @@ -0,0 +1,21 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-10-26 21:55+0000\n" +"PO-Revision-Date: 2023-10-26 21:55+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: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "" diff --git a/i18n/cs.po b/i18n/cs.po new file mode 100644 index 0000000..cab8f4c --- /dev/null +++ b/i18n/cs.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# trendspotter , 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: trendspotter , 2019\n" +"Language-Team: Czech (https://www.transifex.com/odoo/teams/41243/cs/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: cs\n" +"Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n >= 2 && n <= 4 && n % 1 == 0) ? 1: (n % 1 != 0 ) ? 2 : 3;\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "Příloha" diff --git a/i18n/da.po b/i18n/da.po new file mode 100644 index 0000000..7d088c6 --- /dev/null +++ b/i18n/da.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# Sanne Kristensen , 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: Sanne Kristensen , 2019\n" +"Language-Team: Danish (https://www.transifex.com/odoo/teams/41243/da/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: da\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "Vedhæftning" diff --git a/i18n/de.po b/i18n/de.po new file mode 100644 index 0000000..fd6b72f --- /dev/null +++ b/i18n/de.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# Martin Trigaux, 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: Martin Trigaux, 2019\n" +"Language-Team: German (https://www.transifex.com/odoo/teams/41243/de/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "Dateianhang" diff --git a/i18n/es.po b/i18n/es.po new file mode 100644 index 0000000..4b3f1fa --- /dev/null +++ b/i18n/es.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# Martin Trigaux, 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: Martin Trigaux, 2019\n" +"Language-Team: Spanish (https://www.transifex.com/odoo/teams/41243/es/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: es\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "Adjunto" diff --git a/i18n/fr.po b/i18n/fr.po new file mode 100644 index 0000000..43208f4 --- /dev/null +++ b/i18n/fr.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# Martin Trigaux, 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: Martin Trigaux, 2019\n" +"Language-Team: French (https://www.transifex.com/odoo/teams/41243/fr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: fr\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "Pièce jointe" diff --git a/i18n/he.po b/i18n/he.po new file mode 100644 index 0000000..758a43a --- /dev/null +++ b/i18n/he.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# ExcaliberX , 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: ExcaliberX , 2019\n" +"Language-Team: Hebrew (https://www.transifex.com/odoo/teams/41243/he/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: he\n" +"Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n == 2 && n % 1 == 0) ? 1: (n % 10 == 0 && n % 1 == 0 && n > 10) ? 2 : 3;\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "קובץ מצורף" diff --git a/i18n/hr.po b/i18n/hr.po new file mode 100644 index 0000000..3311bde --- /dev/null +++ b/i18n/hr.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# Martin Trigaux, 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: Martin Trigaux, 2019\n" +"Language-Team: Croatian (https://www.transifex.com/odoo/teams/41243/hr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: hr\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "Prilog" diff --git a/i18n/hu.po b/i18n/hu.po new file mode 100644 index 0000000..5100ba1 --- /dev/null +++ b/i18n/hu.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# Martin Trigaux, 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: Martin Trigaux, 2019\n" +"Language-Team: Hungarian (https://www.transifex.com/odoo/teams/41243/hu/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: hu\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "Melléklet" diff --git a/i18n/it.po b/i18n/it.po new file mode 100644 index 0000000..16f8d32 --- /dev/null +++ b/i18n/it.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# Paolo Valier, 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: Paolo Valier, 2019\n" +"Language-Team: Italian (https://www.transifex.com/odoo/teams/41243/it/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: it\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "Allegato" diff --git a/i18n/lb.po b/i18n/lb.po new file mode 100644 index 0000000..982bdcc --- /dev/null +++ b/i18n/lb.po @@ -0,0 +1,21 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Language-Team: Luxembourgish (https://www.transifex.com/odoo/teams/41243/lb/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: lb\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "" diff --git a/i18n/lt.po b/i18n/lt.po new file mode 100644 index 0000000..8310426 --- /dev/null +++ b/i18n/lt.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# Linas Versada , 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: Linas Versada , 2019\n" +"Language-Team: Lithuanian (https://www.transifex.com/odoo/teams/41243/lt/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: lt\n" +"Plural-Forms: nplurals=4; plural=(n % 10 == 1 && (n % 100 > 19 || n % 100 < 11) ? 0 : (n % 10 >= 2 && n % 10 <=9) && (n % 100 > 19 || n % 100 < 11) ? 1 : n % 1 != 0 ? 2: 3);\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "Prisegtukas" diff --git a/i18n/mn.po b/i18n/mn.po new file mode 100644 index 0000000..d221448 --- /dev/null +++ b/i18n/mn.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# Martin Trigaux, 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: Martin Trigaux, 2019\n" +"Language-Team: Mongolian (https://www.transifex.com/odoo/teams/41243/mn/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: mn\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "Хавсралт" diff --git a/i18n/nb.po b/i18n/nb.po new file mode 100644 index 0000000..7abadde --- /dev/null +++ b/i18n/nb.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# Martin Trigaux, 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: Martin Trigaux, 2019\n" +"Language-Team: Norwegian Bokmål (https://www.transifex.com/odoo/teams/41243/nb/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: nb\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "Vedlegg" diff --git a/i18n/nl.po b/i18n/nl.po new file mode 100644 index 0000000..d60d4f9 --- /dev/null +++ b/i18n/nl.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# Martin Trigaux, 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: Martin Trigaux, 2019\n" +"Language-Team: Dutch (https://www.transifex.com/odoo/teams/41243/nl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: nl\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "Bijlage" diff --git a/i18n/pl.po b/i18n/pl.po new file mode 100644 index 0000000..f9bb851 --- /dev/null +++ b/i18n/pl.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# Martin Trigaux, 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: Martin Trigaux, 2019\n" +"Language-Team: Polish (https://www.transifex.com/odoo/teams/41243/pl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: pl\n" +"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "Załącznik" diff --git a/i18n/pt.po b/i18n/pt.po new file mode 100644 index 0000000..b20e546 --- /dev/null +++ b/i18n/pt.po @@ -0,0 +1,21 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Language-Team: Portuguese (https://www.transifex.com/odoo/teams/41243/pt/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: pt\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "" diff --git a/i18n/pt_BR.po b/i18n/pt_BR.po new file mode 100644 index 0000000..a5395a8 --- /dev/null +++ b/i18n/pt_BR.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# Martin Trigaux, 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: Martin Trigaux, 2019\n" +"Language-Team: Portuguese (Brazil) (https://www.transifex.com/odoo/teams/41243/pt_BR/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: pt_BR\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "Anexo" diff --git a/i18n/ro.po b/i18n/ro.po new file mode 100644 index 0000000..b17a9d2 --- /dev/null +++ b/i18n/ro.po @@ -0,0 +1,21 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Language-Team: Romanian (https://www.transifex.com/odoo/teams/41243/ro/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: ro\n" +"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "" diff --git a/i18n/ru.po b/i18n/ru.po new file mode 100644 index 0000000..b10e91e --- /dev/null +++ b/i18n/ru.po @@ -0,0 +1,23 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 17.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-10-26 21:55+0000\n" +"PO-Revision-Date: 2024-01-30 15:14+0400\n" +"Last-Translator: \n" +"Language-Team: Russian (https://app.transifex.com/odoo/teams/41243/ru/)\n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "Вложение" diff --git a/i18n/tr.po b/i18n/tr.po new file mode 100644 index 0000000..7d06ab6 --- /dev/null +++ b/i18n/tr.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# Martin Trigaux, 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: Martin Trigaux, 2019\n" +"Language-Team: Turkish (https://www.transifex.com/odoo/teams/41243/tr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: tr\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "Ek" diff --git a/i18n/uk.po b/i18n/uk.po new file mode 100644 index 0000000..10822fb --- /dev/null +++ b/i18n/uk.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# Alina Lisnenko , 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: Alina Lisnenko , 2019\n" +"Language-Team: Ukrainian (https://www.transifex.com/odoo/teams/41243/uk/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: uk\n" +"Plural-Forms: nplurals=4; plural=(n % 1 == 0 && n % 10 == 1 && n % 100 != 11 ? 0 : n % 1 == 0 && n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 12 || n % 100 > 14) ? 1 : n % 1 == 0 && (n % 10 ==0 || (n % 10 >=5 && n % 10 <=9) || (n % 100 >=11 && n % 100 <=14 )) ? 2: 3);\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "Прикріплення" diff --git a/i18n/vi.po b/i18n/vi.po new file mode 100644 index 0000000..d4a430c --- /dev/null +++ b/i18n/vi.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# Nancy Momoland , 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: Nancy Momoland , 2019\n" +"Language-Team: Vietnamese (https://www.transifex.com/odoo/teams/41243/vi/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: vi\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "Đính kèm" diff --git a/i18n/zh_CN.po b/i18n/zh_CN.po new file mode 100644 index 0000000..353bda0 --- /dev/null +++ b/i18n/zh_CN.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# Martin Trigaux, 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: Martin Trigaux, 2019\n" +"Language-Team: Chinese (China) (https://www.transifex.com/odoo/teams/41243/zh_CN/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: zh_CN\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "附件" diff --git a/i18n/zh_TW.po b/i18n/zh_TW.po new file mode 100644 index 0000000..fedf102 --- /dev/null +++ b/i18n/zh_TW.po @@ -0,0 +1,25 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * attachment_indexation +# +# Translators: +# Martin Trigaux, 2019 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server saas~12.2\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-03-20 14:18+0000\n" +"PO-Revision-Date: 2019-08-26 09:09+0000\n" +"Last-Translator: Martin Trigaux, 2019\n" +"Language-Team: Chinese (Taiwan) (https://www.transifex.com/odoo/teams/41243/zh_TW/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: zh_TW\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#. module: attachment_indexation +#: model:ir.model,name:attachment_indexation.model_ir_attachment +msgid "Attachment" +msgstr "附件" diff --git a/models/__init__.py b/models/__init__.py new file mode 100644 index 0000000..3f80145 --- /dev/null +++ b/models/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from . import ir_attachment diff --git a/models/ir_attachment.py b/models/ir_attachment.py new file mode 100644 index 0000000..54fcb7b --- /dev/null +++ b/models/ir_attachment.py @@ -0,0 +1,146 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. +import io +import logging +import xml.dom.minidom +import zipfile + +from odoo import api, models +from odoo.tools.lru import LRU + +_logger = logging.getLogger(__name__) + +try: + from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter + from pdfminer.converter import TextConverter + from pdfminer.pdfpage import PDFPage +except ImportError: + PDFResourceManager = PDFPageInterpreter = TextConverter = PDFPage = None + _logger.warning("Attachment indexation of PDF documents is unavailable because the 'pdfminer' Python library cannot be found on the system. " + "You may install it from https://pypi.org/project/pdfminer.six/ (e.g. `pip3 install pdfminer.six`)") + +FTYPES = ['docx', 'pptx', 'xlsx', 'opendoc', 'pdf'] + + +index_content_cache = LRU(1) + +def textToString(element): + buff = u"" + for node in element.childNodes: + if node.nodeType == xml.dom.Node.TEXT_NODE: + buff += node.nodeValue + elif node.nodeType == xml.dom.Node.ELEMENT_NODE: + buff += textToString(node) + return buff + + +class IrAttachment(models.Model): + _inherit = 'ir.attachment' + + def _index_docx(self, bin_data): + '''Index Microsoft .docx documents''' + buf = u"" + f = io.BytesIO(bin_data) + if zipfile.is_zipfile(f): + try: + zf = zipfile.ZipFile(f) + content = xml.dom.minidom.parseString(zf.read("word/document.xml")) + for val in ["w:p", "w:h", "text:list"]: + for element in content.getElementsByTagName(val): + buf += textToString(element) + "\n" + except Exception: + pass + return buf + + def _index_pptx(self, bin_data): + '''Index Microsoft .pptx documents''' + + buf = u"" + f = io.BytesIO(bin_data) + if zipfile.is_zipfile(f): + try: + zf = zipfile.ZipFile(f) + zf_filelist = [x for x in zf.namelist() if x.startswith('ppt/slides/slide')] + for i in range(1, len(zf_filelist) + 1): + content = xml.dom.minidom.parseString(zf.read('ppt/slides/slide%s.xml' % i)) + for val in ["a:t"]: + for element in content.getElementsByTagName(val): + buf += textToString(element) + "\n" + except Exception: + pass + return buf + + def _index_xlsx(self, bin_data): + '''Index Microsoft .xlsx documents''' + + buf = u"" + f = io.BytesIO(bin_data) + if zipfile.is_zipfile(f): + try: + zf = zipfile.ZipFile(f) + content = xml.dom.minidom.parseString(zf.read("xl/sharedStrings.xml")) + for val in ["t"]: + for element in content.getElementsByTagName(val): + buf += textToString(element) + "\n" + except Exception: + pass + return buf + + def _index_opendoc(self, bin_data): + '''Index OpenDocument documents (.odt, .ods...)''' + + buf = u"" + f = io.BytesIO(bin_data) + if zipfile.is_zipfile(f): + try: + zf = zipfile.ZipFile(f) + content = xml.dom.minidom.parseString(zf.read("content.xml")) + for val in ["text:p", "text:h", "text:list"]: + for element in content.getElementsByTagName(val): + buf += textToString(element) + "\n" + except Exception: + pass + return buf + + def _index_pdf(self, bin_data): + '''Index PDF documents''' + if PDFResourceManager is None: + return + buf = u"" + if bin_data.startswith(b'%PDF-'): + f = io.BytesIO(bin_data) + try: + resource_manager = PDFResourceManager() + with io.StringIO() as content, TextConverter(resource_manager, content) as device: + logging.getLogger("pdfminer").setLevel(logging.CRITICAL) + interpreter = PDFPageInterpreter(resource_manager, device) + + for page in PDFPage.get_pages(f): + interpreter.process_page(page) + + buf = content.getvalue() + except Exception: + pass + return buf + + @api.model + def _index(self, bin_data, mimetype, checksum=None): + if checksum: + cached_content = index_content_cache.get(checksum) + if cached_content: + return cached_content + res = False + for ftype in FTYPES: + buf = getattr(self, '_index_%s' % ftype)(bin_data) + if buf: + res = buf.replace('\x00', '') + break + + res = res or super(IrAttachment, self)._index(bin_data, mimetype, checksum=checksum) + if checksum: + index_content_cache[checksum] = res + return res + + def copy(self, default=None): + index_content_cache[self.checksum] = self.index_content + return super().copy(default=default) diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..d76ba91 --- /dev/null +++ b/tests/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import test_indexation diff --git a/tests/files/test_content.pdf b/tests/files/test_content.pdf new file mode 100644 index 0000000000000000000000000000000000000000..062e1e6e2f630fea4223e0036d98cc9bd80f60fc GIT binary patch literal 7497 zcmai32UJt(wjLExB3^@HB;c?f08*x8r~H}Y z5ax)PkkHoQaBqaa=67Hob47`)c?q+u;^ii{{hze*w2>VAw5{sXSMAabqe`ya#MX8P z+#C~ovzhWryX%1#S2Ilm*5BAULQ(4OM43rj{$2EBTUY6}c8|o-{=fvr%}lYg375)c zr!>mT1HgGY{%M`EqB;zq`bk|tAkx&Yzi86`hz9Y0MDu5~5TFbcj`}^c&nP$I*|GZ{ z9wfQ%U5YOy$0>2+z*pV1t8l01aagOeCfaV0*!^45sgBxLwVw&<06Q@*6Dhu0*)E7n z3=0tg?=mZ%Ova%nk~1r6Tn1M!x+GV*3>}vYO8)Xalia3j7c_D8tABA@Gjnq0`|=~d zIoYjOA9h^lh?@qSG3QUn)r6lVSrC!+8vHg zD;{%xc&sDzn)`moVwHbt<*{?>%nh7$-Pt?hJHy9Ps&nJFSp>iJ@O7&1OT96}2oL)2 zUqs^3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La+>gr@CX6ihZFbg}PvAkxA-{a_E%uL4Opee(N9R)5VS4%tpS`W?HZgrK z)z7!5JPQf*-)6iN(0-1ScVad}cy8;kpI4EwNW3nkEhLN8eCDg6%IO->MCHa3`-#&< zhsI(yEmDR?H`mYCqkFTt1=sX(PZMX+x-og{aas@|L-ffqR8tVc=ksC9EW^`T#{+YF z(hFHf^q$V&BYbcBW9aaR7AXTv{9n4L)cz>7bt(;mL;ur8MgG-BH4gB?fiQSaqAJeE zf#Bjr#8aBWlvh2h2M(m7OufW)TSA08;jGzaO6LRfGit3aautv8?B3Z5ov z2P=C15Z-W^wfY1jBsm-eJs#Gy9O;iRmYQx~^2$P)a%=GH+SHay)vgDhP&jeD_J0A0 z%wLK84;Da1zV<{aFpLSlxL;HitPhS_jsF`GE(9MU+8IlrmRbk<=Nbh7nYlO;oqep3 z6jUG}U?7}=6BtScNJR+(fdEQ_!M|=83gXynd7V6~6)22?sL3 z5~!esQ*D3@aXxrof&0?E?DYbpn4=NBP|6*N=wUtrKKSd6aI`*%QxyHjQ6IoRyaW8@9!21ne^i&KDc5#!^sxf|ih=ry#`{vU z^qUFDZ!@G{Hqcng&c-`Y^5H}Y|5rKyAbl^Kr?La}kg)ofE|9r}CD7B?-ThxbV2W-X ztf!MG&Qnrd<Ykp1cQ-KFc=|2dBQ1A3S5v-gnAs$ab)i3k{K$@P{ z@Ic6~K_ulx6=(&NgQHnI00R9K@F%xhA literal 0 HcmV?d00001 diff --git a/tests/test_indexation.py b/tests/test_indexation.py new file mode 100644 index 0000000..bb7eac8 --- /dev/null +++ b/tests/test_indexation.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +from odoo.tests.common import TransactionCase, tagged +from odoo.tools.misc import file_open +from unittest import skipIf +import os + +directory = os.path.dirname(__file__) + +try: + from pdfminer.pdfinterp import PDFResourceManager +except ImportError: + PDFResourceManager = None + + +@tagged('post_install', '-at_install') +class TestCaseIndexation(TransactionCase): + + @skipIf(PDFResourceManager is None, "pdfminer not installed") + def test_attachment_pdf_indexation(self): + with file_open(os.path.join(directory, 'files', 'test_content.pdf'), 'rb') as file: + pdf = file.read() + text = self.env['ir.attachment']._index(pdf, 'application/pdf') + self.assertEqual(text, 'TestContent!!\x0c', 'the index content should be correct')