Skip to content

Commit

Permalink
[MIG] hr_timesheet_analytic_tag: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
BernatObrador committed Oct 17, 2024
1 parent fd61982 commit ec5b979
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 8 deletions.
4 changes: 4 additions & 0 deletions hr_timesheet_analytic_tag/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ Contributors
- Víctor Martínez
- Pedro M. Baeza

- APSL - Nagarro <https://apsl.tech>

- Bernat Obrador

Maintainers
-----------

Expand Down
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": "16.0.1.0.0",
"version": "17.0.1.0.0",
"category": "Accounting & Finance",
"website": "https://github.com/OCA/account-analytic",
"author": "Tecnativa, Odoo Community Association (OCA)",
Expand Down
11 changes: 6 additions & 5 deletions hr_timesheet_analytic_tag/models/account_analytic_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
class AccountAnalyticLine(models.Model):
_inherit = "account.analytic.line"

def _timesheet_preprocess(self, vals):
res = super()._timesheet_preprocess(vals)
if vals.get("task_id") and not vals.get("tag_ids"):
task = self.env["project.task"].browse(vals.get("task_id"))
vals.update(tag_ids=[Command.set(task.analytic_tag_ids.ids)])
def _timesheet_preprocess(self, vals_list):
res = super()._timesheet_preprocess(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
2 changes: 2 additions & 0 deletions hr_timesheet_analytic_tag/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- [Tecnativa](https://www.tecnativa.com):
- Víctor Martínez
- Pedro M. Baeza
- APSL - Nagarro \<<https://apsl.tech>\>
- Bernat Obrador
4 changes: 4 additions & 0 deletions hr_timesheet_analytic_tag/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,10 @@ <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>
</ul>
</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def setUpClass(cls):
cls.user = new_test_user(
cls.env,
login="test-user",
groups="hr_timesheet.group_hr_timesheet_user",
groups="hr_timesheet.group_hr_timesheet_user,account_analytic_tag.group_analytic_tags,account.group_account_manager",
)
cls.employee = cls.env["hr.employee"].create(
{
Expand All @@ -31,7 +31,6 @@ def setUpClass(cls):
cls.plan = cls.env["account.analytic.plan"].create(
{
"name": "Projects Plan",
"company_id": False,
}
)
cls.analytic_account_1 = cls.env["account.analytic.account"].create(
Expand Down

0 comments on commit ec5b979

Please sign in to comment.