From 78b95d14cc445bfff1ca29876dc7145fb5cfa1a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Tue, 23 Jan 2024 10:12:18 +0100 Subject: [PATCH 01/21] [ADD] dms_field_auto_classification: New module TT46805 [UPD] Update dms_field_auto_classification.pot --- dms_field_auto_classification/README.rst | 112 +++++ dms_field_auto_classification/__init__.py | 4 + dms_field_auto_classification/__manifest__.py | 19 + .../demo/dms_classification_template_demo.xml | 20 + .../i18n/dms_field_auto_classification.pot | 113 +++++ dms_field_auto_classification/i18n/es.po | 117 +++++ .../models/__init__.py | 3 + .../models/dms_classification_template.py | 44 ++ .../readme/CONFIGURE.rst | 10 + .../readme/CONTRIBUTORS.rst | 4 + .../readme/DESCRIPTION.rst | 2 + .../readme/USAGE.rst | 6 + .../security/ir.model.access.csv | 2 + .../static/description/icon.png | Bin 0 -> 5069 bytes .../static/description/icon.svg | 210 ++++++++ .../static/description/index.html | 453 ++++++++++++++++++ .../tests/__init__.py | 3 + .../tests/data/test.zip | Bin 0 -> 2902 bytes .../test_dms_field_auto_classification.py | 187 ++++++++ .../dms_classification_template_views.xml | 40 ++ .../wizards/__init__.py | 3 + .../wizards/wizard_dms_classification.py | 79 +++ .../wizard_dms_classification_views.xml | 19 + 23 files changed, 1450 insertions(+) create mode 100644 dms_field_auto_classification/README.rst create mode 100644 dms_field_auto_classification/__init__.py create mode 100644 dms_field_auto_classification/__manifest__.py create mode 100644 dms_field_auto_classification/demo/dms_classification_template_demo.xml create mode 100644 dms_field_auto_classification/i18n/dms_field_auto_classification.pot create mode 100644 dms_field_auto_classification/i18n/es.po create mode 100644 dms_field_auto_classification/models/__init__.py create mode 100644 dms_field_auto_classification/models/dms_classification_template.py create mode 100644 dms_field_auto_classification/readme/CONFIGURE.rst create mode 100644 dms_field_auto_classification/readme/CONTRIBUTORS.rst create mode 100644 dms_field_auto_classification/readme/DESCRIPTION.rst create mode 100644 dms_field_auto_classification/readme/USAGE.rst create mode 100644 dms_field_auto_classification/security/ir.model.access.csv create mode 100644 dms_field_auto_classification/static/description/icon.png create mode 100644 dms_field_auto_classification/static/description/icon.svg create mode 100644 dms_field_auto_classification/static/description/index.html create mode 100644 dms_field_auto_classification/tests/__init__.py create mode 100644 dms_field_auto_classification/tests/data/test.zip create mode 100644 dms_field_auto_classification/tests/test_dms_field_auto_classification.py create mode 100644 dms_field_auto_classification/views/dms_classification_template_views.xml create mode 100644 dms_field_auto_classification/wizards/__init__.py create mode 100644 dms_field_auto_classification/wizards/wizard_dms_classification.py create mode 100644 dms_field_auto_classification/wizards/wizard_dms_classification_views.xml diff --git a/dms_field_auto_classification/README.rst b/dms_field_auto_classification/README.rst new file mode 100644 index 000000000..7c2f0896b --- /dev/null +++ b/dms_field_auto_classification/README.rst @@ -0,0 +1,112 @@ +===================================== +Auto classify files into embedded DMS +===================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:b911efe5581effdf1f3bb9239c2e7604fafa018005c336ed341e1a94650c1d8e + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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-OCA%2Fdms-lightgray.png?logo=github + :target: https://github.com/OCA/dms/tree/15.0/dms_field_auto_classification + :alt: OCA/dms +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/dms-15-0/dms-15-0-dms_field_auto_classification + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/dms&target_branch=15.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Automatically classify files within a .zip file to the corresponding directory(s) +related to an embedded DMS. + +**Table of contents** + +.. contents:: + :local: + +Configuration +============= + +#. Go to `Documents / Configuration / Classification Templates` and create or edit a template. +#. You can set a model to which it is linked (res.partner for example). +#. You can define the details to indicate which field is referenced by the defined filename pattern. + +Full example from res.partner: + +Filename pattern: ([0-9]{8}[A-Z]).*.pdf +Details: VAT (field) and 0 (index) +Directory Pattern example 1: {0} > This will attempt to add the files to the directory linked to the partner with the VAT name. +Directory Pattern example 2: {0} / Misc > This will attempt to add the files to the "Misc" subdirectory linked to the partner with the VAT name. + +Usage +===== + +#. Go to `Documents / Auto Classification` and select a template and a .zip file. +#. Press the `Analyze` button +#. As many lines will be set as the number of files contained in the .zip file and apply the filename pattern. +#. The record to which they are related (res.partner for example) will be show on the lines. +#. Press the `Classify` button +#. The files (dms.file) will be created in the corresponding directories. + +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 +~~~~~~~ + +* Tecnativa + +Contributors +~~~~~~~~~~~~ + +* `Tecnativa `_: + + * Víctor Martínez + * Pedro M. Baeza + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +.. |maintainer-victoralmau| image:: https://github.com/victoralmau.png?size=40px + :target: https://github.com/victoralmau + :alt: victoralmau + +Current `maintainer `__: + +|maintainer-victoralmau| + +This module is part of the `OCA/dms `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/dms_field_auto_classification/__init__.py b/dms_field_auto_classification/__init__.py new file mode 100644 index 000000000..e1e144406 --- /dev/null +++ b/dms_field_auto_classification/__init__.py @@ -0,0 +1,4 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html). + +from . import models +from . import wizards diff --git a/dms_field_auto_classification/__manifest__.py b/dms_field_auto_classification/__manifest__.py new file mode 100644 index 000000000..c25143f9b --- /dev/null +++ b/dms_field_auto_classification/__manifest__.py @@ -0,0 +1,19 @@ +# Copyright 2024 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Auto classify files into embedded DMS", + "version": "15.0.1.0.0", + "category": "Document Management", + "website": "https://github.com/OCA/dms", + "author": "Tecnativa, Odoo Community Association (OCA)", + "license": "AGPL-3", + "depends": ["dms_auto_classification", "dms_field"], + "installable": True, + "data": [ + "security/ir.model.access.csv", + "views/dms_classification_template_views.xml", + "wizards/wizard_dms_classification_views.xml", + ], + "demo": ["demo/dms_classification_template_demo.xml"], + "maintainers": ["victoralmau"], +} diff --git a/dms_field_auto_classification/demo/dms_classification_template_demo.xml b/dms_field_auto_classification/demo/dms_classification_template_demo.xml new file mode 100644 index 000000000..261edd865 --- /dev/null +++ b/dms_field_auto_classification/demo/dms_classification_template_demo.xml @@ -0,0 +1,20 @@ + + + + Partners template + ([0-9]{8}[A-Z]).*.pdf + + {0} + + + + + 0 + + diff --git a/dms_field_auto_classification/i18n/dms_field_auto_classification.pot b/dms_field_auto_classification/i18n/dms_field_auto_classification.pot new file mode 100644 index 000000000..eef33b03b --- /dev/null +++ b/dms_field_auto_classification/i18n/dms_field_auto_classification.pot @@ -0,0 +1,113 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * dms_field_auto_classification +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \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: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__create_uid +msgid "Created by" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__create_date +msgid "Created on" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__dms_directory_ids +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__dms_directory_ids +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_wizard_dms_classification_detail__dms_directory_ids +msgid "DMS Directories" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__detail_ids +msgid "Details" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__display_name +msgid "Display Name" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model,name:dms_field_auto_classification.model_dms_classification_template +msgid "Dms Classification Template" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model,name:dms_field_auto_classification.model_dms_classification_template_detail +msgid "Dms Classification Template Detail" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__field_id +msgid "Field" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__id +msgid "ID" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__index +msgid "Index" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail____last_update +msgid "Last Modified on" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__write_date +msgid "Last Updated on" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model_id +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__model_id +msgid "Model" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__parent_id +msgid "Parent" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_wizard_dms_classification_detail__record_ref +msgid "Record Referenced" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__sequence +msgid "Sequence" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_wizard_dms_classification_detail__template_id +msgid "Template" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model,name:dms_field_auto_classification.model_wizard_dms_classification_detail +msgid "Wizard Dms Classification Detail" +msgstr "" diff --git a/dms_field_auto_classification/i18n/es.po b/dms_field_auto_classification/i18n/es.po new file mode 100644 index 000000000..7f73f5b15 --- /dev/null +++ b/dms_field_auto_classification/i18n/es.po @@ -0,0 +1,117 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * dms_field_auto_classification +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 15.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-01-23 12:22+0000\n" +"PO-Revision-Date: 2024-01-23 13:24+0100\n" +"Last-Translator: \n" +"Language-Team: \n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: \n" +"X-Generator: Poedit 3.0.1\n" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__create_uid +msgid "Created by" +msgstr "Creado por" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__create_date +msgid "Created on" +msgstr "Creado el" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__dms_directory_ids +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__dms_directory_ids +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_wizard_dms_classification_detail__dms_directory_ids +msgid "DMS Directories" +msgstr "Directorios DMS" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__detail_ids +msgid "Details" +msgstr "Detalles" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__display_name +msgid "Display Name" +msgstr "Nombre a Mostrar" + +#. module: dms_field_auto_classification +#: model:ir.model,name:dms_field_auto_classification.model_dms_classification_template +msgid "Dms Classification Template" +msgstr "Plantilla de clasificación Dms" + +#. module: dms_field_auto_classification +#: model:ir.model,name:dms_field_auto_classification.model_dms_classification_template_detail +msgid "Dms Classification Template Detail" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__field_id +msgid "Field" +msgstr "Campo" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__id +msgid "ID" +msgstr "ID" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__index +msgid "Index" +msgstr "Índice" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail____last_update +msgid "Last Modified on" +msgstr "Última Modificación el" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__write_uid +msgid "Last Updated by" +msgstr "Actualizado por última vez por" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__write_date +msgid "Last Updated on" +msgstr "Última modificación el" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model_id +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__model_id +msgid "Model" +msgstr "Modelo" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__parent_id +msgid "Parent" +msgstr "Padre" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_wizard_dms_classification_detail__record_ref +msgid "Record Referenced" +msgstr "Registro referenciado" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__sequence +msgid "Sequence" +msgstr "Secuencia" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_wizard_dms_classification_detail__template_id +msgid "Template" +msgstr "Plantilla" + +#. module: dms_field_auto_classification +#: model:ir.model,name:dms_field_auto_classification.model_wizard_dms_classification_detail +msgid "Wizard Dms Classification Detail" +msgstr "" diff --git a/dms_field_auto_classification/models/__init__.py b/dms_field_auto_classification/models/__init__.py new file mode 100644 index 000000000..cb95092bf --- /dev/null +++ b/dms_field_auto_classification/models/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import dms_classification_template diff --git a/dms_field_auto_classification/models/dms_classification_template.py b/dms_field_auto_classification/models/dms_classification_template.py new file mode 100644 index 000000000..5439e99f3 --- /dev/null +++ b/dms_field_auto_classification/models/dms_classification_template.py @@ -0,0 +1,44 @@ +# Copyright 2024 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from odoo import api, fields, models + + +class DmsClassificationTemplate(models.Model): + _inherit = "dms.classification.template" + + model_id = fields.Many2one( + comodel_name="ir.model", string="Model", domain=[("transient", "=", False)] + ) + model = fields.Char(compute="_compute_model", compute_sudo=True) + detail_ids = fields.One2many( + string="Details", + comodel_name="dms.classification.template.detail", + inverse_name="parent_id", + ) + + @api.depends("model_id") + def _compute_model(self): + for item in self: + item.model = item.model_id.model + + +class DmsClassificationTemplateDetail(models.Model): + _name = "dms.classification.template.detail" + _description = "Dms Classification Template Detail" + _order = "sequence, field_id" + + parent_id = fields.Many2one( + comodel_name="dms.classification.template", + string="Parent", + ) + model_id = fields.Many2one( + related="parent_id.model_id", + ) + field_id = fields.Many2one( + comodel_name="ir.model.fields", + domain="[('model_id', '=', model_id)]", + string="Field", + ) + index = fields.Integer(required=True, default=0) + sequence = fields.Integer(required=True, default=10) diff --git a/dms_field_auto_classification/readme/CONFIGURE.rst b/dms_field_auto_classification/readme/CONFIGURE.rst new file mode 100644 index 000000000..70c504f62 --- /dev/null +++ b/dms_field_auto_classification/readme/CONFIGURE.rst @@ -0,0 +1,10 @@ +#. Go to `Documents / Configuration / Classification Templates` and create or edit a template. +#. You can set a model to which it is linked (res.partner for example). +#. You can define the details to indicate which field is referenced by the defined filename pattern. + +Full example from res.partner: + +Filename pattern: ([0-9]{8}[A-Z]).*.pdf +Details: VAT (field) and 0 (index) +Directory Pattern example 1: {0} > This will attempt to add the files to the directory linked to the partner with the VAT name. +Directory Pattern example 2: {0} / Misc > This will attempt to add the files to the "Misc" subdirectory linked to the partner with the VAT name. diff --git a/dms_field_auto_classification/readme/CONTRIBUTORS.rst b/dms_field_auto_classification/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..5fb713053 --- /dev/null +++ b/dms_field_auto_classification/readme/CONTRIBUTORS.rst @@ -0,0 +1,4 @@ +* `Tecnativa `_: + + * Víctor Martínez + * Pedro M. Baeza diff --git a/dms_field_auto_classification/readme/DESCRIPTION.rst b/dms_field_auto_classification/readme/DESCRIPTION.rst new file mode 100644 index 000000000..5688d0c47 --- /dev/null +++ b/dms_field_auto_classification/readme/DESCRIPTION.rst @@ -0,0 +1,2 @@ +Automatically classify files within a .zip file to the corresponding directory(s) +related to an embedded DMS. diff --git a/dms_field_auto_classification/readme/USAGE.rst b/dms_field_auto_classification/readme/USAGE.rst new file mode 100644 index 000000000..b12a27bec --- /dev/null +++ b/dms_field_auto_classification/readme/USAGE.rst @@ -0,0 +1,6 @@ +#. Go to `Documents / Auto Classification` and select a template and a .zip file. +#. Press the `Analyze` button +#. As many lines will be set as the number of files contained in the .zip file and apply the filename pattern. +#. The record to which they are related (res.partner for example) will be show on the lines. +#. Press the `Classify` button +#. The files (dms.file) will be created in the corresponding directories. diff --git a/dms_field_auto_classification/security/ir.model.access.csv b/dms_field_auto_classification/security/ir.model.access.csv new file mode 100644 index 000000000..e16b79fc4 --- /dev/null +++ b/dms_field_auto_classification/security/ir.model.access.csv @@ -0,0 +1,2 @@ +id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink +access_dms_classification_template_detail_manager,dms_classification_template_detail_manager,model_dms_classification_template_detail,dms.group_dms_manager,1,1,1,1 diff --git a/dms_field_auto_classification/static/description/icon.png b/dms_field_auto_classification/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..9fd5b327acab0e692cbd7160b1f457c092ee3f1d GIT binary patch literal 5069 zcmbtYhf@3+002fEZ4KiK8T%jT zE?@LzU({4C1iiPmg&zPwr|};yjcWE@i~%?in&t=-uNQ~_J6}gYKtO<`i>I5Py`8tC zq?fN#+Qxk@0D$$Wj)s~kGJQQGDE8Ttkk_Q+58VT9PSfQj0XMEFRsQv#>u{MHdv#Az zvy=`0`MDbTIHw|NrxT6fwH7?lh%lc z8>wXhgj9BQy2ar&pmtfp1bk+a3<4XdhA!=w3=#LhhH|kfA01DSXg*cqq6tIsW%yRwQ4gvvW1Tkqf+Q_ zHwwX}lzba#KTgNbzC^9Pip>%E=pv%R_f(x)S161wQfF~zx^b`9riD+p?PN2Y>CE0z zWLH!+r6VP^t;fL|NQ-u4b4+L}VF1%=8W|#P$bud)MjCN*`#iq`@vHCNJnE9?g`@Uo z!kg`^&O;RNz!(iGVSL*i2DC@`{7txpg$RIv&2cG2sk%b3Eb)mkS~By8CxOaY{VH7K z&lMTkGcbMr3oG-_qQvetl!%~nz{UKy@Cpwee#1+e@b;SdljgFq{dIxFR-HU7aqQ)a zfvE0?2(YE>+7Cl#BjR;j_&p?n1Hc|k#!Op{$$^2I@`xJ}98FdQhRZco7N+eYH4&dg zWOEkoCZ0XTP)DmMJ6Ud@kkveNauDG();OyCu94-c4*<*wIY;Brbc4 zIFIX;r0U>y3I1#Mxj0a)(I#qczQ_ z0C_YhBP(a^lZw|C#8?O{7;~~Lb@wgUP-U8OM>_jw<|;u%Xd!*tnYedSY8ZZ%{@%Je_;t>PRD!*8VJRhZ!sxDv&V74V_pl!h&yW21lkFY;K~+du#Xqf; zmqOmyQos2a!;f`N-}QIv;Z=aHjo)n(X9mO7$WU+|C6Ud^#I-Q>ifZ<>>XPMuGfx{7 zomWBcpd#parN~^=IIvX?07Cah|ju z&E%5$!C`*nWib5KcTh>_z17Tl77Y;~2FWAH(*=yI)a^IOCKM)N%tU5-7wLppC^DRn zzr9U`z14HNbCnhl`z+J1Aack*?oZjZ$J^x<>ir6Q<5jiE1c@@muUGZg|5|+=B72PVtSg17*?DneRmElPXFzo z!w@wpRq?m$)1R1%98BdYO3Sk;VatEbRq~tCHqise$G5Ov`?$(;lB=vfKU7U3Js1+> zVL>jB3$DC2|DIPzrl`|2^3c4pP3TGKbLTa)K1C_}YLB!FgWtY?w~+IidJvqcXfQXy zQE%Mq48a)Z1wc+Koqc+*F%=a{yGm;#Y+sKhNl?be*HZSNW{~zb^3w}2z22M!8%PRl zYcA%PlcNrIc6Qi}Mr1MRhdK#o%tx&xnJ5>gNuS}am7x}xpUY3j&iPQXuC_~$RXH)W z$B653cKawGmZhUL-sz{6HM%3BYHKg@pESRjZzqk|m5_>g#k|L?HEOXlX5UdpYLWca zuceZ;RKJvI?_RRK$muuR`+`0W#{v`54hTqe@sb))HNP1iUT{Z0k=u)>FleyU^8WQM z=CBLLJ1$>t8gMmWXtzDsn2e2oqSAh5y!#CI$G$s?=^9IVx`X>^;DE$mBIw->WFPo#3t{tp;? zsG@#%wmLLJ;mz}Lp`&BYiOSqLR9XrHQ~dUCH?OFOKQ~~ir08Qt^c!oKm3Pw-fh%(BZAvi zKrf|sN>N9gJ)cCn4hWTgAcuz}_I>x;6APR5HsYd1SUEl44PI&ZrbIhAlOi29H(xlT z@FC_i{_D6GseiUTve=-&E;zlVIfx!+)pWUVaoH#}{)QlVq_h6brHdqnFVX(HaCmrl z7zX8n@OU}6x>E@z+yDJ5B4M>oCPPgU>EF#K0yJ zj;wS%PXBn2Ow!1>bKMbw1!+V?Ml&!au5SG4^Qbk7(klK&uJO3WL%C5qeRhRHjhb8c zxHu~XWfN}7;5+!}Y*W~iT&O@;t*DMQljN_B>$oTqSgFkw- z)GwoJ$Y`GZ+SIsX~7S?#%tniF&SP} zL%)Cbu}&2G|c4HbP~O zdKNvlF?KWksej;lDxmE_f&Y!cO+S-~K^Q z1HC)x67_^A{W639cB~pXxH)|$#mz!gE~}i(Vihag$qPO4s2`L3*RI-~2Dzq9v3+6V zhq)r&ho0{iyqf*xGz8E$GOSw&ZhaNCZ#p%8@6{X)tJf=OdY9(LUimT`eWClu){?aC z3p2&t%WLZ&8>=u?xvUJCT-gPUc)0TQ7gAjLonsVmL4=m_ud$FV40Bjk@S5d`>w#yg zf5zK5_= zXi)Ehd^U-DbSL|GBd~kV=~36=YAx!kWw_IAk;4h`25DB|$J>orr?Ht2UdxfPw5)^+ z3C`F#*N?rfu5Be13>iH_%ChM>hFzu7jW5sNb&X+soeAHl`RXDgK4vZ1AP4DCZ|u(wY>QtZSavH+(^%#LtZGP1semZ6c3Jp3VKWa zEZO+eaxi6(ZMz-kb&d?Q`GA>G7(kd7?L~iyk&JyzcE)Nr6FnX_;L1esaO+}9>)r!E zY1oUVCp0H2D*I0kvWvu~56>QR+>^hvsXUocI^nkzCxUG|@()3LmQU#APUk2=)y%@! ztv>v$b~{Wg4`Iv;=5WNUfDN)F~EMU`DOaj zfpyD<@r!lYCzboDSJ%?C1|M&)Z>s1)OeWJm>RBM{f)nWUWzA8;g)WBK(yOZ@8jVe3 zRI?Tn19ZPX+cAbB57>uOc&1MV$X7kN_*CwG&CEJy?Q*!Qp_nFluDK`S#Gf|J}kSEdSPdkR$EQoDmHE}s2g?ZmRO-xv^ zIi^3vIJmf;J2=pgp?CCI+oki*y;336)YNdz3e52D2?eXAx`xd;oOZ!(Jwv-tVvqfY zPP4am>^9e9b%U}eX6vP~IY?rXVsdY#+o+^(eeY&933NAw;j!xJZpo&{SVguZ5paKB zYC7W}mG1;8rApbFS{WTYLGWE5D>AQvV^E1tW5v7YDQmRGSiRp80=*TMpAYeDIealV zY=iw#Q2Q;{Une6YW5TyrBJ)$J3s=B&i2M=NK}{MXypeeQ=V0d|HpJ22%j`=8Be(gJ z){?WsF{0yD3ApD~;(AhNxpre-vnZ^)$lkAo#})HqO!<`D624{!Y|a zLGZSuX`3oX2ta>}WAEt|Ti78T497o^E>N;Y-od)|ybBe=7r}2KFN(B=Kmr$@FhF-_ z@?;{<{a_6bK6;z z71TD^{i3Jt)b+L;Zq;>T~3N1h;3Mz-2zS*1qLA zjAE}bhdJ_AU3E3SKTY0dKQ#}X94~0z)%N8CZ)-LBtI|HQp#ADz*ILWs;*NfQ>!Mhz zWvypkWo65FlB9o9v$S;3tvV7Z%kAQ-iBl5ts}w*FLE{2Q$CGH?agrPqS`l)*uPHe) z?4U_U4FY27mNJ9BL*tY->T*5(o+WYjJ{Nb%M!bBv-Ez=ezG}3L@54q*JAM)$shmS6 zm_~xN=76HH9c;!N(YHTIvpmuM?=8@#{fr-zQ1=ih=!5w`EBG^a^}JY1=*M=;>Gxff z%LMgzuZ zWyO~br+imyznR!;=TMdDE=qbXlF>9?LV(gzAudyWJ~~B1`xDpAdXZwWz-8=14f68t z@m8^zkCm{;I0r5~ZhXE#$PtR2_An%4nJ1P6^VeuhN63#ttPEtf)VJE5x%wLn)ab;! zTh)Lj^owS1^F=78_>Tk@L-|LcC5DJ1 z*7Aa@#K}j8>dtvg`F=VM3I3b`eaHo5z5O5eA0eS1EL16mwIW(gkf1R*+>Egh>0#6PMSrCN^Pn2-UBWr6EtEV5NCKHZRB#=DnncXce6=`v zX90RGNJHDr@0F?}>oo2pgHu=26|6_65FL0TOB@-C^FdM&@tDu^hM+Lt46U1M(Ax>y zo7QDjVD!yJ1=ugS2$0ljYECf!tOC<=%?;*MEmI@9LRTLj@XZC5w|Gra+xLQcx^xit zG<3e>Y4&&3+W?z}#iZ_1#1Xmw!80;lu^0+2u|YMnHLTZzSFexhWT9&J(M}fVrTG}y zZbNB2Jyum(Z@Vt%ag-??%cS`xiZJ}qg`!&wP8b#sqInH6e=SOLZye$=E_6v2M48Gh zZwXX=Mg(ld$WQz`beB7(&jQWf{8%jZJMX$ql7zuZ)}q3~C3T~_LlF_ey!Q~xev58X zvu*RWQ@`zn6XQ9O{A(S@m2se + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dms_field_auto_classification/static/description/index.html b/dms_field_auto_classification/static/description/index.html new file mode 100644 index 000000000..65d75ce79 --- /dev/null +++ b/dms_field_auto_classification/static/description/index.html @@ -0,0 +1,453 @@ + + + + + +Auto classify files into embedded DMS + + + +
+

