Initial commit: OCA Technical packages (595 packages)

This commit is contained in:
Ernad Husremovic 2025-08-29 15:43:03 +02:00
commit 2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions

View file

@ -0,0 +1,45 @@
# Auto classify files into embedded DMS
Odoo addon: dms_field_auto_classification
## Installation
```bash
pip install odoo-bringout-oca-dms-dms_field_auto_classification
```
## Dependencies
This addon depends on:
- dms_auto_classification
- dms_field
## Manifest Information
- **Name**: Auto classify files into embedded DMS
- **Version**: 16.0.1.0.3
- **Category**: Document Management
- **License**: AGPL-3
- **Installable**: True
## Source
Based on [OCA/dms](https://github.com/OCA/dms) branch 16.0, addon `dms_field_auto_classification`.
## License
This package maintains the original AGPL-3 license from the upstream Odoo project.
## Documentation
- Overview: doc/OVERVIEW.md
- Architecture: doc/ARCHITECTURE.md
- Models: doc/MODELS.md
- Controllers: doc/CONTROLLERS.md
- Wizards: doc/WIZARDS.md
- Install: doc/INSTALL.md
- Usage: doc/USAGE.md
- Configuration: doc/CONFIGURATION.md
- Dependencies: doc/DEPENDENCIES.md
- Troubleshooting: doc/TROUBLESHOOTING.md
- FAQ: doc/FAQ.md

View file

@ -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:a65d244a6d0320c99621795ff3fffea604365b53e38b35a93fffe1e00b375d28
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/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-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=16.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 <https://github.com/OCA/dms/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 <https://github.com/OCA/dms/issues/new?body=module:%20dms_field_auto_classification%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
Do not contact contributors directly about support or help with technical issues.
Credits
=======
Authors
~~~~~~~
* Tecnativa
Contributors
~~~~~~~~~~~~
* `Tecnativa <https://www.tecnativa.com>`_:
* 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 <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-victoralmau|
This module is part of the `OCA/dms <https://github.com/OCA/dms/tree/16.0/dms_field_auto_classification>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View file

@ -0,0 +1,4 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from . import models
from . import wizards

View file

@ -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": "16.0.1.0.3",
"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"],
}

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record
id="dms_classification_template_partners"
model="dms.classification.template"
>
<field name="name">Partners template</field>
<field name="filename_pattern">([0-9]{8}[A-Z]).*.pdf</field>
<field name="model_id" ref="base.model_res_partner" />
<field name="directory_pattern">{0}</field>
</record>
<record
id="dms_classification_template_partners_detail_0"
model="dms.classification.template.detail"
>
<field name="parent_id" ref="dms_classification_template_partners" />
<field name="field_id" ref="base.field_res_partner__vat" />
<field name="index">0</field>
</record>
</odoo>

View file

@ -0,0 +1,110 @@
# 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"
"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 "Kreirao"
#. 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 "Kreirano"
#. module: dms_field_auto_classification
#: model:ir.model.fields,field_description:dms_field_auto_classification.field_dms_classification_template__detail_ids
msgid "Details"
msgstr "Detalji"
#. 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 "Prikazani naziv"
#. module: dms_field_auto_classification
#: model:ir.model,name:dms_field_auto_classification.model_dms_classification_template
msgid "Dms Classification Template"
msgstr "DMS šablon 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 "Detalj DMS šablona 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 "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 "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 "Indeks"
#. 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 "Zadnje mijenjano"
#. 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 "Zadnji ažurirao"
#. 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 "Zadnje ažurirano"
#. 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 "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 "Model"
#. 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 "Nasljeđeni"
#. 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 "Referentni 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 "Sekvenca"
#. 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 "Prijedlog"
#. module: dms_field_auto_classification
#: model:ir.model,name:dms_field_auto_classification.model_wizard_dms_classification_detail
msgid "Wizard Dms Classification Detail"
msgstr "Detalj čarobnjaka DMS klasifikacije"

View file

@ -0,0 +1,110 @@
# 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"
"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__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_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 ""

View file

@ -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-03-23 09:34+0000\n"
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\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"
#. 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__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 "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
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_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"
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 "Asistente de Clasificación Dms Detalle"
#~ msgid "DMS Directories"
#~ msgstr "Directorios DMS"

View file

@ -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 16.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2024-10-03 10:06+0000\n"
"Last-Translator: mymage <stefano.consolaro@mymage.it>\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 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
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_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 "Nome 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"

View file

@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import dms_classification_template

View file

@ -0,0 +1,46 @@
# 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", string="Model name", 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)

View file

@ -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.

View file

@ -0,0 +1,4 @@
* `Tecnativa <https://www.tecnativa.com>`_:
* Víctor Martínez
* Pedro M. Baeza

View file

@ -0,0 +1,2 @@
Automatically classify files within a .zip file to the corresponding directory(s)
related to an embedded DMS.

View file

@ -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.

View file

@ -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
1 id name model_id/id group_id/id perm_read perm_write perm_create perm_unlink
2 access_dms_classification_template_detail_manager dms_classification_template_detail_manager model_dms_classification_template_detail dms.group_dms_manager 1 1 1 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -0,0 +1,456 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>Auto classify files into embedded DMS</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
: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.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
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 }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic, pre.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="auto-classify-files-into-embedded-dms">
<h1 class="title">Auto classify files into embedded DMS</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:a65d244a6d0320c99621795ff3fffea604365b53e38b35a93fffe1e00b375d28
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/dms/tree/16.0/dms_field_auto_classification"><img alt="OCA/dms" src="https://img.shields.io/badge/github-OCA%2Fdms-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/dms-16-0/dms-16-0-dms_field_auto_classification"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/dms&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>Automatically classify files within a .zip file to the corresponding directory(s)
related to an embedded DMS.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#configuration" id="toc-entry-1">Configuration</a></li>
<li><a class="reference internal" href="#usage" id="toc-entry-2">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<ol class="arabic simple">
<li>Go to <cite>Documents / Configuration / Classification Templates</cite> and create or edit a template.</li>
<li>You can set a model to which it is linked (res.partner for example).</li>
<li>You can define the details to indicate which field is referenced by the defined filename pattern.</li>
</ol>
<p>Full example from res.partner:</p>
<p>Filename pattern: ([0-9]{8}[A-Z]).*.pdf
Details: VAT (field) and 0 (index)
Directory Pattern example 1: {0} &gt; This will attempt to add the files to the directory linked to the partner with the VAT name.
Directory Pattern example 2: {0} / Misc &gt; This will attempt to add the files to the “Misc” subdirectory linked to the partner with the VAT name.</p>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<ol class="arabic simple">
<li>Go to <cite>Documents / Auto Classification</cite> and select a template and a .zip file.</li>
<li>Press the <cite>Analyze</cite> button</li>
<li>As many lines will be set as the number of files contained in the .zip file and apply the filename pattern.</li>
<li>The record to which they are related (res.partner for example) will be show on the lines.</li>
<li>Press the <cite>Classify</cite> button</li>
<li>The files (dms.file) will be created in the corresponding directories.</li>
</ol>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/dms/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/dms/issues/new?body=module:%20dms_field_auto_classification%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
<ul class="simple">
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Víctor Martínez</li>
<li>Pedro M. Baeza</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
</a>
<p>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.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external image-reference" href="https://github.com/victoralmau"><img alt="victoralmau" src="https://github.com/victoralmau.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/dms/tree/16.0/dms_field_auto_classification">OCA/dms</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>
</div>
</body>
</html>

