Skip to content

Commit

Permalink
Merge PR #340 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by pedrobaeza
  • Loading branch information
OCA-git-bot committed Jun 21, 2024
2 parents 22f8be4 + d5c2fe2 commit 8a32bc1
Show file tree
Hide file tree
Showing 23 changed files with 901 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dms_field/tests/test_dms_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_creation_process_01(self):
self.assertEqual(total, 1)
# Create directory again (access groups are the same)
template.create_dms_directory()
self.partner.refresh()
self.partner.invalidate_model()
directory_0 = self.partner.dms_directory_ids[0]
self.assertEqual(directory_0.group_ids, old_groups)

Expand Down
103 changes: 103 additions & 0 deletions hr_dms_field/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
===========================
Add dms field for employees
===========================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:75c4cb1c0cd65b8bcfa4c07c1a764db17142895a46365763c1fcadae513db0a6
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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/hr_dms_field
: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-hr_dms_field
: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|

Add the Documents tab with the files in the employee's form view.

**Table of contents**

.. contents::
:local:

Configuration
=============

#. *Go to Documents > Configuration > File templates* and create a new record.
#. Set a storage, a model (hr.employee) and the access groups you want.
#. Click on the "Documents" tab icon and a folder hierarchy will be created.
#. You can set here the hierarchy of directories, subdirectories and files you need, this hierarchy will be used as a base when creating a new record (res.partner for example).

Usage
=====

#. Go to the form view of an existing employee and click on the "Documents" tab icon, a hierarchy of
folders and files linked to that record will be created.
#. Create a new employee. A hierarchy of folders and files linked to that record will be created.


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:%20hr_dms_field%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/hr_dms_field>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions hr_dms_field/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import models
20 changes: 20 additions & 0 deletions hr_dms_field/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright 2024 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Add dms field for employees",
"version": "16.0.1.0.0",
"category": "Human Resources",
"website": "https://github.com/OCA/dms",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": ["hr", "dms_field"],
"installable": True,
"data": ["views/hr_employee_view.xml"],
"demo": ["demo/dms_data.xml"],
"assets": {
"web.assets_backend": [
"hr_dms_field/static/src/js/**/*",
],
},
"maintainers": ["victoralmau"],
}
20 changes: 20 additions & 0 deletions hr_dms_field/demo/dms_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="read_access_hr_employee_group" model="dms.access.group">
<field name="name">Everyone for Employee DMS</field>
<field name="group_ids" eval="[(4, ref('hr.group_hr_user'))]" />
<field name="perm_create" eval="True" />
<field name="perm_write" eval="True" />
<field name="perm_unlink" eval="True" />
</record>
<record id="field_template_employee" model="dms.field.template">
<field name="name">Employee</field>
<field name="storage_id" ref="dms.storage_demo" />
<field name="model_id" ref="hr.model_hr_employee" />
<field name="user_field_id" ref="hr.field_hr_employee__user_id" />
<field name="group_ids" eval="[(4, ref('read_access_hr_employee_group'))]" />
</record>
<function model="dms.field.template" name="_create_dms_directory">
<value eval="[ref('field_template_employee')]" />
</function>
</odoo>
50 changes: 50 additions & 0 deletions hr_dms_field/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hr_dms_field
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-02-07 16:03+0000\n"
"PO-Revision-Date: 2024-03-23 09:34+0000\n"
"Last-Translator: Ivorra78 <[email protected]>\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: hr_dms_field
#: model:ir.model.fields,field_description:hr_dms_field.field_dms_field_template__dms_directory_ids
#: model:ir.model.fields,field_description:hr_dms_field.field_hr_employee_public__dms_directory_ids
msgid "DMS Directories"
msgstr "Directorios DMS"

#. module: hr_dms_field
#: model:ir.model,name:hr_dms_field.model_dms_field_template
msgid "Dms Field Template"
msgstr "Plantilla de Campo Dms"

#. module: hr_dms_field
#: model_terms:ir.ui.view,arch_db:hr_dms_field.hr_employee_public_view_form
#: model_terms:ir.ui.view,arch_db:hr_dms_field.view_employee_form
msgid "Documents"
msgstr "Documentos"

#. module: hr_dms_field
#: model:dms.access.group,name:hr_dms_field.read_access_hr_employee_group
msgid "Everyone for Employee DMS"
msgstr "Todos para empleados DMS"

