From 447fe6cc35f25e1445be1bd0ac6dc6bbf3c9696f Mon Sep 17 00:00:00 2001
From: Antoni Marroig Campomar
Date: Wed, 20 Nov 2024 12:01:54 +0100
Subject: [PATCH] [MIG] hr_timesheet_analytic_tag: Migration to 18.0
---
hr_timesheet_analytic_tag/README.rst | 15 ++++++++-------
hr_timesheet_analytic_tag/__manifest__.py | 2 +-
.../models/account_analytic_line.py | 8 ++++----
hr_timesheet_analytic_tag/readme/CONTRIBUTORS.md | 5 +++--
.../static/description/index.html | 11 ++++++-----
.../tests/test_hr_timesheet_analytic_tag.py | 4 ----
.../views/project_task_view.xml | 2 +-
7 files changed, 23 insertions(+), 24 deletions(-)
diff --git a/hr_timesheet_analytic_tag/README.rst b/hr_timesheet_analytic_tag/README.rst
index 72e85ebeed..f620c5a455 100644
--- a/hr_timesheet_analytic_tag/README.rst
+++ b/hr_timesheet_analytic_tag/README.rst
@@ -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|
@@ -43,7 +43,7 @@ Bug Tracker
Bugs are tracked on `GitHub 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 `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -63,9 +63,10 @@ Contributors
- Víctor Martínez
- Pedro M. Baeza
-- APSL - Nagarro
+- `APSL-Nagarro `__:
- - Bernat Obrador
+ - Bernat Obrador
+ - Antoni Marroig
Maintainers
-----------
@@ -88,6 +89,6 @@ Current `maintainer `__:
|maintainer-victoralmau|
-This module is part of the `OCA/account-analytic `_ project on GitHub.
+This module is part of the `OCA/account-analytic `_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
diff --git a/hr_timesheet_analytic_tag/__manifest__.py b/hr_timesheet_analytic_tag/__manifest__.py
index 9d371b13e0..d2fe9b792b 100644
--- a/hr_timesheet_analytic_tag/__manifest__.py
+++ b/hr_timesheet_analytic_tag/__manifest__.py
@@ -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)",
diff --git a/hr_timesheet_analytic_tag/models/account_analytic_line.py b/hr_timesheet_analytic_tag/models/account_analytic_line.py
index f412b7be67..4de51c9779 100644
--- a/hr_timesheet_analytic_tag/models/account_analytic_line.py
+++ b/hr_timesheet_analytic_tag/models/account_analytic_line.py
@@ -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)
diff --git a/hr_timesheet_analytic_tag/readme/CONTRIBUTORS.md b/hr_timesheet_analytic_tag/readme/CONTRIBUTORS.md
index d7cc7b52ca..4f4ad8cc65 100644
--- a/hr_timesheet_analytic_tag/readme/CONTRIBUTORS.md
+++ b/hr_timesheet_analytic_tag/readme/CONTRIBUTORS.md
@@ -1,5 +1,6 @@
- [Tecnativa](https://www.tecnativa.com):
- Víctor Martínez
- Pedro M. Baeza
-- APSL - Nagarro \<\>
- - Bernat Obrador
+- [APSL-Nagarro](https://www.apsl.tech):
+ - Bernat Obrador \<\>
+ - Antoni Marroig \<\>
\ No newline at end of file
diff --git a/hr_timesheet_analytic_tag/static/description/index.html b/hr_timesheet_analytic_tag/static/description/index.html
index f2a690456c..cdb17b2767 100644
--- a/hr_timesheet_analytic_tag/static/description/index.html
+++ b/hr_timesheet_analytic_tag/static/description/index.html
@@ -369,7 +369,7 @@ Hr Timesheet Analytic Tag
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:618b0e3c7c18155dc29be473e79af28f27c2c9f7d99fbf8ecabf35c5f79ba7d2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-
+
The module restores the possibility of defining analytical tags in
project tasks and timesheets so that the analytical items generated have
those tags.
@@ -390,7 +390,7 @@
Bugs are tracked on GitHub 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.
+feedback.
Do not contact contributors directly about support or help with technical issues.
diff --git a/hr_timesheet_analytic_tag/tests/test_hr_timesheet_analytic_tag.py b/hr_timesheet_analytic_tag/tests/test_hr_timesheet_analytic_tag.py
index b82eb5707f..433aae98dc 100644
--- a/hr_timesheet_analytic_tag/tests/test_hr_timesheet_analytic_tag.py
+++ b/hr_timesheet_analytic_tag/tests/test_hr_timesheet_analytic_tag.py
@@ -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)
diff --git a/hr_timesheet_analytic_tag/views/project_task_view.xml b/hr_timesheet_analytic_tag/views/project_task_view.xml
index fba574686f..dc29172a5b 100644
--- a/hr_timesheet_analytic_tag/views/project_task_view.xml
+++ b/hr_timesheet_analytic_tag/views/project_task_view.xml
@@ -5,7 +5,7 @@
project.task
-
+