View file

@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl)
from . import test_dms_field_auto_classification

View file

@ -0,0 +1,191 @@
# 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, new_test_user
from odoo.tests.common import users
from odoo.addons.base.tests.common import BaseCommon
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"
)
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)]
cls.env.ref("dms_field.field_template_partner").unlink()
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.invalidate_model()
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)

View file

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_dms_classification_template_tree" model="ir.ui.view">
<field name="name">dms.classification.template tree</field>
<field name="model">dms.classification.template</field>
<field
name="inherit_id"
ref="dms_auto_classification.view_dms_classification_template_tree"
/>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="model_id" />
</field>
</field>
</record>
<record id="view_dms_classification_template_form" model="ir.ui.view">
<field name="name">dms.classification.template form</field>
<field name="model">dms.classification.template</field>
<field
name="inherit_id"
ref="dms_auto_classification.view_dms_classification_template_form"
/>
<field name="arch" type="xml">
<field name="filename_pattern" position="after">
<field name="model_id" />
<field
name="detail_ids"
attrs="{'invisible' : [('model_id', '=', False)]}"
>
<tree editable="bottom">
<field name="sequence" widget="handle" />
<field name="model_id" invisible="1" />
<field name="field_id" required="1" />
<field name="index" />
</tree>
</field>
</field>
</field>
</record>
</odoo>

View file

@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from . import wizard_dms_classification

View file

@ -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()

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_wizard_dms_classification_form" model="ir.ui.view">
<field name="name">wizard.dms.classification form</field>
<field name="model">wizard.dms.classification</field>
<field
name="inherit_id"
ref="dms_auto_classification.view_wizard_dms_classification_form"
/>
<field name="arch" type="xml">
<xpath
expr="//field[@name='detail_ids']/tree/field[@name='file_name']"
position="after"
>
<field name="record_ref" />
</xpath>
</field>
</record>
</odoo>

View file

