commit e929db2e35eb9f1964552630fc736077073a875e Author: Krylov Sergey Date: Wed Jan 15 17:13:41 2025 +0300 Initial commit 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 0000000..062e1e6 Binary files /dev/null and b/tests/files/test_content.pdf differ 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')