Skip to content

Commit

Permalink
[MIG] hr_dms_field: Migration to 16.0
Browse files Browse the repository at this point in the history
TT48870
  • Loading branch information
victoralmau committed Jun 10, 2024
1 parent ced4a5a commit 1afc967
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 44 deletions.
10 changes: 5 additions & 5 deletions hr_dms_field/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Add dms field for employees
: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/hr_dms_field
: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-15-0/dms-15-0-hr_dms_field
: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=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|
Expand Down Expand Up @@ -57,7 +57,7 @@ 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:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`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.

Expand Down Expand Up @@ -98,6 +98,6 @@ 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/15.0/hr_dms_field>`_ project on GitHub.
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.
2 changes: 1 addition & 1 deletion hr_dms_field/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Add dms field for employees",
"version": "15.0.1.1.0",
"version": "16.0.1.0.0",
"category": "Human Resources",
"website": "https://github.com/OCA/dms",
"author": "Tecnativa, Odoo Community Association (OCA)",
Expand Down
1 change: 1 addition & 0 deletions hr_dms_field/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +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
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"]
17 changes: 10 additions & 7 deletions hr_dms_field/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@

/*
:Author: David Goodger ([email protected])
: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.
Expand Down Expand Up @@ -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 }
Expand All @@ -300,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -368,7 +369,7 @@ <h1 class="title">Add dms field for employees</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:420f21e5b71335f81807b2d0fb9d44333e7697d72b1f4f4a714036de241b98f3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/15.0/hr_dms_field"><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-15-0/dms-15-0-hr_dms_field"><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=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<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/hr_dms_field"><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-hr_dms_field"><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>Add the Documents tab with the files in the employee’s form view.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
Expand Down Expand Up @@ -404,7 +405,7 @@ <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:%20hr_dms_field%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<a class="reference external" href="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**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
Expand All @@ -428,13 +429,15 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<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>
<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/15.0/hr_dms_field">OCA/dms</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/dms/tree/16.0/hr_dms_field">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>
Expand Down
13 changes: 13 additions & 0 deletions hr_dms_field/static/src/js/base/dms_list_controller.esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @odoo-module **/

import {patch} from "@web/core/utils/patch";
import {DMSListControllerObject} from "@dms_field/views/dms_list/dms_list_controller.esm";

patch(DMSListControllerObject, "hr_dms_field.DMSListControllerObject", {
sanitizeDMSModel: function (model) {
if (model === "hr.employee.public") {
return "hr.employee";
}
return this._super(...arguments);
},
});
15 changes: 0 additions & 15 deletions hr_dms_field/static/src/js/base/dms_tree_controller.js

This file was deleted.

20 changes: 6 additions & 14 deletions hr_dms_field/tests/test_hr_dms_field.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
# Copyright 2024 Tecnativa - Víctor Martínez
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).

from odoo.tests import common, new_test_user
from odoo.tests import new_test_user

from odoo.addons.base.tests.common import BaseCommon

class TestHrDmsField(common.TransactionCase):

class TestHrDmsField(BaseCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(
context=dict(
cls.env.context,
mail_create_nolog=True,
mail_create_nosubscribe=True,
mail_notrack=True,
no_reset_password=True,
tracking_disable=True,
)
)
cls.template = cls.env.ref("hr_dms_field.field_template_employee")
cls.storage = cls.template.storage_id
cls.access_group = cls.template.group_ids
Expand All @@ -44,7 +36,7 @@ def test_employee_exists(self):

def test_employee_create_01(self):
employee = self.employee_model.create({"name": "Test employee"})
employee.refresh()
employee.invalidate_model()
directory = employee.dms_directory_ids
self.assertEqual(len(directory), 1)
self.assertEqual(directory.storage_id, self.storage)
Expand All @@ -62,5 +54,5 @@ def test_employee_create_02(self):
"user_id": self.user.id,
}
)
employee.refresh()
employee.invalidate_model()
self.assertIn(self.user, employee.dms_directory_ids.group_ids.explicit_user_ids)
4 changes: 2 additions & 2 deletions hr_dms_field/views/hr_employee_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
string="Documents"
attrs="{'invisible': [('id', '=', False)]}"
>
<field name="dms_directory_ids" mode="dms_tree" />
<field name="dms_directory_ids" mode="dms_list" />
</page>
</notebook>
</field>
Expand All @@ -31,7 +31,7 @@
string="Documents"
attrs="{'invisible': [('is_logged', '=', False)]}"
>
<field name="dms_directory_ids" mode="dms_tree" />
<field name="dms_directory_ids" mode="dms_list" />
</page>
</notebook>
</field>
Expand Down

0 comments on commit 1afc967

Please sign in to comment.