#. module: hr_dms_field
#: model:ir.model.fields,field_description:hr_dms_field.field_hr_employee_public__is_logged
msgid "Is Logged"
msgstr "Está registrado/a"

#. module: hr_dms_field
#: model:ir.model,name:hr_dms_field.model_hr_employee_public
msgid "Public Employee"
msgstr "Empleado Público"
52 changes: 52 additions & 0 deletions hr_dms_field/i18n/hr_dms_field.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * hr_dms_field
#
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: hr_dms_field
#: model:ir.model.fields,field_description:hr_dms_field.field_dms_field_template__dms_directory_ids
#: model:ir.model.fields,field_description:hr_dms_field.field_hr_employee__dms_directory_ids
#: model:ir.model.fields,field_description:hr_dms_field.field_hr_employee_public__dms_directory_ids
msgid "DMS Directories"
msgstr ""

#. module: hr_dms_field
#: model:ir.model,name:hr_dms_field.model_dms_field_template
msgid "Dms Field Template"
msgstr ""

#. module: hr_dms_field
#: model_terms:ir.ui.view,arch_db:hr_dms_field.hr_employee_public_view_form
#: model_terms:ir.ui.view,arch_db:hr_dms_field.view_employee_form
msgid "Documents"
msgstr ""

#. module: hr_dms_field
#: model:ir.model,name:hr_dms_field.model_hr_employee
msgid "Employee"
msgstr ""

#. module: hr_dms_field
#: model:dms.access.group,name:hr_dms_field.read_access_hr_employee_group
msgid "Everyone for Employee DMS"
msgstr ""

#. module: hr_dms_field
#: model:ir.model.fields,field_description:hr_dms_field.field_hr_employee_public__is_logged
msgid "Is Logged"
msgstr ""

#. module: hr_dms_field
#: model:ir.model,name:hr_dms_field.model_hr_employee_public
msgid "Public Employee"
msgstr ""
5 changes: 5 additions & 0 deletions hr_dms_field/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from . import dms_field_template
from . import hr_employee
from . import hr_employee_public
17 changes: 17 additions & 0 deletions hr_dms_field/models/dms_field_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright 2024 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models


class DmsFieldTemplate(models.Model):
_inherit = "dms.field.template"

def _create_dms_directory(self):
"""Custom method to define the directory automatically in demo data avoiding
error if it already exists."""
self.ensure_one()
if not self.dms_directory_ids:
self.with_context(
res_model=self._name, res_id=self.id
).create_dms_directory()
9 changes: 9 additions & 0 deletions hr_dms_field/models/hr_employee.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright 2024 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import models


class HrEmployeeBase(models.AbstractModel):
_name = "hr.employee.base"
_inherit = ["hr.employee.base", "dms.field.mixin"]
16 changes: 16 additions & 0 deletions hr_dms_field/models/hr_employee_public.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import fields, models


class HrEmployeePublic(models.Model):
_inherit = "hr.employee.public"

is_logged = fields.Boolean(compute="_compute_is_logged", store=False)

def _compute_is_logged(self):
self.is_logged = False
for record in self:
if self.env.user == record.user_id:
record.is_logged = True
4 changes: 4 additions & 0 deletions hr_dms_field/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#. *Go to Documents > Configuration > File templates* and create a new record.
#. Set a storage, a model (hr.employee) and the access groups you want.
#. Click on the "Documents" tab icon and a folder hierarchy will be created.
#. You can set here the hierarchy of directories, subdirectories and files you need, this hierarchy will be used as a base when creating a new record (res.partner for example).
4 changes: 4 additions & 0 deletions hr_dms_field/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* `Tecnativa <https://www.tecnativa.com>`_:

* Víctor Martínez
* Pedro M. Baeza
1 change: 1 addition & 0 deletions hr_dms_field/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add the Documents tab with the files in the employee's form view.
4 changes: 4 additions & 0 deletions hr_dms_field/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#. Go to the form view of an existing employee and click on the "Documents" tab icon, a hierarchy of
folders and files linked to that record will be created.
#. Create a new employee. A hierarchy of folders and files linked to that record will be created.

Binary file added hr_dms_field/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8a32bc1

Please sign in to comment.