Auto classify files into embedded DMS

+ + +

Beta License: AGPL-3 OCA/dms Translate me on Weblate Try me on Runboat

+

Automatically classify files within a .zip file to the corresponding directory(s) +related to an embedded DMS.

+

Table of contents

+ +
+

Configuration

+
    +
  1. Go to Documents / Configuration / Classification Templates and create or edit a template.
  2. +
  3. You can set a model to which it is linked (res.partner for example).
  4. +
  5. You can define the details to indicate which field is referenced by the defined filename pattern.
  6. +
+

Full example from res.partner:

+

Filename pattern: ([0-9]{8}[A-Z]).*.pdf +Details: VAT (field) and 0 (index) +Directory Pattern example 1: {0} > This will attempt to add the files to the directory linked to the partner with the VAT name. +Directory Pattern example 2: {0} / Misc > This will attempt to add the files to the “Misc” subdirectory linked to the partner with the VAT name.

+
+
+

Usage

+
    +
  1. Go to Documents / Auto Classification and select a template and a .zip file.
  2. +
  3. Press the Analyze button
  4. +
  5. As many lines will be set as the number of files contained in the .zip file and apply the filename pattern.
  6. +
  7. The record to which they are related (res.partner for example) will be show on the lines.
  8. +
  9. Press the Classify button
  10. +
  11. The files (dms.file) will be created in the corresponding directories.
  12. +
