Skip to content

Commit

Permalink
[MIG] hr_timesheet_analytic_tag: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
peluko00 committed Nov 20, 2024
1 parent ac31e1f commit 447fe6c
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 24 deletions.
15 changes: 8 additions & 7 deletions hr_timesheet_analytic_tag/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ Hr Timesheet Analytic Tag
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Faccount--analytic-lightgray.png?logo=github
:target: https://github.com/OCA/account-analytic/tree/17.0/hr_timesheet_analytic_tag
:target: https://github.com/OCA/account-analytic/tree/18.0/hr_timesheet_analytic_tag
:alt: OCA/account-analytic
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/account-analytic-17-0/account-analytic-17-0-hr_timesheet_analytic_tag
:target: https://translation.odoo-community.org/projects/account-analytic-18-0/account-analytic-18-0-hr_timesheet_analytic_tag
: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/account-analytic&target_branch=17.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/account-analytic&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -43,7 +43,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-analytic/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/account-analytic/issues/new?body=module:%20hr_timesheet_analytic_tag%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/account-analytic/issues/new?body=module:%20hr_timesheet_analytic_tag%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 @@ -63,9 +63,10 @@ Contributors
- Víctor Martínez
- Pedro M. Baeza

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

- Bernat Obrador
- Bernat Obrador <bobrador@apsl.net>
- Antoni Marroig <amarroig@apsl.net>

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

|maintainer-victoralmau|

This module is part of the `OCA/account-analytic <https://github.com/OCA/account-analytic/tree/17.0/hr_timesheet_analytic_tag>`_ project on GitHub.
This module is part of the `OCA/account-analytic <https://github.com/OCA/account-analytic/tree/18.0/hr_timesheet_analytic_tag>`_ 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_timesheet_analytic_tag/__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": "Hr Timesheet Analytic Tag",
"version": "17.0.1.0.0",
"version": "18.0.1.0.0",
"category": "Accounting & Finance",
"website": "https://github.com/OCA/account-analytic",
"author": "Tecnativa, Odoo Community Association (OCA)",
Expand Down
8 changes: 4 additions & 4 deletions hr_timesheet_analytic_tag/models/account_analytic_line.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Copyright 2023 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from odoo import Command, models
from odoo import Command, api, models


class AccountAnalyticLine(models.Model):
_inherit = "account.analytic.line"

def _timesheet_preprocess(self, vals_list):
res = super()._timesheet_preprocess(vals_list)
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if vals.get("task_id") and not vals.get("tag_ids"):
task = self.env["project.task"].browse(vals.get("task_id"))
vals["tag_ids"] = [Command.set(task.analytic_tag_ids.ids)]
return res
return super().create(vals_list)
5 changes: 3 additions & 2 deletions hr_timesheet_analytic_tag/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- [Tecnativa](https://www.tecnativa.com):
- Víctor Martínez
- Pedro M. Baeza
- APSL - Nagarro \<<https://apsl.tech>\>
- Bernat Obrador
- [APSL-Nagarro](https://www.apsl.tech):
- Bernat Obrador \<<bobrador@apsl.net>\>
- Antoni Marroig \<<amarroig@apsl.net>\>
11 changes: 6 additions & 5 deletions hr_timesheet_analytic_tag/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ <h1 class="title">Hr Timesheet Analytic Tag</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:618b0e3c7c18155dc29be473e79af28f27c2c9f7d99fbf8ecabf35c5f79ba7d2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/account-analytic/tree/17.0/hr_timesheet_analytic_tag"><img alt="OCA/account-analytic" src="https://img.shields.io/badge/github-OCA%2Faccount--analytic-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-analytic-17-0/account-analytic-17-0-hr_timesheet_analytic_tag"><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/account-analytic&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/account-analytic/tree/18.0/hr_timesheet_analytic_tag"><img alt="OCA/account-analytic" src="https://img.shields.io/badge/github-OCA%2Faccount--analytic-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-analytic-18-0/account-analytic-18-0-hr_timesheet_analytic_tag"><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/account-analytic&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>The module restores the possibility of defining analytical tags in
project tasks and timesheets so that the analytical items generated have
those tags.</p>
Expand All @@ -390,7 +390,7 @@ <h1><a class="toc-backref" href="#toc-entry-1">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/account-analytic/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/account-analytic/issues/new?body=module:%20hr_timesheet_analytic_tag%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/account-analytic/issues/new?body=module:%20hr_timesheet_analytic_tag%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 All @@ -409,8 +409,9 @@ <h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<li>Pedro M. Baeza</li>
</ul>
</li>
<li>APSL - Nagarro &lt;<a class="reference external" href="https://apsl.tech">https://apsl.tech</a>&gt;<ul>
<li>Bernat Obrador</li>
<li><a class="reference external" href="https://www.apsl.tech">APSL-Nagarro</a>:<ul>
<li>Bernat Obrador &lt;<a class="reference external" href="mailto:bobrador&#64;apsl.net">bobrador&#64;apsl.net</a>&gt;</li>
<li>Antoni Marroig &lt;<a class="reference external" href="mailto:amarroig&#64;apsl.net">amarroig&#64;apsl.net</a>&gt;</li>
</ul>
</li>
</ul>
Expand All @@ -426,7 +427,7 @@ <h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
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/account-analytic/tree/17.0/hr_timesheet_analytic_tag">OCA/account-analytic</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/account-analytic/tree/18.0/hr_timesheet_analytic_tag">OCA/account-analytic</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
Original file line number Diff line number Diff line change
Expand Up @@ -63,27 +63,23 @@ def _create_hr_timesheet(self):
)

def test_hr_timesheet_without_tags(self):
self.task.analytic_account_id = self.analytic_account_1
timesheet = self._create_hr_timesheet()
self.assertNotIn(self.analytic_tag_1, timesheet.tag_ids)
self.assertNotIn(self.analytic_tag_2, timesheet.tag_ids)

def test_hr_timesheet_with_tag_01(self):
self.task.analytic_account_id = self.analytic_account_1
self.task.analytic_tag_ids = self.analytic_tag_1
timesheet = self._create_hr_timesheet()
self.assertIn(self.analytic_tag_1, timesheet.tag_ids)
self.assertNotIn(self.analytic_tag_2, timesheet.tag_ids)

def test_hr_timesheet_with_tag_02(self):
self.task.analytic_account_id = self.analytic_account_1
self.task.analytic_tag_ids = self.analytic_tag_2
timesheet = self._create_hr_timesheet()
self.assertNotIn(self.analytic_tag_1, timesheet.tag_ids)
self.assertIn(self.analytic_tag_2, timesheet.tag_ids)

def test_hr_timesheet_with_tags(self):
self.task.analytic_account_id = self.analytic_account_1
self.task.analytic_tag_ids = self.analytic_tag_1 + self.analytic_tag_2
timesheet = self._create_hr_timesheet()
self.assertIn(self.analytic_tag_1, timesheet.tag_ids)
Expand Down
2 changes: 1 addition & 1 deletion hr_timesheet_analytic_tag/views/project_task_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<field name="model">project.task</field>
<field name="inherit_id" ref="project.view_task_form2" />
<field name="arch" type="xml">
<field name="analytic_account_id" position="after">
<field name="parent_id" position="after">
<field
name="analytic_tag_ids"
groups="account_analytic_tag.group_analytic_tags"
Expand Down

0 comments on commit 447fe6c

Please sign in to comment.