Skip to content

Commit

Permalink
[MIG] hr_employee_document: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
HeliconiaSolutions committed Dec 13, 2024
1 parent 3341bbf commit b9c639d
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 35 deletions.
30 changes: 16 additions & 14 deletions hr_employee_document/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ HR Employee Document
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fhr-lightgray.png?logo=github
:target: https://github.com/OCA/hr/tree/17.0/hr_employee_document
:target: https://github.com/OCA/hr/tree/18.0/hr_employee_document
:alt: OCA/hr
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/hr-17-0/hr-17-0-hr_employee_document
:target: https://translation.odoo-community.org/projects/hr-18-0/hr-18-0-hr_employee_document
: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/hr&target_branch=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/hr&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -51,7 +51,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/hr/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/hr/issues/new?body=module:%20hr_employee_document%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/hr/issues/new?body=module:%20hr_employee_document%0Aversion:%2018.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 All @@ -66,22 +66,24 @@ Authors
Contributors
------------

- `CorporateHub <https://corporatehub.eu/>`__
- `CorporateHub <https://corporatehub.eu/>`__

- Alexey Pelykh <alexey.pelykh@corphub.eu>
- Alexey Pelykh <alexey.pelykh@corphub.eu>

- Tharathip Chaweewongphan <tharathipc@ecosoft.co.th>
- Tharathip Chaweewongphan <tharathipc@ecosoft.co.th>

- `Tecnativa <https://www.tecnativa.com>`__:
- `Tecnativa <https://www.tecnativa.com>`__:

- Víctor Martínez
- Víctor Martínez

- Alberto Nieto de Pablos <alberto.nieto@braintec.com>
(https://braintec.com)
- Alberto Nieto de Pablos <alberto.nieto@braintec.com>
(https://braintec.com)

- `APSL-Nagarro <https://www.apsl.tech>`__:
- `APSL-Nagarro <https://www.apsl.tech>`__:

- Antoni Marroig <amarroig@apsl.net>
- Antoni Marroig <amarroig@apsl.net>

- ``Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>``\ \_

Maintainers
-----------
Expand All @@ -96,6 +98,6 @@ 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.

This module is part of the `OCA/hr <https://github.com/OCA/hr/tree/17.0/hr_employee_document>`_ project on GitHub.
This module is part of the `OCA/hr <https://github.com/OCA/hr/tree/18.0/hr_employee_document>`_ 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_employee_document/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

{
"name": "HR Employee Document",
"version": "17.0.1.0.1",
"version": "18.0.1.0.0",
"category": "Human Resources",
"website": "https://github.com/OCA/hr",
"author": "CorporateHub, Odoo Community Association (OCA)",
Expand Down
6 changes: 2 additions & 4 deletions hr_employee_document/models/hr_employee.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def _compute_document_count(self):
record.document_count = count_dict.get(record.id, 0)

@api.model
def check_access_rights(self, operation, raise_exception=True):
def check_access(self, operation):
"""Return access to the hr.employee model if we pass a specific context,
is a trick to list the attachments related to an employee."""
if (
Expand All @@ -38,9 +38,7 @@ def check_access_rights(self, operation, raise_exception=True):
or self in self.env.user.employee_ids
):
return True

Check warning on line 40 in hr_employee_document/models/hr_employee.py

View check run for this annotation

Codecov / codecov/patch

hr_employee_document/models/hr_employee.py#L40

Added line #L40 was not covered by tests
return super().check_access_rights(
operation=operation, raise_exception=raise_exception
)
return super().check_access(operation=operation)

def action_get_attachment_tree_view(self):
action = self.env["ir.actions.act_window"]._for_xml_id("base.action_attachment")
Expand Down
1 change: 1 addition & 0 deletions hr_employee_document/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@

- [APSL-Nagarro](https://www.apsl.tech):
- Antoni Marroig \<<amarroig@apsl.net>\>
- `Heliconia Solutions Pvt. Ltd. <https://www.heliconia.io>`_
19 changes: 12 additions & 7 deletions hr_employee_document/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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">HR Employee Document</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:4773871ade1b1c437434addb02c0950ef49764f8eefe0f0770827db7879f75f5
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/hr/tree/17.0/hr_employee_document"><img alt="OCA/hr" src="https://img.shields.io/badge/github-OCA%2Fhr-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/hr-17-0/hr-17-0-hr_employee_document"><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/hr&amp;target_branch=17.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/hr/tree/18.0/hr_employee_document"><img alt="OCA/hr" src="https://img.shields.io/badge/github-OCA%2Fhr-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/hr-18-0/hr-18-0-hr_employee_document"><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/hr&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module displays a button on the employee’s profile to view linked
attachments, both for HR officers/managers and the own employee, so you
can use it as employee document storage.</p>
Expand Down Expand Up @@ -397,7 +398,7 @@ <h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/hr/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/hr/issues/new?body=module:%20hr_employee_document%0Aversion:%2017.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/hr/issues/new?body=module:%20hr_employee_document%0Aversion:%2018.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 Down Expand Up @@ -433,16 +434,20 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<li>Antoni Marroig &lt;<a class="reference external" href="mailto:amarroig&#64;apsl.net">amarroig&#64;apsl.net</a>&gt;</li>
</ul>
</li>
<li><p class="first"><tt class="docutils literal">Heliconia Solutions Pvt. Ltd. <span class="pre">&lt;https://www.heliconia.io&gt;</span></tt>_</p>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-6">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>This module is part of the <a class="reference external" href="https://github.com/OCA/hr/tree/17.0/hr_employee_document">OCA/hr</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/hr/tree/18.0/hr_employee_document">OCA/hr</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
19 changes: 11 additions & 8 deletions hr_employee_document/tests/test_hr_employee_document.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ def setUpClass(cls):
cls.user_2 = new_test_user(cls.env, login="test-user-2")
new_test_user(cls.env, login="test-user-manager", groups="hr.group_hr_user")
cls.employee_1 = cls.env["hr.employee"].create(
{"name": "Employee #1", "user_id": cls.user_1.id}
[{"name": "Employee #1", "user_id": cls.user_1.id}]
)
cls.employee_2 = cls.env["hr.employee"].create(
{"name": "Employee #2", "user_id": cls.user_2.id}
[{"name": "Employee #2", "user_id": cls.user_2.id}]
)

@classmethod
Expand All @@ -38,12 +38,15 @@ def _create_attachment(self, employee_id):
self.env["ir.attachment"]
.sudo()
.create(
{
"res_model": employee_id._name,
"res_id": employee_id.id,
"datas": base64.b64encode(b"My attachment"),
"name": "doc.txt",
}
[
{
"res_model": employee_id._name,
"res_id": employee_id.id,
"datas": base64.b64encode(b"My attachment"),
"name": "doc.txt",
"public": True,
}
]
)
)

Expand Down
2 changes: 1 addition & 1 deletion hr_employee_document/views/hr_employee.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<field name="document_count" widget="statinfo" string="Documents" />
</button>
</div>
<xpath expr="//div[hasclass('oe_chatter')]" position="before">
<xpath expr="//chatter" position="before">
<div class="o_attachment_preview" />
</xpath>
</field>
Expand Down

0 comments on commit b9c639d

Please sign in to comment.