@ -0,0 +1,32 @@
# Architecture
```mermaid
flowchart TD
U[Users] -->|HTTP| V[Views and QWeb Templates]
V --> C[Controllers]
V --> W[Wizards Transient Models]
C --> M[Models and ORM]
W --> M
M --> R[Reports]
DX[Data XML] --> M
S[Security ACLs and Groups] -. enforces .-> M
subgraph Dms_field_auto_classification Module - dms_field_auto_classification
direction LR
M:::layer
W:::layer
C:::layer
V:::layer
R:::layer
S:::layer
DX:::layer
end
classDef layer fill:#eef8ff,stroke:#6ea8fe,stroke-width:1px
```
Notes
- Views include tree/form/kanban templates and report templates.
- Controllers provide website/portal routes when present.
- Wizards are UI flows implemented with `models.TransientModel`.
- Data XML loads data/demo records; Security defines groups and access.

View file

@ -0,0 +1,3 @@
# Configuration
Refer to Odoo settings for dms_field_auto_classification. Configure related models, access rights, and options as needed.

View file

@ -0,0 +1,3 @@
# Controllers
This module does not define custom HTTP controllers.

View file

@ -0,0 +1,6 @@
# Dependencies
This addon depends on:
- [dms_auto_classification](../../odoo-bringout-oca-dms-dms_auto_classification)
- [dms_field](../../odoo-bringout-oca-dms-dms_field)

View file

@ -0,0 +1,4 @@
# FAQ
- Q: Which Odoo version? A: 16.0 (OCA/OCB packaged).
- Q: How to enable? A: Start server with --addon dms_field_auto_classification or install in UI.

View file

@ -0,0 +1,7 @@
# Install
```bash
pip install odoo-bringout-oca-dms-dms_field_auto_classification"
# or
uv pip install odoo-bringout-oca-dms-dms_field_auto_classification"
```

View file

@ -0,0 +1,13 @@
# Models
Detected core models and extensions in dms_field_auto_classification.
```mermaid
classDiagram
class dms_classification_template_detail
class dms_classification_template
```
Notes
- Classes show model technical names; fields omitted for brevity.
- Items listed under _inherit are extensions of existing models.

View file

@ -0,0 +1,6 @@
# Overview
Packaged Odoo addon: dms_field_auto_classification. Provides features documented in upstream Odoo 16 under this addon.
- Source: OCA/OCB 16.0, addon dms_field_auto_classification
- License: LGPL-3

View file

@ -0,0 +1,3 @@
# Reports
This module does not define custom reports.

View file

@ -0,0 +1,34 @@
# Security
Access control and security definitions in dms_field_auto_classification.
## Access Control Lists (ACLs)
Model access permissions defined in:
- **[ir.model.access.csv](../dms_field_auto_classification/security/ir.model.access.csv)**
- 1 model access rules
## Record Rules
Row-level security rules defined in:
```mermaid
graph TB
subgraph "Security Layers"
A[Users] --> B[Groups]
B --> C[Access Control Lists]
C --> D[Models]
B --> E[Record Rules]
E --> F[Individual Records]
end
```
Security files overview:
- **[ir.model.access.csv](../dms_field_auto_classification/security/ir.model.access.csv)**
- Model access permissions (CRUD rights)
Notes
- Access Control Lists define which groups can access which models
- Record Rules provide row-level security (filter records by user/group)
- Security groups organize users and define permission sets
- All security is enforced at the ORM level by Odoo

View file

@ -0,0 +1,5 @@
# Troubleshooting
- Ensure Python and Odoo environment matches repo guidance.
- Check database connectivity and logs if startup fails.
- Validate that dependent addons listed in DEPENDENCIES.md are installed.

View file

@ -0,0 +1,7 @@
# Usage
Start Odoo including this addon (from repo root):
```bash
python3 scripts/nix_odoo_web_server.py --db-name mydb --addon dms_field_auto_classification
```

View file

@ -0,0 +1,3 @@
# Wizards
This module does not include UI wizards.

View file

@ -0,0 +1,43 @@
[project]
name = "odoo-bringout-oca-dms-dms_field_auto_classification"
version = "16.0.0"
description = "Auto classify files into embedded DMS - Odoo addon"
authors = [
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
]
dependencies = [
"odoo-bringout-oca-dms-dms_auto_classification>=16.0.0",
"odoo-bringout-oca-dms-dms_field>=16.0.0",
"requests>=2.25.1"
]
readme = "README.md"
requires-python = ">= 3.11"
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Office/Business",
]
[project.urls]
homepage = "https://github.com/bringout/0"
repository = "https://github.com/bringout/0"
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[tool.hatch.metadata]
allow-direct-references = true
[tool.hatch.build.targets.wheel]
packages = ["dms_field_auto_classification"]
[tool.rye]
managed = true
dev-dependencies = [
"pytest>=8.4.1",
]