+
+
+

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

+
    +
  • Tecnativa
  • +
+
+
+

Contributors

+
    +
  • Tecnativa:
      +
    • Víctor Martínez
    • +
    • Pedro M. Baeza
    • +
    +
  • +
+
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

Current maintainer:

+

victoralmau

+

This module is part of the OCA/dms project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/dms_field_auto_classification/tests/__init__.py b/dms_field_auto_classification/tests/__init__.py new file mode 100644 index 000000000..0be859d20 --- /dev/null +++ b/dms_field_auto_classification/tests/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl) + +from . import test_dms_field_auto_classification diff --git a/dms_field_auto_classification/tests/data/test.zip b/dms_field_auto_classification/tests/data/test.zip new file mode 100644 index 0000000000000000000000000000000000000000..155578038e3eb9c70819744f2fd3821da58f0cfa GIT binary patch literal 2902 zcmeH}`#aMM7{I@?%W;WnD?{Wcq*OQ3@3gBpq;X|y_YThB3ks_7VM_0Jzv&FL47!)BYU457<2g2S0Z zu*dhv(ZQoejd#<7d0IY?*@Ur4)ELxQo_}0glBD3Atj;y2(4awikELt)^Ba|+ZS%Uq37shd(huAJ*4Cu{F*&}# z4JTAy7`WCG^#_-h_Ija()R-16LO33)p3iZtp}pHi3vXCD3@2*Mv|rWKg>zFtAEU6K zn3Gw}HY6!peJ7rl%ry-fprJW8MWYHUI_fYbvNt22M`#-ktkuEbwv9Js;Vvh&)Y)5* z8(b2@?wl<5i18MXb}hf%PrtX1V5PcnkW!|yvtz?2zBnXX%2HSUr>Aqf{uCM;<*SGc zn{jiP9l9DbdIQOUpeCiNG|fF{u7GW%H14~Cp%N_0jRYk(AB6J`R`F~=6s<+!wyoCv z5AWZke5^RC=MABq&JE4eK=^6Iq(5<%8+2o(CzQg*Ga}!1T*oW9{oK#~0>*oO`$ZRs z@%=iEG8Q6_e{vC9JUw#2JjbNF7&YP>_essDmkezvWYML4-$P^{*Tty^V{bj^rl?xW z?V(5&JA%$pP#lon1e$-kZk)TErQM=x_;IRVH%wiWR^2s73_TPQsjda z(u`cf)8x2iT zRjScYpnI?@X$3#oGwHI6I&Uafp`cXZls}O}-w|WbVG`Gcj*sZep1_J$BrDNT-JY!o zcEmH3#*>(Hvs0i+C{=S~03Lo=3o>aJi5^XDF@{SDC6*+U>naqaO^9C9jZffU!fOkE zMP2ljm!s-renng6j3}2NAD7n5`LH~j$2qs0f`AecljTnA8FBXRwi8~4${{xGZCzIi zU!OW&FE(99ZB>^(8{LvSp|W#2bqIFvLXB)a&1%FeL1?i1Q9qoQ_wTM0J z7%mbR5}6(k7m<%@=FW;E?Tbx&o6cJ(DFPy_@(8tz6WL*;Dtt+}?WEtQk0O@VULz@p zDjixE-KCS;{B25lWCr5t&x$i%yKYKqlJsz871?nzr}*{{98lsxH>%l%QvS9Q&QLoS zi7eJ$sZ6#p+)|IWj*q4XRey%&UqzX}?Hqf$Q1ng7&b%r$fa$v-n1$5W<%09oTBG{m zqXO7j@RUh^hBzeeM3HUbv~p6EAJ+eI*+rM~#)}!&=3~EOAbgk8^7H)C@MLa5qI-kP zXX8vc(iRL+BGhMllT$Z3sAfwRWZ-u8m}NCaOTIkK9yY)mZ@mw3^k?-={UE3jN1a*I259?f*S#w<^JFc>SZ3P}ukX601?P+HXmJ G-~Iwb?m4ai literal 0 HcmV?d00001 diff --git a/dms_field_auto_classification/tests/test_dms_field_auto_classification.py b/dms_field_auto_classification/tests/test_dms_field_auto_classification.py new file mode 100644 index 000000000..1977d00fe --- /dev/null +++ b/dms_field_auto_classification/tests/test_dms_field_auto_classification.py @@ -0,0 +1,187 @@ +# Copyright 2024 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from base64 import b64encode +from os import path + +from odoo.tests import Form, common, new_test_user +from odoo.tests.common import users + + +class TestDmsFieldAutoClassification(common.TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.template = cls.env.ref( + "dms_field_auto_classification.dms_classification_template_partners" + ) + cls.user = new_test_user( + cls.env, login="test_dms_manager_user", groups="dms.group_dms_manager" + ) + access_group = cls.env.ref("dms.access_group_01_demo") + access_group.explicit_user_ids = [(4, cls.user.id)] + file_template = cls.env["dms.field.template"].create( + { + "name": "Test partner template", + "storage_id": cls.env.ref("dms.storage_demo").id, + "model_id": cls.env.ref("base.model_res_partner").id, + "group_ids": [(4, access_group.id)], + "directory_format_name": "{{object.vat}}", + } + ) + file_template_ctx = file_template.with_context( + res_model=file_template._name, res_id=file_template.id + ) + file_template_ctx.create_dms_directory() + file_template_ctx.refresh() + cls.partner_a = cls.env["res.partner"].create( + { + "name": "Test partner A", + "vat": "82326033V", + } + ) + cls.partner_b = cls.env["res.partner"].create( + { + "name": "Test partner B", + "vat": "58426469Y", + } + ) + cls.wizard = cls._create_wizard_dms_classification(cls, cls.template) + cls.extra_wizard = cls._create_wizard_dms_classification(cls, cls.template) + + def _data_file(self, filename, encoding=None): + mode = "rt" if encoding else "rb" + with open(path.join(path.dirname(__file__), filename), mode) as file: + data = file.read() + if encoding: + data = data.encode(encoding) + return b64encode(data) + + def _create_wizard_dms_classification(self, template): + wizard_form = Form(self.env["wizard.dms.classification"]) + wizard_form.template_id = template + wizard_form.data_file = self._data_file(self, "data/test.zip") + return wizard_form.save() + + def test_partner_misc(self): + self.assertEqual(self.partner_a.dms_directory_ids.name, "82326033V") + self.assertEqual(self.partner_b.dms_directory_ids.name, "58426469Y") + + @users("test_dms_manager_user") + def test_wizard_dms_clasification_process(self): + self.wizard = self.wizard.with_user(self.env.user) + self.assertEqual(self.wizard.state, "draft") + # Wizard - Analyze process + self.wizard.action_analyze() + self.assertEqual(self.wizard.state, "analyze") + self.assertEqual(len(self.wizard.detail_ids), 2) + file_names = self.wizard.mapped("detail_ids.file_name") + self.assertIn("82326033V.pdf", file_names) + self.assertIn("58426469Y.pdf", file_names) + detail_1 = self.wizard.detail_ids.filtered( + lambda x: x.file_name == "82326033V.pdf" + ) + self.assertEqual(detail_1.state, "to_classify") + self.assertEqual(detail_1.directory_id, self.partner_a.dms_directory_ids) + self.assertEqual(detail_1.record_ref, self.partner_a) + detail_2 = self.wizard.detail_ids.filtered( + lambda x: x.file_name == "58426469Y.pdf" + ) + self.assertEqual(detail_2.state, "to_classify") + self.assertEqual(detail_2.directory_id, self.partner_b.dms_directory_ids) + self.assertEqual(detail_2.record_ref, self.partner_b) + # Wizard - Classify process + res = self.wizard.action_classify() + dms_files = self.env[res["res_model"]].search(res["domain"]) + self.assertEqual(len(dms_files), 2) + self.assertEqual( + detail_1.file_id.directory_id, self.partner_a.dms_directory_ids + ) + self.assertEqual(detail_1.file_id.name, "82326033V.pdf") + self.assertTrue(detail_1.file_id.content) + self.assertEqual(detail_1.file_id.res_model, self.partner_a._name) + self.assertEqual(detail_1.file_id.res_id, self.partner_a.id) + self.assertEqual( + detail_2.file_id.directory_id, self.partner_b.dms_directory_ids + ) + self.assertEqual(detail_2.file_id.name, "58426469Y.pdf") + self.assertTrue(detail_2.file_id.content) + self.assertEqual(detail_2.file_id.res_model, self.partner_b._name) + self.assertEqual(detail_2.file_id.res_id, self.partner_b.id) + # Extra wizard + self.extra_wizard = self.extra_wizard.with_user(self.env.user) + self.assertEqual(self.extra_wizard.state, "draft") + # New Wizard - Analyze process + self.extra_wizard.action_analyze() + self.assertEqual(self.extra_wizard.state, "analyze") + self.assertEqual(len(self.extra_wizard.detail_ids), 2) + file_names = self.extra_wizard.mapped("detail_ids.file_name") + self.assertIn("82326033V.pdf", file_names) + self.assertIn("58426469Y.pdf", file_names) + detail_1 = self.extra_wizard.detail_ids.filtered( + lambda x: x.file_name == "82326033V.pdf" + ) + self.assertEqual(detail_1.directory_id, self.partner_a.dms_directory_ids) + self.assertTrue(detail_1.file_id) + self.assertEqual(detail_1.record_ref, self.partner_a) + self.assertEqual(detail_1.state, "classified") + detail_2 = self.extra_wizard.detail_ids.filtered( + lambda x: x.file_name == "58426469Y.pdf" + ) + self.assertEqual(detail_2.directory_id, self.partner_b.dms_directory_ids) + self.assertTrue(detail_2.file_id) + self.assertEqual(detail_2.record_ref, self.partner_b) + self.assertEqual(detail_1.state, "classified") + # New Wizard - Classify process + res = self.extra_wizard.action_classify() + new_dms_files = self.env[res["res_model"]].search(res["domain"]) - dms_files + self.assertEqual(len(new_dms_files), 0) + + @users("test_dms_manager_user") + def test_wizard_dms_clasification_process_filename_pattern(self): + self.template.filename_pattern = self.template.filename_pattern.replace( + ".pdf", ".txt" + ) + self.assertEqual(self.wizard.state, "draft") + self.wizard = self.wizard.with_user(self.env.user) + self.wizard.action_analyze() + self.assertEqual(self.wizard.state, "analyze") + self.assertEqual(len(self.wizard.detail_ids), 0) + + @users("test_dms_manager_user") + def test_wizard_dms_clasification_process_subdirectory(self): + self.template.directory_pattern = "{0} / Misc" + # Create subdirectory to partner a + directory_misc_a = self.env["dms.directory"].create( + {"name": "Misc", "parent_id": self.partner_a.dms_directory_ids.id} + ) + # Create subdirectory to partner b + directory_misc_b = self.env["dms.directory"].create( + {"name": "Misc", "parent_id": self.partner_b.dms_directory_ids.id} + ) + # Wizard - Analyze process + self.wizard = self.wizard.with_user(self.env.user) + self.wizard.action_analyze() + self.assertEqual(self.wizard.state, "analyze") + self.assertEqual(len(self.wizard.detail_ids), 2) + file_names = self.wizard.mapped("detail_ids.file_name") + self.assertIn("82326033V.pdf", file_names) + self.assertIn("58426469Y.pdf", file_names) + detail_1 = self.wizard.detail_ids.filtered( + lambda x: x.file_name == "82326033V.pdf" + ) + self.assertEqual(detail_1.state, "to_classify") + self.assertEqual(detail_1.directory_id, directory_misc_a) + self.assertEqual(detail_1.record_ref, self.partner_a) + detail_2 = self.wizard.detail_ids.filtered( + lambda x: x.file_name == "58426469Y.pdf" + ) + self.assertEqual(detail_2.state, "to_classify") + self.assertEqual(detail_2.directory_id, directory_misc_b) + self.assertEqual(detail_2.record_ref, self.partner_b) + # Wizard - Classify process + res = self.wizard.action_classify() + dms_files = self.env[res["res_model"]].search(res["domain"]) + self.assertEqual(len(dms_files), 2) + self.assertEqual(detail_1.file_id.directory_id, directory_misc_a) + self.assertEqual(detail_2.file_id.directory_id, directory_misc_b) diff --git a/dms_field_auto_classification/views/dms_classification_template_views.xml b/dms_field_auto_classification/views/dms_classification_template_views.xml new file mode 100644 index 000000000..5f7a11825 --- /dev/null +++ b/dms_field_auto_classification/views/dms_classification_template_views.xml @@ -0,0 +1,40 @@ + + + + dms.classification.template tree + dms.classification.template + + + + + + + + + dms.classification.template form + dms.classification.template + + + + + + + + + + + + + + + + diff --git a/dms_field_auto_classification/wizards/__init__.py b/dms_field_auto_classification/wizards/__init__.py new file mode 100644 index 000000000..4ba9cc23a --- /dev/null +++ b/dms_field_auto_classification/wizards/__init__.py @@ -0,0 +1,3 @@ +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from . import wizard_dms_classification diff --git a/dms_field_auto_classification/wizards/wizard_dms_classification.py b/dms_field_auto_classification/wizards/wizard_dms_classification.py new file mode 100644 index 000000000..c3f473331 --- /dev/null +++ b/dms_field_auto_classification/wizards/wizard_dms_classification.py @@ -0,0 +1,79 @@ +# Copyright 2024 Tecnativa - Víctor Martínez +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +import re + +from odoo import api, fields, models + + +class WizardDmsClassificationDetail(models.TransientModel): + _inherit = "wizard.dms.classification.detail" + + template_id = fields.Many2one(related="parent_id.template_id") + record_ref = fields.Reference( + string="Record Referenced", + compute="_compute_record_ref", + selection=lambda self: self._get_ref_selection(), + ) + + @api.model + def _get_ref_selection(self): + models = self.env["ir.model"].sudo().search([("transient", "=", False)]) + return [(model.model, model.name) for model in models] + + @api.depends( + "directory_id", + "directory_id.root_directory_id", + "directory_id.res_model", + "directory_id.res_id", + ) + def _compute_record_ref(self): + """Set the linked record according to directory or root directory (to be + correct if we are in a subdirectory).""" + for record in self: + directory = False + if record.directory_id.res_model and record.directory_id.res_id: + directory = record.directory_id + elif ( + record.directory_id.root_directory_id.res_model + and record.directory_id.root_directory_id.res_id + ): + directory = record.directory_id.root_directory_id + record.record_ref = ( + "{},{}".format(directory.res_model, directory.res_id) + if directory + else False + ) + + @api.depends("file_name", "template_id.model_id") + def _compute_directory_id(self): + """Overwrite to redefine the directory if the template has a linked model.""" + self_with_model = self.filtered(lambda x: x.template_id.model_id) + directory_model = self.env["dms.directory"].sudo() + for item in self_with_model: + domain = [ + ("res_model", "=", item.template_id.model_id.model), + ("res_id", ">", 0), + ] + directories = directory_model.search(domain) + # We also add the subdirectorior because they are necessary and have not + # set res_model and res_id + directories += directories.mapped("child_directory_ids") + if directories: + matches = re.search(item.template_id.filename_pattern, item.file_name) + if matches: + directory_pattern = item.template_id.directory_pattern + for detail in item.template_id.detail_ids: + matches_value = matches.groups()[detail.index] + # Change directory pattern if index in pattern + expected = "{%s}" % detail.index + if expected in directory_pattern: + directory_pattern = directory_pattern.replace( + expected, matches_value + ) + # Search directories according to directory_pattern + item.directory_id = self.parent_id._get_directory_from_pattern( + directory_pattern, directories + ) + return super( + WizardDmsClassificationDetail, (self - self_with_model) + )._compute_directory_id() diff --git a/dms_field_auto_classification/wizards/wizard_dms_classification_views.xml b/dms_field_auto_classification/wizards/wizard_dms_classification_views.xml new file mode 100644 index 000000000..181634dc5 --- /dev/null +++ b/dms_field_auto_classification/wizards/wizard_dms_classification_views.xml @@ -0,0 +1,19 @@ + + + + wizard.dms.classification form + wizard.dms.classification + + + + + + + + From 7e4a807c5889e5f9ee3a85c7634cd5449f5297b9 Mon Sep 17 00:00:00 2001 From: Ivorra78 Date: Sat, 23 Mar 2024 07:22:46 +0000 Subject: [PATCH 02/21] Translated using Weblate (Spanish) Currently translated at 100.0% (19 of 19 strings) Translation: dms-15.0/dms-15.0-dms_field_auto_classification Translate-URL: https://translation.odoo-community.org/projects/dms-15-0/dms-15-0-dms_field_auto_classification/es/ --- dms_field_auto_classification/i18n/es.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dms_field_auto_classification/i18n/es.po b/dms_field_auto_classification/i18n/es.po index 7f73f5b15..6147dadac 100644 --- a/dms_field_auto_classification/i18n/es.po +++ b/dms_field_auto_classification/i18n/es.po @@ -7,15 +7,15 @@ msgstr "" "Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-01-23 12:22+0000\n" -"PO-Revision-Date: 2024-01-23 13:24+0100\n" -"Last-Translator: \n" +"PO-Revision-Date: 2024-03-23 09:34+0000\n" +"Last-Translator: Ivorra78 \n" "Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: \n" -"X-Generator: Poedit 3.0.1\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__create_uid @@ -52,7 +52,7 @@ msgstr "Plantilla de clasificación Dms" #. module: dms_field_auto_classification #: model:ir.model,name:dms_field_auto_classification.model_dms_classification_template_detail msgid "Dms Classification Template Detail" -msgstr "" +msgstr "Plantilla de Clasificación Dms Detalle" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__field_id @@ -114,4 +114,4 @@ msgstr "Plantilla" #. module: dms_field_auto_classification #: model:ir.model,name:dms_field_auto_classification.model_wizard_dms_classification_detail msgid "Wizard Dms Classification Detail" -msgstr "" +msgstr "Asistente de Clasificación Dms Detalle" From 40cdc34082d572cde9ede3d9f191d43f42e3f7c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Mon, 27 May 2024 09:54:46 +0200 Subject: [PATCH 03/21] [MIG] dms_field_auto_classification: Migration to 16.0 TT48868 [UPD] Update dms_field_auto_classification.pot [BOT] post-merge updates Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: dms-16.0/dms-16.0-dms_field_auto_classification Translate-URL: https://translation.odoo-community.org/projects/dms-16-0/dms-16-0-dms_field_auto_classification/ --- dms_field_auto_classification/README.rst | 12 ++++++------ dms_field_auto_classification/__manifest__.py | 2 +- .../i18n/dms_field_auto_classification.pot | 9 +-------- dms_field_auto_classification/i18n/es.po | 10 +++------- .../static/description/index.html | 8 ++++---- .../tests/test_dms_field_auto_classification.py | 8 +++++--- 6 files changed, 20 insertions(+), 29 deletions(-) diff --git a/dms_field_auto_classification/README.rst b/dms_field_auto_classification/README.rst index 7c2f0896b..70f9650ca 100644 --- a/dms_field_auto_classification/README.rst +++ b/dms_field_auto_classification/README.rst @@ -7,7 +7,7 @@ Auto classify files into embedded DMS !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:b911efe5581effdf1f3bb9239c2e7604fafa018005c336ed341e1a94650c1d8e + !! source digest: sha256:f9e61c45fe637e3b07f0af3a113ed6f1d31c97f9c5994aa88ae3e1c30c0d4759 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png @@ -17,13 +17,13 @@ Auto classify files into embedded DMS :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fdms-lightgray.png?logo=github - :target: https://github.com/OCA/dms/tree/15.0/dms_field_auto_classification + :target: https://github.com/OCA/dms/tree/16.0/dms_field_auto_classification :alt: OCA/dms .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/dms-15-0/dms-15-0-dms_field_auto_classification + :target: https://translation.odoo-community.org/projects/dms-16-0/dms-16-0-dms_field_auto_classification :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/dms&target_branch=15.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/dms&target_branch=16.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -66,7 +66,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -107,6 +107,6 @@ Current `maintainer `__: |maintainer-victoralmau| -This module is part of the `OCA/dms `_ project on GitHub. +This module is part of the `OCA/dms `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/dms_field_auto_classification/__manifest__.py b/dms_field_auto_classification/__manifest__.py index c25143f9b..dcf5add06 100644 --- a/dms_field_auto_classification/__manifest__.py +++ b/dms_field_auto_classification/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Auto classify files into embedded DMS", - "version": "15.0.1.0.0", + "version": "16.0.1.0.0", "category": "Document Management", "website": "https://github.com/OCA/dms", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/dms_field_auto_classification/i18n/dms_field_auto_classification.pot b/dms_field_auto_classification/i18n/dms_field_auto_classification.pot index eef33b03b..8a3418ebd 100644 --- a/dms_field_auto_classification/i18n/dms_field_auto_classification.pot +++ b/dms_field_auto_classification/i18n/dms_field_auto_classification.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 15.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -23,13 +23,6 @@ msgstr "" msgid "Created on" msgstr "" -#. module: dms_field_auto_classification -#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__dms_directory_ids -#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__dms_directory_ids -#: model:ir.model.fields,field_description:dms_field_auto_classification.field_wizard_dms_classification_detail__dms_directory_ids -msgid "DMS Directories" -msgstr "" - #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__detail_ids msgid "Details" diff --git a/dms_field_auto_classification/i18n/es.po b/dms_field_auto_classification/i18n/es.po index 6147dadac..15813c086 100644 --- a/dms_field_auto_classification/i18n/es.po +++ b/dms_field_auto_classification/i18n/es.po @@ -27,13 +27,6 @@ msgstr "Creado por" msgid "Created on" msgstr "Creado el" -#. module: dms_field_auto_classification -#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__dms_directory_ids -#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__dms_directory_ids -#: model:ir.model.fields,field_description:dms_field_auto_classification.field_wizard_dms_classification_detail__dms_directory_ids -msgid "DMS Directories" -msgstr "Directorios DMS" - #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__detail_ids msgid "Details" @@ -115,3 +108,6 @@ msgstr "Plantilla" #: model:ir.model,name:dms_field_auto_classification.model_wizard_dms_classification_detail msgid "Wizard Dms Classification Detail" msgstr "Asistente de Clasificación Dms Detalle" + +#~ msgid "DMS Directories" +#~ msgstr "Directorios DMS" diff --git a/dms_field_auto_classification/static/description/index.html b/dms_field_auto_classification/static/description/index.html index 65d75ce79..e7dea809f 100644 --- a/dms_field_auto_classification/static/description/index.html +++ b/dms_field_auto_classification/static/description/index.html @@ -366,9 +366,9 @@

