Skip to content

Commit

Permalink
[MIG] project_hr: Migration to v12
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor M.M. Torres authored and OCA-git-bot committed Aug 28, 2019
1 parent fe7313e commit dd0ecab
Show file tree
Hide file tree
Showing 8 changed files with 71 additions and 20 deletions.
25 changes: 17 additions & 8 deletions project_hr/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Project HR
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fproject-lightgray.png?logo=github
:target: https://github.com/OCA/project/tree/11.0/project_hr
:target: https://github.com/OCA/project/tree/12.0/project_hr
:alt: OCA/project
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/project-11-0/project-11-0-project_hr
:target: https://translation.odoo-community.org/projects/project-12-0/project-12-0-project_hr
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/140/11.0
:target: https://runbot.odoo-community.org/runbot/140/12.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -53,13 +53,14 @@ Configuration

For setting employee categories at project level:

#. Go to *Project > Dashboard*.
#. Click on the 3 vertical dots for unfolding options and select "Settings".
#. Go to *Project > Projects*.
#. Click on the 3 vertical dots of one of the project kanban cards for
unfolding options and select "Edit".
#. Put the wanted employee categories on the field "Employee Categories".

For setting employee categories:

#. Go to *Project > Search > Tasks*.
#. Go to *Project > All Tasks*.
#. Select or create a new task.
#. Put the wanted employee categories on the field "Employee categories".
#. If there's already some employee categories selected at project level, those
Expand All @@ -85,7 +86,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/project/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/project/issues/new?body=module:%20project_hr%0Aversion:%2011.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/project/issues/new?body=module:%20project_hr%0Aversion:%2012.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 @@ -97,6 +98,14 @@ Authors

* Tecnativa

Contributors
~~~~~~~~~~~~

* `Tecnativa <https://www.tecnativa.com>`_:

* Pedro M. Baeza
* Victor M.M. Torres

Maintainers
~~~~~~~~~~~

Expand All @@ -118,6 +127,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-pedrobaeza|

This module is part of the `OCA/project <https://github.com/OCA/project/tree/11.0/project_hr>`_ project on GitHub.
This module is part of the `OCA/project <https://github.com/OCA/project/tree/12.0/project_hr>`_ 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 project_hr/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'name': 'Project HR',
'summary': "Link HR with project",
'development_status': 'Production/Stable',
'version': '11.0.1.0.0',
'version': '12.0.1.0.0',
'license': 'AGPL-3',
'author': 'Tecnativa,Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/project',
Expand Down
1 change: 1 addition & 0 deletions project_hr/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
from . import project_project
from . import project_task
from . import res_users
from . import hr_employee
15 changes: 15 additions & 0 deletions project_hr/models/hr_employee.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Copyright 2019 Tecnativa - Victor M.M. Torres
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, models


class HrEmployee(models.Model):
_inherit = 'hr.employee'

@api.model
def create(self, vals):
employee = super().create(vals)
if employee.category_ids:
self.env['project.task'].invalidate_cache()
return employee
7 changes: 4 additions & 3 deletions project_hr/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
For setting employee categories at project level:

#. Go to *Project > Dashboard*.
#. Click on the 3 vertical dots for unfolding options and select "Settings".
#. Go to *Project > Projects*.
#. Click on the 3 vertical dots of one of the project kanban cards for
unfolding options and select "Edit".
#. Put the wanted employee categories on the field "Employee Categories".

For setting employee categories:

#. Go to *Project > Search > Tasks*.
#. Go to *Project > All Tasks*.
#. Select or create a new task.
#. Put the wanted employee categories on the field "Employee categories".
#. If there's already some employee categories selected at project level, those
Expand Down
4 changes: 4 additions & 0 deletions project_hr/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* `Tecnativa <https://www.tecnativa.com>`_:

* Pedro M. Baeza
* Victor M.M. Torres
28 changes: 20 additions & 8 deletions project_hr/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Project HR</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" 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" href="https://github.com/OCA/project/tree/11.0/project_hr"><img alt="OCA/project" src="https://img.shields.io/badge/github-OCA%2Fproject-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/project-11-0/project-11-0-project_hr"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/140/11.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Production/Stable" src="https://img.shields.io/badge/maturity-Production%2FStable-green.png" /></a> <a class="reference external" 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" href="https://github.com/OCA/project/tree/12.0/project_hr"><img alt="OCA/project" src="https://img.shields.io/badge/github-OCA%2Fproject-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/project-12-0/project-12-0-project_hr"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/140/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>This is a technical module for adding some HR information to projects and
provide technical fields with HR information:</p>
<ul class="simple">
Expand All @@ -394,7 +394,8 @@ <h1 class="title">Project HR</h1>
<li><a class="reference internal" href="#bug-tracker" id="id4">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id5">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id6">Authors</a></li>
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
<li><a class="reference internal" href="#contributors" id="id7">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="id8">Maintainers</a></li>
</ul>
</li>
</ul>
Expand All @@ -403,13 +404,14 @@ <h1 class="title">Project HR</h1>
<h1><a class="toc-backref" href="#id1">Configuration</a></h1>
<p>For setting employee categories at project level:</p>
<ol class="arabic simple">
<li>Go to <em>Project &gt; Dashboard</em>.</li>
<li>Click on the 3 vertical dots for unfolding options and select “Settings”.</li>
<li>Go to <em>Project &gt; Projects</em>.</li>
<li>Click on the 3 vertical dots of one of the project kanban cards for
unfolding options and select “Edit”.</li>
<li>Put the wanted employee categories on the field “Employee Categories”.</li>
</ol>
<p>For setting employee categories:</p>
<ol class="arabic simple">
<li>Go to <em>Project &gt; Search &gt; Tasks</em>.</li>
<li>Go to <em>Project &gt; All Tasks</em>.</li>
<li>Select or create a new task.</li>
<li>Put the wanted employee categories on the field “Employee categories”.</li>
<li>If there’s already some employee categories selected at project level, those
Expand Down Expand Up @@ -437,7 +439,7 @@ <h1><a class="toc-backref" href="#id4">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/project/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 smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/project/issues/new?body=module:%20project_hr%0Aversion:%2011.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/project/issues/new?body=module:%20project_hr%0Aversion:%2012.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 @@ -448,16 +450,26 @@ <h2><a class="toc-backref" href="#id6">Authors</a></h2>
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id7">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Pedro M. Baeza</li>
<li>Victor M.M. Torres</li>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
<h2><a class="toc-backref" href="#id8">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" href="https://github.com/pedrobaeza"><img alt="pedrobaeza" src="https://github.com/pedrobaeza.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/project/tree/11.0/project_hr">OCA/project</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/project/tree/12.0/project_hr">OCA/project</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
9 changes: 9 additions & 0 deletions project_hr/tests/test_project_hr.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ def test_user(self):
self.assertEqual(
self.user.hr_category_ids, self.hr_category + self.hr_category_2,
)
self.hr_category_3 = self.env['hr.employee.category'].create({
'name': 'Test employee category 3',
})
# Check if need invalidate cache
self.employee.category_ids = [(4, self.hr_category_3.id)]
self.assertEqual(
self.user.hr_category_ids,
self.hr_category + self.hr_category_2 + self.hr_category_3,
)

def test_task(self):
self.assertEqual(self.task.employee_id, self.employee)
Expand Down

0 comments on commit dd0ecab

Please sign in to comment.