Auto classify files into embedded DMS

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:b911efe5581effdf1f3bb9239c2e7604fafa018005c336ed341e1a94650c1d8e +!! source digest: sha256:f9e61c45fe637e3b07f0af3a113ed6f1d31c97f9c5994aa88ae3e1c30c0d4759 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/dms Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/dms Translate me on Weblate Try me on Runboat

Automatically classify files within a .zip file to the corresponding directory(s) related to an embedded DMS.

Table of contents

@@ -414,7 +414,7 @@

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.

+feedback.

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

@@ -444,7 +444,7 @@

Maintainers

promote its widespread use.

Current maintainer:

victoralmau

-

This module is part of the OCA/dms project on GitHub.

+

This module is part of the OCA/dms project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/dms_field_auto_classification/tests/test_dms_field_auto_classification.py b/dms_field_auto_classification/tests/test_dms_field_auto_classification.py index 1977d00fe..c8424cec1 100644 --- a/dms_field_auto_classification/tests/test_dms_field_auto_classification.py +++ b/dms_field_auto_classification/tests/test_dms_field_auto_classification.py @@ -4,11 +4,13 @@ from base64 import b64encode from os import path -from odoo.tests import Form, common, new_test_user +from odoo.tests import Form, new_test_user from odoo.tests.common import users +from odoo.addons.base.tests.common import BaseCommon -class TestDmsFieldAutoClassification(common.TransactionCase): + +class TestDmsFieldAutoClassification(BaseCommon): @classmethod def setUpClass(cls): super().setUpClass() @@ -33,7 +35,7 @@ def setUpClass(cls): res_model=file_template._name, res_id=file_template.id ) file_template_ctx.create_dms_directory() - file_template_ctx.refresh() + file_template_ctx.invalidate_model() cls.partner_a = cls.env["res.partner"].create( { "name": "Test partner A", From 483d50fc26cbd1d14320578ae3f722ab72008467 Mon Sep 17 00:00:00 2001 From: mymage Date: Mon, 24 Jun 2024 15:05:33 +0000 Subject: [PATCH 04/21] Added translation using Weblate (Italian) Translated using Weblate (Italian) Currently translated at 100.0% (18 of 18 strings) Translation: dms-16.0/dms-16.0-dms_field_auto_classification Translate-URL: https://translation.odoo-community.org/projects/dms-16-0/dms-16-0-dms_field_auto_classification/it/ --- dms_field_auto_classification/i18n/it.po | 109 +++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100644 dms_field_auto_classification/i18n/it.po diff --git a/dms_field_auto_classification/i18n/it.po b/dms_field_auto_classification/i18n/it.po new file mode 100644 index 000000000..57735a4b0 --- /dev/null +++ b/dms_field_auto_classification/i18n/it.po @@ -0,0 +1,109 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * dms_field_auto_classification +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2024-07-04 17:47+0000\n" +"Last-Translator: mymage \n" +"Language-Team: none\n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__create_uid +msgid "Created by" +msgstr "Creato da" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__create_date +msgid "Created on" +msgstr "Creato il" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__detail_ids +msgid "Details" +msgstr "Dettagli" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__display_name +msgid "Display Name" +msgstr "Nome visualizzato" + +#. module: dms_field_auto_classification +#: model:ir.model,name:dms_field_auto_classification.model_dms_classification_template +msgid "Dms Classification Template" +msgstr "Modello classificazione DMS" + +#. module: dms_field_auto_classification +#: model:ir.model,name:dms_field_auto_classification.model_dms_classification_template_detail +msgid "Dms Classification Template Detail" +msgstr "Dettagli modello classificazione DMS" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__field_id +msgid "Field" +msgstr "Campo" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__id +msgid "ID" +msgstr "ID" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__index +msgid "Index" +msgstr "Indice" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail____last_update +msgid "Last Modified on" +msgstr "Ultima modifica il" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__write_uid +msgid "Last Updated by" +msgstr "Ultimo aggiornamento di" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__write_date +msgid "Last Updated on" +msgstr "Ultimo aggiornamento il" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model_id +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__model_id +msgid "Model" +msgstr "Modello" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__parent_id +msgid "Parent" +msgstr "Padre" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_wizard_dms_classification_detail__record_ref +msgid "Record Referenced" +msgstr "Record referenziato" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__sequence +msgid "Sequence" +msgstr "Sequenza" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_wizard_dms_classification_detail__template_id +msgid "Template" +msgstr "Modello" + +#. module: dms_field_auto_classification +#: model:ir.model,name:dms_field_auto_classification.model_wizard_dms_classification_detail +msgid "Wizard Dms Classification Detail" +msgstr "Dettagli procedura guidata classificazione DMS" From c5e53da3292518dca6ab886bbfd0886d3421cb0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Mon, 30 Sep 2024 11:00:39 +0200 Subject: [PATCH 05/21] [IMP] dms_field_auto_classification: Remove warning by several names with the same label WARNING devel odoo.addons.base.models.ir_model: Two fields (model, model_id) of dms.classification.template() have the same label: Model. [Modules: dms_field_auto_classification and dms_field_auto_classification] TT51051 [UPD] Update dms_field_auto_classification.pot [BOT] post-merge updates Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: dms-16.0/dms-16.0-dms_field_auto_classification Translate-URL: https://translation.odoo-community.org/projects/dms-16-0/dms-16-0-dms_field_auto_classification/ --- dms_field_auto_classification/README.rst | 2 +- dms_field_auto_classification/__manifest__.py | 2 +- .../i18n/dms_field_auto_classification.pot | 6 +++++- dms_field_auto_classification/i18n/es.po | 6 +++++- dms_field_auto_classification/i18n/it.po | 6 +++++- .../models/dms_classification_template.py | 4 +++- .../static/description/index.html | 13 ++++++++----- 7 files changed, 28 insertions(+), 11 deletions(-) diff --git a/dms_field_auto_classification/README.rst b/dms_field_auto_classification/README.rst index 70f9650ca..9543a5846 100644 --- a/dms_field_auto_classification/README.rst +++ b/dms_field_auto_classification/README.rst @@ -7,7 +7,7 @@ Auto classify files into embedded DMS !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:f9e61c45fe637e3b07f0af3a113ed6f1d31c97f9c5994aa88ae3e1c30c0d4759 + !! source digest: sha256:84801ed75969b9476dcc8b7deb9fc7b7f5ca212b9eea86f03079696cae406502 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/dms_field_auto_classification/__manifest__.py b/dms_field_auto_classification/__manifest__.py index dcf5add06..8dd12206c 100644 --- a/dms_field_auto_classification/__manifest__.py +++ b/dms_field_auto_classification/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Auto classify files into embedded DMS", - "version": "16.0.1.0.0", + "version": "16.0.1.0.1", "category": "Document Management", "website": "https://github.com/OCA/dms", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/dms_field_auto_classification/i18n/dms_field_auto_classification.pot b/dms_field_auto_classification/i18n/dms_field_auto_classification.pot index 8a3418ebd..f69d22f12 100644 --- a/dms_field_auto_classification/i18n/dms_field_auto_classification.pot +++ b/dms_field_auto_classification/i18n/dms_field_auto_classification.pot @@ -74,12 +74,16 @@ msgid "Last Updated on" msgstr "" #. module: dms_field_auto_classification -#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model_id #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__model_id msgid "Model" msgstr "" +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model +msgid "Model name" +msgstr "" + #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__parent_id msgid "Parent" diff --git a/dms_field_auto_classification/i18n/es.po b/dms_field_auto_classification/i18n/es.po index 15813c086..eec68c57b 100644 --- a/dms_field_auto_classification/i18n/es.po +++ b/dms_field_auto_classification/i18n/es.po @@ -78,12 +78,16 @@ msgid "Last Updated on" msgstr "Última modificación el" #. module: dms_field_auto_classification -#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model_id #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__model_id msgid "Model" msgstr "Modelo" +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model +msgid "Model name" +msgstr "" + #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__parent_id msgid "Parent" diff --git a/dms_field_auto_classification/i18n/it.po b/dms_field_auto_classification/i18n/it.po index 57735a4b0..61c5557df 100644 --- a/dms_field_auto_classification/i18n/it.po +++ b/dms_field_auto_classification/i18n/it.po @@ -77,12 +77,16 @@ msgid "Last Updated on" msgstr "Ultimo aggiornamento il" #. module: dms_field_auto_classification -#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model_id #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__model_id msgid "Model" msgstr "Modello" +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model +msgid "Model name" +msgstr "" + #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__parent_id msgid "Parent" diff --git a/dms_field_auto_classification/models/dms_classification_template.py b/dms_field_auto_classification/models/dms_classification_template.py index 5439e99f3..77fe1b647 100644 --- a/dms_field_auto_classification/models/dms_classification_template.py +++ b/dms_field_auto_classification/models/dms_classification_template.py @@ -10,7 +10,9 @@ class DmsClassificationTemplate(models.Model): model_id = fields.Many2one( comodel_name="ir.model", string="Model", domain=[("transient", "=", False)] ) - model = fields.Char(compute="_compute_model", compute_sudo=True) + model = fields.Char( + compute="_compute_model", string="Model name", compute_sudo=True + ) detail_ids = fields.One2many( string="Details", comodel_name="dms.classification.template.detail", diff --git a/dms_field_auto_classification/static/description/index.html b/dms_field_auto_classification/static/description/index.html index e7dea809f..d9f5f0b97 100644 --- a/dms_field_auto_classification/static/description/index.html +++ b/dms_field_auto_classification/static/description/index.html @@ -8,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -274,7 +275,7 @@ margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -300,7 +301,7 @@ span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -366,7 +367,7 @@

Auto classify files into embedded DMS

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:f9e61c45fe637e3b07f0af3a113ed6f1d31c97f9c5994aa88ae3e1c30c0d4759 +!! source digest: sha256:84801ed75969b9476dcc8b7deb9fc7b7f5ca212b9eea86f03079696cae406502 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/dms Translate me on Weblate Try me on Runboat

Automatically classify files within a .zip file to the corresponding directory(s) @@ -438,7 +439,9 @@

Contributors

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

From 0551afc5f7b12bbea68df13465b158d8aa115ddd Mon Sep 17 00:00:00 2001 From: mymage Date: Thu, 3 Oct 2024 07:39:51 +0000 Subject: [PATCH 06/21] Translated using Weblate (Italian) Currently translated at 100.0% (19 of 19 strings) Translation: dms-16.0/dms-16.0-dms_field_auto_classification Translate-URL: https://translation.odoo-community.org/projects/dms-16-0/dms-16-0-dms_field_auto_classification/it/ --- dms_field_auto_classification/i18n/it.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dms_field_auto_classification/i18n/it.po b/dms_field_auto_classification/i18n/it.po index 61c5557df..64ca3fdf4 100644 --- a/dms_field_auto_classification/i18n/it.po +++ b/dms_field_auto_classification/i18n/it.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2024-07-04 17:47+0000\n" +"PO-Revision-Date: 2024-10-03 10:06+0000\n" "Last-Translator: mymage \n" "Language-Team: none\n" "Language: it\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.17\n" +"X-Generator: Weblate 5.6.2\n" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__create_uid @@ -85,7 +85,7 @@ msgstr "Modello" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model msgid "Model name" -msgstr "" +msgstr "Nome modello" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__parent_id From eefc76e3647ac67593a8cd3c4bbfa45ba2438cce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Tue, 19 Nov 2024 10:19:13 +0100 Subject: [PATCH 07/21] [IMP] dms_field: Add partner embedded DMS template Fixes https://github.com/OCA/dms/issues/377 [BOT] post-merge updates --- dms_field_auto_classification/README.rst | 2 +- dms_field_auto_classification/__manifest__.py | 2 +- dms_field_auto_classification/static/description/index.html | 2 +- .../tests/test_dms_field_auto_classification.py | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dms_field_auto_classification/README.rst b/dms_field_auto_classification/README.rst index 9543a5846..d8a2bf13e 100644 --- a/dms_field_auto_classification/README.rst +++ b/dms_field_auto_classification/README.rst @@ -7,7 +7,7 @@ Auto classify files into embedded DMS !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:84801ed75969b9476dcc8b7deb9fc7b7f5ca212b9eea86f03079696cae406502 + !! source digest: sha256:b64dc537a7a41e5770138dd4406da63b8ce76b51ffcfcf7743226b261571eb3c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/dms_field_auto_classification/__manifest__.py b/dms_field_auto_classification/__manifest__.py index 8dd12206c..e6c774358 100644 --- a/dms_field_auto_classification/__manifest__.py +++ b/dms_field_auto_classification/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Auto classify files into embedded DMS", - "version": "16.0.1.0.1", + "version": "16.0.1.0.2", "category": "Document Management", "website": "https://github.com/OCA/dms", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/dms_field_auto_classification/static/description/index.html b/dms_field_auto_classification/static/description/index.html index d9f5f0b97..4e2671576 100644 --- a/dms_field_auto_classification/static/description/index.html +++ b/dms_field_auto_classification/static/description/index.html @@ -367,7 +367,7 @@

Auto classify files into embedded DMS

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:84801ed75969b9476dcc8b7deb9fc7b7f5ca212b9eea86f03079696cae406502 +!! source digest: sha256:b64dc537a7a41e5770138dd4406da63b8ce76b51ffcfcf7743226b261571eb3c !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/dms Translate me on Weblate Try me on Runboat

Automatically classify files within a .zip file to the corresponding directory(s) diff --git a/dms_field_auto_classification/tests/test_dms_field_auto_classification.py b/dms_field_auto_classification/tests/test_dms_field_auto_classification.py index c8424cec1..68aae6a02 100644 --- a/dms_field_auto_classification/tests/test_dms_field_auto_classification.py +++ b/dms_field_auto_classification/tests/test_dms_field_auto_classification.py @@ -22,6 +22,7 @@ def setUpClass(cls): ) access_group = cls.env.ref("dms.access_group_01_demo") access_group.explicit_user_ids = [(4, cls.user.id)] + cls.env.ref("dms_field.field_template_partner").unlink() file_template = cls.env["dms.field.template"].create( { "name": "Test partner template", From a19a544da87b003ab81a6b3ece03f1063c05af0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Fri, 29 Nov 2024 09:06:02 +0100 Subject: [PATCH 08/21] [FIX] dms_field: Test compatibility We need to avoid applying a template except when testing functionality with dms_field* modules to avoid the error that a directory with the same name already exists (example: create partner). Related to https://github.com/OCA/dms/pull/378 [BOT] post-merge updates --- dms_field_auto_classification/README.rst | 2 +- dms_field_auto_classification/__manifest__.py | 2 +- dms_field_auto_classification/static/description/index.html | 2 +- .../tests/test_dms_field_auto_classification.py | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/dms_field_auto_classification/README.rst b/dms_field_auto_classification/README.rst index d8a2bf13e..f0031592e 100644 --- a/dms_field_auto_classification/README.rst +++ b/dms_field_auto_classification/README.rst @@ -7,7 +7,7 @@ Auto classify files into embedded DMS !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:b64dc537a7a41e5770138dd4406da63b8ce76b51ffcfcf7743226b261571eb3c + !! source digest: sha256:a65d244a6d0320c99621795ff3fffea604365b53e38b35a93fffe1e00b375d28 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/dms_field_auto_classification/__manifest__.py b/dms_field_auto_classification/__manifest__.py index e6c774358..1e6b64020 100644 --- a/dms_field_auto_classification/__manifest__.py +++ b/dms_field_auto_classification/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Auto classify files into embedded DMS", - "version": "16.0.1.0.2", + "version": "16.0.1.0.3", "category": "Document Management", "website": "https://github.com/OCA/dms", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/dms_field_auto_classification/static/description/index.html b/dms_field_auto_classification/static/description/index.html index 4e2671576..1d6c292b7 100644 --- a/dms_field_auto_classification/static/description/index.html +++ b/dms_field_auto_classification/static/description/index.html @@ -367,7 +367,7 @@

Auto classify files into embedded DMS

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:b64dc537a7a41e5770138dd4406da63b8ce76b51ffcfcf7743226b261571eb3c +!! source digest: sha256:a65d244a6d0320c99621795ff3fffea604365b53e38b35a93fffe1e00b375d28 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/dms Translate me on Weblate Try me on Runboat

Automatically classify files within a .zip file to the corresponding directory(s) diff --git a/dms_field_auto_classification/tests/test_dms_field_auto_classification.py b/dms_field_auto_classification/tests/test_dms_field_auto_classification.py index 68aae6a02..9d66aa9ba 100644 --- a/dms_field_auto_classification/tests/test_dms_field_auto_classification.py +++ b/dms_field_auto_classification/tests/test_dms_field_auto_classification.py @@ -14,6 +14,7 @@ class TestDmsFieldAutoClassification(BaseCommon): @classmethod def setUpClass(cls): super().setUpClass() + cls.env = cls.env(context=dict(cls.env.context, test_dms_field=True)) cls.template = cls.env.ref( "dms_field_auto_classification.dms_classification_template_partners" ) From 198184e2ce40f90fc4c951b7d26153d36dcd5da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Mon, 12 May 2025 13:37:06 +0200 Subject: [PATCH 09/21] [IMP] dms_field_auto_classification: pre-commit auto fixes --- dms_field_auto_classification/README.rst | 60 +++++++++++-------- dms_field_auto_classification/pyproject.toml | 3 + .../readme/CONFIGURE.md | 14 +++++ .../readme/CONFIGURE.rst | 10 ---- .../readme/CONTRIBUTORS.md | 3 + .../readme/CONTRIBUTORS.rst | 4 -- .../{DESCRIPTION.rst => DESCRIPTION.md} | 4 +- dms_field_auto_classification/readme/USAGE.md | 10 ++++ .../readme/USAGE.rst | 6 -- .../static/description/index.html | 42 +++++++------ .../wizards/wizard_dms_classification.py | 4 +- 11 files changed, 92 insertions(+), 68 deletions(-) create mode 100644 dms_field_auto_classification/pyproject.toml create mode 100644 dms_field_auto_classification/readme/CONFIGURE.md delete mode 100644 dms_field_auto_classification/readme/CONFIGURE.rst create mode 100644 dms_field_auto_classification/readme/CONTRIBUTORS.md delete mode 100644 dms_field_auto_classification/readme/CONTRIBUTORS.rst rename dms_field_auto_classification/readme/{DESCRIPTION.rst => DESCRIPTION.md} (58%) create mode 100644 dms_field_auto_classification/readme/USAGE.md delete mode 100644 dms_field_auto_classification/readme/USAGE.rst diff --git a/dms_field_auto_classification/README.rst b/dms_field_auto_classification/README.rst index f0031592e..14b19994e 100644 --- a/dms_field_auto_classification/README.rst +++ b/dms_field_auto_classification/README.rst @@ -17,19 +17,19 @@ Auto classify files into embedded DMS :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fdms-lightgray.png?logo=github - :target: https://github.com/OCA/dms/tree/16.0/dms_field_auto_classification + :target: https://github.com/OCA/dms/tree/18.0/dms_field_auto_classification :alt: OCA/dms .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/dms-16-0/dms-16-0-dms_field_auto_classification + :target: https://translation.odoo-community.org/projects/dms-18-0/dms-18-0-dms_field_auto_classification :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/dms&target_branch=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/dms&target_branch=18.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| -Automatically classify files within a .zip file to the corresponding directory(s) -related to an embedded DMS. +Automatically classify files within a .zip file to the corresponding +directory(s) related to an embedded DMS. **Table of contents** @@ -39,26 +39,34 @@ related to an embedded DMS. Configuration ============= -#. Go to `Documents / Configuration / Classification Templates` and create or edit a template. -#. You can set a model to which it is linked (res.partner for example). -#. You can define the details to indicate which field is referenced by the defined filename pattern. +1. Go to Documents / Configuration / Classification Templates and create + or edit a template. +2. You can set a model to which it is linked (res.partner for example). +3. You can define the details to indicate which field is referenced by + the defined filename pattern. Full example from res.partner: -Filename pattern: ([0-9]{8}[A-Z]).*.pdf -Details: VAT (field) and 0 (index) -Directory Pattern example 1: {0} > This will attempt to add the files to the directory linked to the partner with the VAT name. -Directory Pattern example 2: {0} / Misc > This will attempt to add the files to the "Misc" subdirectory linked to the partner with the VAT name. +Filename pattern: ([0-9]{8}[A-Z]).\*.pdf Details: VAT (field) and 0 +(index) Directory Pattern example 1: {0} > This will attempt to add the +files to the directory linked to the partner with the VAT name. +Directory Pattern example 2: {0} / Misc > This will attempt to add the +files to the "Misc" subdirectory linked to the partner with the VAT +name. Usage ===== -#. Go to `Documents / Auto Classification` and select a template and a .zip file. -#. Press the `Analyze` button -#. As many lines will be set as the number of files contained in the .zip file and apply the filename pattern. -#. The record to which they are related (res.partner for example) will be show on the lines. -#. Press the `Classify` button -#. The files (dms.file) will be created in the corresponding directories. +1. Go to Documents / Auto Classification and select a template and a + .zip file. +2. Press the Analyze button +3. As many lines will be set as the number of files contained in the + .zip file and apply the filename pattern. +4. The record to which they are related (res.partner for example) will + be show on the lines. +5. Press the Classify button +6. The files (dms.file) will be created in the corresponding + directories. Bug Tracker =========== @@ -66,7 +74,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -74,20 +82,20 @@ Credits ======= Authors -~~~~~~~ +------- * Tecnativa Contributors -~~~~~~~~~~~~ +------------ -* `Tecnativa `_: +- `Tecnativa `__: - * Víctor Martínez - * Pedro M. Baeza + - Víctor Martínez + - Pedro M. Baeza Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -107,6 +115,6 @@ Current `maintainer `__: |maintainer-victoralmau| -This module is part of the `OCA/dms `_ project on GitHub. +This module is part of the `OCA/dms `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/dms_field_auto_classification/pyproject.toml b/dms_field_auto_classification/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/dms_field_auto_classification/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/dms_field_auto_classification/readme/CONFIGURE.md b/dms_field_auto_classification/readme/CONFIGURE.md new file mode 100644 index 000000000..7a851d3ab --- /dev/null +++ b/dms_field_auto_classification/readme/CONFIGURE.md @@ -0,0 +1,14 @@ +1. Go to Documents / Configuration / Classification Templates and + create or edit a template. +2. You can set a model to which it is linked (res.partner for example). +3. You can define the details to indicate which field is referenced by + the defined filename pattern. + +Full example from res.partner: + +Filename pattern: (\[0-9\]{8}\[A-Z\]).\*.pdf Details: VAT (field) and 0 +(index) Directory Pattern example 1: {0} \> This will attempt to add the +files to the directory linked to the partner with the VAT name. +Directory Pattern example 2: {0} / Misc \> This will attempt to add the +files to the "Misc" subdirectory linked to the partner with the VAT +name. diff --git a/dms_field_auto_classification/readme/CONFIGURE.rst b/dms_field_auto_classification/readme/CONFIGURE.rst deleted file mode 100644 index 70c504f62..000000000 --- a/dms_field_auto_classification/readme/CONFIGURE.rst +++ /dev/null @@ -1,10 +0,0 @@ -#. Go to `Documents / Configuration / Classification Templates` and create or edit a template. -#. You can set a model to which it is linked (res.partner for example). -#. You can define the details to indicate which field is referenced by the defined filename pattern. - -Full example from res.partner: - -Filename pattern: ([0-9]{8}[A-Z]).*.pdf -Details: VAT (field) and 0 (index) -Directory Pattern example 1: {0} > This will attempt to add the files to the directory linked to the partner with the VAT name. -Directory Pattern example 2: {0} / Misc > This will attempt to add the files to the "Misc" subdirectory linked to the partner with the VAT name. diff --git a/dms_field_auto_classification/readme/CONTRIBUTORS.md b/dms_field_auto_classification/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..5fee39042 --- /dev/null +++ b/dms_field_auto_classification/readme/CONTRIBUTORS.md @@ -0,0 +1,3 @@ +- [Tecnativa](https://www.tecnativa.com): + - Víctor Martínez + - Pedro M. Baeza diff --git a/dms_field_auto_classification/readme/CONTRIBUTORS.rst b/dms_field_auto_classification/readme/CONTRIBUTORS.rst deleted file mode 100644 index 5fb713053..000000000 --- a/dms_field_auto_classification/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,4 +0,0 @@ -* `Tecnativa `_: - - * Víctor Martínez - * Pedro M. Baeza diff --git a/dms_field_auto_classification/readme/DESCRIPTION.rst b/dms_field_auto_classification/readme/DESCRIPTION.md similarity index 58% rename from dms_field_auto_classification/readme/DESCRIPTION.rst rename to dms_field_auto_classification/readme/DESCRIPTION.md index 5688d0c47..9d3d71216 100644 --- a/dms_field_auto_classification/readme/DESCRIPTION.rst +++ b/dms_field_auto_classification/readme/DESCRIPTION.md @@ -1,2 +1,2 @@ -Automatically classify files within a .zip file to the corresponding directory(s) -related to an embedded DMS. +Automatically classify files within a .zip file to the corresponding +directory(s) related to an embedded DMS. diff --git a/dms_field_auto_classification/readme/USAGE.md b/dms_field_auto_classification/readme/USAGE.md new file mode 100644 index 000000000..c8bf4ea52 --- /dev/null +++ b/dms_field_auto_classification/readme/USAGE.md @@ -0,0 +1,10 @@ +1. Go to Documents / Auto Classification and select a template and a + .zip file. +2. Press the Analyze button +3. As many lines will be set as the number of files contained in the + .zip file and apply the filename pattern. +4. The record to which they are related (res.partner for example) will + be show on the lines. +5. Press the Classify button +6. The files (dms.file) will be created in the corresponding + directories. diff --git a/dms_field_auto_classification/readme/USAGE.rst b/dms_field_auto_classification/readme/USAGE.rst deleted file mode 100644 index b12a27bec..000000000 --- a/dms_field_auto_classification/readme/USAGE.rst +++ /dev/null @@ -1,6 +0,0 @@ -#. Go to `Documents / Auto Classification` and select a template and a .zip file. -#. Press the `Analyze` button -#. As many lines will be set as the number of files contained in the .zip file and apply the filename pattern. -#. The record to which they are related (res.partner for example) will be show on the lines. -#. Press the `Classify` button -#. The files (dms.file) will be created in the corresponding directories. diff --git a/dms_field_auto_classification/static/description/index.html b/dms_field_auto_classification/static/description/index.html index 1d6c292b7..ebab6e4b5 100644 --- a/dms_field_auto_classification/static/description/index.html +++ b/dms_field_auto_classification/static/description/index.html @@ -369,9 +369,9 @@

Auto classify files into embedded DMS

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:a65d244a6d0320c99621795ff3fffea604365b53e38b35a93fffe1e00b375d28 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/dms Translate me on Weblate Try me on Runboat

-

Automatically classify files within a .zip file to the corresponding directory(s) -related to an embedded DMS.

+

Beta License: AGPL-3 OCA/dms Translate me on Weblate Try me on Runboat

+

Automatically classify files within a .zip file to the corresponding +directory(s) related to an embedded DMS.

Table of contents

    @@ -389,25 +389,33 @@

    Auto classify files into embedded DMS

    Configuration

      -
    1. Go to Documents / Configuration / Classification Templates and create or edit a template.
    2. +
    3. Go to Documents / Configuration / Classification Templates and create +or edit a template.
    4. You can set a model to which it is linked (res.partner for example).
    5. -
    6. You can define the details to indicate which field is referenced by the defined filename pattern.
    7. +
    8. You can define the details to indicate which field is referenced by +the defined filename pattern.

    Full example from res.partner:

    -

    Filename pattern: ([0-9]{8}[A-Z]).*.pdf -Details: VAT (field) and 0 (index) -Directory Pattern example 1: {0} > This will attempt to add the files to the directory linked to the partner with the VAT name. -Directory Pattern example 2: {0} / Misc > This will attempt to add the files to the “Misc” subdirectory linked to the partner with the VAT name.

    +

    Filename pattern: ([0-9]{8}[A-Z]).*.pdf Details: VAT (field) and 0 +(index) Directory Pattern example 1: {0} > This will attempt to add the +files to the directory linked to the partner with the VAT name. +Directory Pattern example 2: {0} / Misc > This will attempt to add the +files to the “Misc” subdirectory linked to the partner with the VAT +name.

    Usage

      -
    1. Go to Documents / Auto Classification and select a template and a .zip file.
    2. -
    3. Press the Analyze button
    4. -
    5. As many lines will be set as the number of files contained in the .zip file and apply the filename pattern.
    6. -
    7. The record to which they are related (res.partner for example) will be show on the lines.
    8. -
    9. Press the Classify button
    10. -
    11. The files (dms.file) will be created in the corresponding directories.
    12. +
    13. Go to Documents / Auto Classification and select a template and a +.zip file.
    14. +
    15. Press the Analyze button
    16. +
    17. As many lines will be set as the number of files contained in the +.zip file and apply the filename pattern.
    18. +
    19. The record to which they are related (res.partner for example) will +be show on the lines.
    20. +
    21. Press the Classify button
    22. +
    23. The files (dms.file) will be created in the corresponding +directories.
    @@ -415,7 +423,7 @@

    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.

    +feedback.

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

    @@ -447,7 +455,7 @@

    Maintainers

    promote its widespread use.

    Current maintainer:

    victoralmau

    -

    This module is part of the OCA/dms project on GitHub.

    +

    This module is part of the OCA/dms project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/dms_field_auto_classification/wizards/wizard_dms_classification.py b/dms_field_auto_classification/wizards/wizard_dms_classification.py index c3f473331..9ac04bdfe 100644 --- a/dms_field_auto_classification/wizards/wizard_dms_classification.py +++ b/dms_field_auto_classification/wizards/wizard_dms_classification.py @@ -39,9 +39,7 @@ def _compute_record_ref(self): ): directory = record.directory_id.root_directory_id record.record_ref = ( - "{},{}".format(directory.res_model, directory.res_id) - if directory - else False + f"{directory.res_model},{directory.res_id}" if directory else False ) @api.depends("file_name", "template_id.model_id") From 0504c3a761cf4d9fe8eff6fe7d08e5f43b0b2a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Mon, 12 May 2025 13:40:01 +0200 Subject: [PATCH 10/21] [MIG] dms_field_auto_classification: Migration to 18.0 TT55508 --- dms_field_auto_classification/__manifest__.py | 2 +- dms_field_auto_classification/i18n/es.po | 3 --- .../tests/test_dms_field_auto_classification.py | 14 ++++++++------ .../views/dms_classification_template_views.xml | 13 +++++-------- .../wizards/wizard_dms_classification.py | 2 +- .../wizards/wizard_dms_classification_views.xml | 2 +- 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/dms_field_auto_classification/__manifest__.py b/dms_field_auto_classification/__manifest__.py index 1e6b64020..4b01d40e0 100644 --- a/dms_field_auto_classification/__manifest__.py +++ b/dms_field_auto_classification/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Auto classify files into embedded DMS", - "version": "16.0.1.0.3", + "version": "18.0.1.0.0", "category": "Document Management", "website": "https://github.com/OCA/dms", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/dms_field_auto_classification/i18n/es.po b/dms_field_auto_classification/i18n/es.po index eec68c57b..ea735af09 100644 --- a/dms_field_auto_classification/i18n/es.po +++ b/dms_field_auto_classification/i18n/es.po @@ -112,6 +112,3 @@ msgstr "Plantilla" #: model:ir.model,name:dms_field_auto_classification.model_wizard_dms_classification_detail msgid "Wizard Dms Classification Detail" msgstr "Asistente de Clasificación Dms Detalle" - -#~ msgid "DMS Directories" -#~ msgstr "Directorios DMS" diff --git a/dms_field_auto_classification/tests/test_dms_field_auto_classification.py b/dms_field_auto_classification/tests/test_dms_field_auto_classification.py index 9d66aa9ba..720047d4f 100644 --- a/dms_field_auto_classification/tests/test_dms_field_auto_classification.py +++ b/dms_field_auto_classification/tests/test_dms_field_auto_classification.py @@ -50,10 +50,11 @@ def setUpClass(cls): "vat": "58426469Y", } ) - cls.wizard = cls._create_wizard_dms_classification(cls, cls.template) - cls.extra_wizard = cls._create_wizard_dms_classification(cls, cls.template) + cls.wizard = cls._create_wizard_dms_classification(cls.template) + cls.extra_wizard = cls._create_wizard_dms_classification(cls.template) - def _data_file(self, filename, encoding=None): + @classmethod + def _data_file(cls, filename, encoding=None): mode = "rt" if encoding else "rb" with open(path.join(path.dirname(__file__), filename), mode) as file: data = file.read() @@ -61,10 +62,11 @@ def _data_file(self, filename, encoding=None): data = data.encode(encoding) return b64encode(data) - def _create_wizard_dms_classification(self, template): - wizard_form = Form(self.env["wizard.dms.classification"]) + @classmethod + def _create_wizard_dms_classification(cls, template): + wizard_form = Form(cls.env["wizard.dms.classification"]) wizard_form.template_id = template - wizard_form.data_file = self._data_file(self, "data/test.zip") + wizard_form.data_file = cls._data_file("data/test.zip") return wizard_form.save() def test_partner_misc(self): diff --git a/dms_field_auto_classification/views/dms_classification_template_views.xml b/dms_field_auto_classification/views/dms_classification_template_views.xml index 5f7a11825..a91a70347 100644 --- a/dms_field_auto_classification/views/dms_classification_template_views.xml +++ b/dms_field_auto_classification/views/dms_classification_template_views.xml @@ -23,16 +23,13 @@ - - + + - - + + - + diff --git a/dms_field_auto_classification/wizards/wizard_dms_classification.py b/dms_field_auto_classification/wizards/wizard_dms_classification.py index 9ac04bdfe..7920d1347 100644 --- a/dms_field_auto_classification/wizards/wizard_dms_classification.py +++ b/dms_field_auto_classification/wizards/wizard_dms_classification.py @@ -63,7 +63,7 @@ def _compute_directory_id(self): for detail in item.template_id.detail_ids: matches_value = matches.groups()[detail.index] # Change directory pattern if index in pattern - expected = "{%s}" % detail.index + expected = f"{{{detail.index}}}" if expected in directory_pattern: directory_pattern = directory_pattern.replace( expected, matches_value diff --git a/dms_field_auto_classification/wizards/wizard_dms_classification_views.xml b/dms_field_auto_classification/wizards/wizard_dms_classification_views.xml index 181634dc5..a7a91ad61 100644 --- a/dms_field_auto_classification/wizards/wizard_dms_classification_views.xml +++ b/dms_field_auto_classification/wizards/wizard_dms_classification_views.xml @@ -9,7 +9,7 @@ /> From d376d52b67077f0c1b7c4936086aa0c5c6db10f4 Mon Sep 17 00:00:00 2001 From: oca-ci Date: Tue, 24 Jun 2025 15:47:59 +0000 Subject: [PATCH 11/21] [UPD] Update dms_field_auto_classification.pot --- .../i18n/dms_field_auto_classification.pot | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/dms_field_auto_classification/i18n/dms_field_auto_classification.pot b/dms_field_auto_classification/i18n/dms_field_auto_classification.pot index f69d22f12..8e34de915 100644 --- a/dms_field_auto_classification/i18n/dms_field_auto_classification.pot +++ b/dms_field_auto_classification/i18n/dms_field_auto_classification.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 16.0\n" +"Project-Id-Version: Odoo Server 18.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -58,11 +58,6 @@ msgstr "" msgid "Index" msgstr "" -#. module: dms_field_auto_classification -#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail____last_update -msgid "Last Modified on" -msgstr "" - #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__write_uid msgid "Last Updated by" From 0dc15bf57ebd9c3848fb839bf3358cef670dda26 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 24 Jun 2025 15:50:36 +0000 Subject: [PATCH 12/21] [BOT] post-merge updates --- dms_field_auto_classification/README.rst | 14 +++++---- .../static/description/index.html | 30 +++++++++++-------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/dms_field_auto_classification/README.rst b/dms_field_auto_classification/README.rst index 14b19994e..d1d298dc2 100644 --- a/dms_field_auto_classification/README.rst +++ b/dms_field_auto_classification/README.rst @@ -1,3 +1,7 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + ===================================== Auto classify files into embedded DMS ===================================== @@ -7,13 +11,13 @@ Auto classify files into embedded DMS !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:a65d244a6d0320c99621795ff3fffea604365b53e38b35a93fffe1e00b375d28 + !! source digest: sha256:d9cf2707013d67b046d8df2ad1ae7ce09eeaba4ebc5d41c5e3db01bedc6d74fb !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |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 +.. |badge2| image:: https://img.shields.io/badge/license-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-OCA%2Fdms-lightgray.png?logo=github @@ -89,10 +93,10 @@ Authors Contributors ------------ -- `Tecnativa `__: +- `Tecnativa `__: - - Víctor Martínez - - Pedro M. Baeza + - Víctor Martínez + - Pedro M. Baeza Maintainers ----------- diff --git a/dms_field_auto_classification/static/description/index.html b/dms_field_auto_classification/static/description/index.html index ebab6e4b5..31cce4207 100644 --- a/dms_field_auto_classification/static/description/index.html +++ b/dms_field_auto_classification/static/description/index.html @@ -3,7 +3,7 @@ -Auto classify files into embedded DMS +README.rst -
-

Auto classify files into embedded DMS

+
+ + +Odoo Community Association + +
+

Auto classify files into embedded DMS

-

Beta License: AGPL-3 OCA/dms Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/dms Translate me on Weblate Try me on Runboat

Automatically classify files within a .zip file to the corresponding directory(s) related to an embedded DMS.

Table of contents

@@ -387,7 +392,7 @@

Auto classify files into embedded DMS

-

Configuration

+

Configuration

  1. Go to Documents / Configuration / Classification Templates and create or edit a template.
  2. @@ -404,7 +409,7 @@

    Configuration

    name.

-

Usage

+

Usage

  1. Go to Documents / Auto Classification and select a template and a .zip file.
  2. @@ -419,7 +424,7 @@

    Usage

-

Bug Tracker

+

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 @@ -427,15 +432,15 @@

Bug Tracker

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

-

Credits

+

Credits

-

Authors

+

Authors

  • Tecnativa
-

Contributors

+

Contributors

-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association @@ -460,5 +465,6 @@

Maintainers

+
From ced7a064093a46e3f4503bfbda53070492584f2a Mon Sep 17 00:00:00 2001 From: jakobkrabbe Date: Fri, 19 Sep 2025 13:34:16 +0000 Subject: [PATCH 13/21] Added translation using Weblate (Swedish) --- dms_field_auto_classification/i18n/sv.po | 106 +++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 dms_field_auto_classification/i18n/sv.po diff --git a/dms_field_auto_classification/i18n/sv.po b/dms_field_auto_classification/i18n/sv.po new file mode 100644 index 000000000..2a5849f8d --- /dev/null +++ b/dms_field_auto_classification/i18n/sv.po @@ -0,0 +1,106 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * dms_field_auto_classification +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: sv\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__create_uid +msgid "Created by" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__create_date +msgid "Created on" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__detail_ids +msgid "Details" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__display_name +msgid "Display Name" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model,name:dms_field_auto_classification.model_dms_classification_template +msgid "Dms Classification Template" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model,name:dms_field_auto_classification.model_dms_classification_template_detail +msgid "Dms Classification Template Detail" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__field_id +msgid "Field" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__id +msgid "ID" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__index +msgid "Index" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__write_date +msgid "Last Updated on" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model_id +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__model_id +msgid "Model" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model +msgid "Model name" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__parent_id +msgid "Parent" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_wizard_dms_classification_detail__record_ref +msgid "Record Referenced" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__sequence +msgid "Sequence" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_wizard_dms_classification_detail__template_id +msgid "Template" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model,name:dms_field_auto_classification.model_wizard_dms_classification_detail +msgid "Wizard Dms Classification Detail" +msgstr "" From e29224cb74b1d236f84288e1b3ad92967bfcc5bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Fri, 6 Feb 2026 09:59:27 +0100 Subject: [PATCH 14/21] [IMP] dms_field_auto_classification: Define the appropriate record_ref if the directory (directory_id) is a subdirectory TT60821 --- .../wizards/wizard_dms_classification.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/dms_field_auto_classification/wizards/wizard_dms_classification.py b/dms_field_auto_classification/wizards/wizard_dms_classification.py index 7920d1347..a6d6c03e7 100644 --- a/dms_field_auto_classification/wizards/wizard_dms_classification.py +++ b/dms_field_auto_classification/wizards/wizard_dms_classification.py @@ -33,6 +33,11 @@ def _compute_record_ref(self): directory = False if record.directory_id.res_model and record.directory_id.res_id: directory = record.directory_id + elif ( + record.directory_id.parent_id.res_model + and record.directory_id.parent_id.res_id + ): + directory = record.directory_id.parent_id elif ( record.directory_id.root_directory_id.res_model and record.directory_id.root_directory_id.res_id From e1e1fa1e41ee99199924c91f74728afdf5b995d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Mart=C3=ADnez?= Date: Thu, 5 Feb 2026 08:28:31 +0100 Subject: [PATCH 15/21] [IMP+FIX] dms_auto_classification: Filter by the appropriate directories (company compatibility) It is important not to apply sudo() to filter by the directories to which the user has access and to filter only by those of the appropriate company. TT60719 --- .../wizards/wizard_dms_classification.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dms_field_auto_classification/wizards/wizard_dms_classification.py b/dms_field_auto_classification/wizards/wizard_dms_classification.py index a6d6c03e7..63567351c 100644 --- a/dms_field_auto_classification/wizards/wizard_dms_classification.py +++ b/dms_field_auto_classification/wizards/wizard_dms_classification.py @@ -1,4 +1,4 @@ -# Copyright 2024 Tecnativa - Víctor Martínez +# Copyright 2024-2026 Tecnativa - Víctor Martínez # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). import re @@ -51,9 +51,12 @@ def _compute_record_ref(self): def _compute_directory_id(self): """Overwrite to redefine the directory if the template has a linked model.""" self_with_model = self.filtered(lambda x: x.template_id.model_id) - directory_model = self.env["dms.directory"].sudo() + _self = self - self_with_model + res = super(WizardDmsClassificationDetail, _self)._compute_directory_id() + directory_model = self.env["dms.directory"] for item in self_with_model: domain = [ + ("company_id", "=", self.parent_id.company_id.id), ("res_model", "=", item.template_id.model_id.model), ("res_id", ">", 0), ] @@ -77,6 +80,4 @@ def _compute_directory_id(self): item.directory_id = self.parent_id._get_directory_from_pattern( directory_pattern, directories ) - return super( - WizardDmsClassificationDetail, (self - self_with_model) - )._compute_directory_id() + return res From 5aae7cc7975650bcd3a9142b8f21f49d99a5790e Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 10 Feb 2026 11:00:06 +0000 Subject: [PATCH 16/21] [BOT] post-merge updates --- dms_field_auto_classification/README.rst | 2 +- dms_field_auto_classification/__manifest__.py | 2 +- dms_field_auto_classification/static/description/index.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dms_field_auto_classification/README.rst b/dms_field_auto_classification/README.rst index d1d298dc2..88012d0b8 100644 --- a/dms_field_auto_classification/README.rst +++ b/dms_field_auto_classification/README.rst @@ -11,7 +11,7 @@ Auto classify files into embedded DMS !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:d9cf2707013d67b046d8df2ad1ae7ce09eeaba4ebc5d41c5e3db01bedc6d74fb + !! source digest: sha256:08d9cc488429baf098763c68704aa8516ffc5b2f1ff40c2b7422db0be35d39ff !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/dms_field_auto_classification/__manifest__.py b/dms_field_auto_classification/__manifest__.py index 4b01d40e0..f4e7154f8 100644 --- a/dms_field_auto_classification/__manifest__.py +++ b/dms_field_auto_classification/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Auto classify files into embedded DMS", - "version": "18.0.1.0.0", + "version": "18.0.1.0.1", "category": "Document Management", "website": "https://github.com/OCA/dms", "author": "Tecnativa, Odoo Community Association (OCA)", diff --git a/dms_field_auto_classification/static/description/index.html b/dms_field_auto_classification/static/description/index.html index 31cce4207..5228543c9 100644 --- a/dms_field_auto_classification/static/description/index.html +++ b/dms_field_auto_classification/static/description/index.html @@ -372,7 +372,7 @@

Auto classify files into embedded DMS

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:d9cf2707013d67b046d8df2ad1ae7ce09eeaba4ebc5d41c5e3db01bedc6d74fb +!! source digest: sha256:08d9cc488429baf098763c68704aa8516ffc5b2f1ff40c2b7422db0be35d39ff !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

Beta License: AGPL-3 OCA/dms Translate me on Weblate Try me on Runboat

Automatically classify files within a .zip file to the corresponding From 9d98e9515c707eddd1b1512a2c7fb996e46de9ca Mon Sep 17 00:00:00 2001 From: herminioelx Date: Thu, 19 Feb 2026 12:56:53 +0000 Subject: [PATCH 17/21] Translated using Weblate (Spanish) Currently translated at 100.0% (19 of 19 strings) Translation: dms-18.0/dms-18.0-dms_field_auto_classification Translate-URL: https://translation.odoo-community.org/projects/dms-18-0/dms-18-0-dms_field_auto_classification/es/ --- dms_field_auto_classification/i18n/es.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dms_field_auto_classification/i18n/es.po b/dms_field_auto_classification/i18n/es.po index ea735af09..b2c2b1094 100644 --- a/dms_field_auto_classification/i18n/es.po +++ b/dms_field_auto_classification/i18n/es.po @@ -7,15 +7,15 @@ msgstr "" "Project-Id-Version: Odoo Server 15.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2024-01-23 12:22+0000\n" -"PO-Revision-Date: 2024-03-23 09:34+0000\n" -"Last-Translator: Ivorra78 \n" +"PO-Revision-Date: 2026-02-19 14:40+0000\n" +"Last-Translator: herminioelx \n" "Language-Team: \n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.17\n" +"X-Generator: Weblate 5.15.2\n" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__create_uid @@ -86,7 +86,7 @@ msgstr "Modelo" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model msgid "Model name" -msgstr "" +msgstr "Nombre del modelo" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__parent_id From 08c8fd23a9516479957d051c4e7e52b200f18bca Mon Sep 17 00:00:00 2001 From: Mohamed Essam Salem Date: Thu, 14 May 2026 22:41:36 +0000 Subject: [PATCH 18/21] Added translation using Weblate (Arabic) --- dms_field_auto_classification/i18n/ar.po | 107 +++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 dms_field_auto_classification/i18n/ar.po diff --git a/dms_field_auto_classification/i18n/ar.po b/dms_field_auto_classification/i18n/ar.po new file mode 100644 index 000000000..b1c7b59df --- /dev/null +++ b/dms_field_auto_classification/i18n/ar.po @@ -0,0 +1,107 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * dms_field_auto_classification +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: ar\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \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 ? 4 : 5;\n" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__create_uid +msgid "Created by" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__create_date +msgid "Created on" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__detail_ids +msgid "Details" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__display_name +msgid "Display Name" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model,name:dms_field_auto_classification.model_dms_classification_template +msgid "Dms Classification Template" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model,name:dms_field_auto_classification.model_dms_classification_template_detail +msgid "Dms Classification Template Detail" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__field_id +msgid "Field" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__id +msgid "ID" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__index +msgid "Index" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__write_date +msgid "Last Updated on" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model_id +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__model_id +msgid "Model" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model +msgid "Model name" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__parent_id +msgid "Parent" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_wizard_dms_classification_detail__record_ref +msgid "Record Referenced" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__sequence +msgid "Sequence" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_wizard_dms_classification_detail__template_id +msgid "Template" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model,name:dms_field_auto_classification.model_wizard_dms_classification_detail +msgid "Wizard Dms Classification Detail" +msgstr "" From f1d71028386d6c7280d5c66d5ef545f6d02290f6 Mon Sep 17 00:00:00 2001 From: Matjaz Mozetic Date: Mon, 22 Jun 2026 09:32:47 +0000 Subject: [PATCH 19/21] Added translation using Weblate (Slovenian) --- dms_field_auto_classification/i18n/sl.po | 107 +++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 dms_field_auto_classification/i18n/sl.po diff --git a/dms_field_auto_classification/i18n/sl.po b/dms_field_auto_classification/i18n/sl.po new file mode 100644 index 000000000..008aba3aa --- /dev/null +++ b/dms_field_auto_classification/i18n/sl.po @@ -0,0 +1,107 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * dms_field_auto_classification +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 18.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: sl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || " +"n%100==4 ? 2 : 3;\n" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__create_uid +msgid "Created by" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__create_date +msgid "Created on" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__detail_ids +msgid "Details" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__display_name +msgid "Display Name" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model,name:dms_field_auto_classification.model_dms_classification_template +msgid "Dms Classification Template" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model,name:dms_field_auto_classification.model_dms_classification_template_detail +msgid "Dms Classification Template Detail" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__field_id +msgid "Field" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__id +msgid "ID" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__index +msgid "Index" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__write_uid +msgid "Last Updated by" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__write_date +msgid "Last Updated on" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model_id +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__model_id +msgid "Model" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model +msgid "Model name" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__parent_id +msgid "Parent" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_wizard_dms_classification_detail__record_ref +msgid "Record Referenced" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__sequence +msgid "Sequence" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model.fields,field_description:dms_field_auto_classification.field_wizard_dms_classification_detail__template_id +msgid "Template" +msgstr "" + +#. module: dms_field_auto_classification +#: model:ir.model,name:dms_field_auto_classification.model_wizard_dms_classification_detail +msgid "Wizard Dms Classification Detail" +msgstr "" From 59de71c3cf4d49272b66780778202704221e4c96 Mon Sep 17 00:00:00 2001 From: Matjaz Mozetic Date: Mon, 22 Jun 2026 09:34:21 +0000 Subject: [PATCH 20/21] Translated using Weblate (Slovenian) Currently translated at 100.0% (18 of 18 strings) Translation: dms-18.0/dms-18.0-dms_field_auto_classification Translate-URL: https://translation.odoo-community.org/projects/dms-18-0/dms-18-0-dms_field_auto_classification/sl/ --- dms_field_auto_classification/i18n/sl.po | 40 +++++++++++++----------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/dms_field_auto_classification/i18n/sl.po b/dms_field_auto_classification/i18n/sl.po index 008aba3aa..12ffddd66 100644 --- a/dms_field_auto_classification/i18n/sl.po +++ b/dms_field_auto_classification/i18n/sl.po @@ -6,7 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 18.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: Automatically generated\n" +"PO-Revision-Date: 2026-06-22 11:46+0000\n" +"Last-Translator: Matjaz Mozetic \n" "Language-Team: none\n" "Language: sl\n" "MIME-Version: 1.0\n" @@ -14,94 +15,95 @@ msgstr "" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || " "n%100==4 ? 2 : 3;\n" +"X-Generator: Weblate 5.15.2\n" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__create_uid msgid "Created by" -msgstr "" +msgstr "Ustvaril" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__create_date msgid "Created on" -msgstr "" +msgstr "Ustvarjeno" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__detail_ids msgid "Details" -msgstr "" +msgstr "Podrobnosti" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__display_name msgid "Display Name" -msgstr "" +msgstr "Prikazani naziv" #. module: dms_field_auto_classification #: model:ir.model,name:dms_field_auto_classification.model_dms_classification_template msgid "Dms Classification Template" -msgstr "" +msgstr "DMS predloga klasifikacije" #. module: dms_field_auto_classification #: model:ir.model,name:dms_field_auto_classification.model_dms_classification_template_detail msgid "Dms Classification Template Detail" -msgstr "" +msgstr "DMS podrobnosti predloge klasifikacije" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__field_id msgid "Field" -msgstr "" +msgstr "Polje" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__id msgid "ID" -msgstr "" +msgstr "ID" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__index msgid "Index" -msgstr "" +msgstr "Indeks" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__write_uid msgid "Last Updated by" -msgstr "" +msgstr "Zadnji posodobil" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__write_date msgid "Last Updated on" -msgstr "" +msgstr "Zadnjič posodobljeno" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model_id #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__model_id msgid "Model" -msgstr "" +msgstr "Model" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__model msgid "Model name" -msgstr "" +msgstr "Naziv modela" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__parent_id msgid "Parent" -msgstr "" +msgstr "Nadrejeni" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_wizard_dms_classification_detail__record_ref msgid "Record Referenced" -msgstr "" +msgstr "Sklic na zapis" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template_detail__sequence msgid "Sequence" -msgstr "" +msgstr "Zaporedje" #. module: dms_field_auto_classification #: model:ir.model.fields,field_description:dms_field_auto_classification.field_wizard_dms_classification_detail__template_id msgid "Template" -msgstr "" +msgstr "Predloga" #. module: dms_field_auto_classification #: model:ir.model,name:dms_field_auto_classification.model_wizard_dms_classification_detail msgid "Wizard Dms Classification Detail" -msgstr "" +msgstr "Čarovnik DMS podrobnosti klasifikacije" From b5b8d6b9bbe6be3704bc90534a280a2732890859 Mon Sep 17 00:00:00 2001 From: mmircoli-nexapp Date: Mon, 22 Jun 2026 16:51:01 +0200 Subject: [PATCH 21/21] [MIG] dms_field_auto_classification: Migration to 19.0 --- dms_field_auto_classification/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dms_field_auto_classification/__manifest__.py b/dms_field_auto_classification/__manifest__.py index f4e7154f8..7b9e61324 100644 --- a/dms_field_auto_classification/__manifest__.py +++ b/dms_field_auto_classification/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Auto classify files into embedded DMS", - "version": "18.0.1.0.1", + "version": "19.0.1.0.0", "category": "Document Management", "website": "https://github.com/OCA/dms", "author": "Tecnativa, Odoo Community Association (OCA)",