Skip to content

Commit

Permalink
[MIG] maintenance_timesheet_time_control: Migration to 16.0
Browse files Browse the repository at this point in the history
TT48099
  • Loading branch information
victoralmau authored and FernandoRomera committed Aug 21, 2024
1 parent a47b7af commit e094182
Show file tree
Hide file tree
Showing 7 changed files with 78 additions and 66 deletions.
17 changes: 11 additions & 6 deletions maintenance_timesheet_time_control/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Maintenance Timesheets Time Control
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f87f5fb20528f45f783949d8c35ae4bf7da709b0eb88e4a84af270582ddf93e2
!! source digest: sha256:999ce7cd27b56d7796c9594d15f4413473560b6e533bdd0fdcb842b877b2370d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
Expand All @@ -17,13 +17,13 @@ Maintenance Timesheets Time Control
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmaintenance-lightgray.png?logo=github
:target: https://github.com/OCA/maintenance/tree/15.0/maintenance_timesheet_time_control
:target: https://github.com/OCA/maintenance/tree/16.0/maintenance_timesheet_time_control
:alt: OCA/maintenance
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/maintenance-15-0/maintenance-15-0-maintenance_timesheet_time_control
:target: https://translation.odoo-community.org/projects/maintenance-16-0/maintenance-16-0-maintenance_timesheet_time_control
: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/maintenance&target_branch=15.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/maintenance&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand All @@ -49,6 +49,11 @@ This module depends on modules found in these repositories:
* `OCA/web <https://github.com/OCA/web>`__
* `OCA/project <https://github.com/OCA/project>`__

Configuration
=============

Maintenance request must have a project defined for seeing the start/stop buttons.

Usage
=====

Expand All @@ -75,7 +80,7 @@ Bug Tracker
Bugs are tracked on `GitHub Issues <https://github.com/OCA/maintenance/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/maintenance/issues/new?body=module:%20maintenance_timesheet_time_control%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/maintenance/issues/new?body=module:%20maintenance_timesheet_time_control%0Aversion:%2016.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 Down Expand Up @@ -116,6 +121,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-victoralmau|

This module is part of the `OCA/maintenance <https://github.com/OCA/maintenance/tree/15.0/maintenance_timesheet_time_control>`_ project on GitHub.
This module is part of the `OCA/maintenance <https://github.com/OCA/maintenance/tree/16.0/maintenance_timesheet_time_control>`_ 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 maintenance_timesheet_time_control/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"name": "Maintenance Timesheets Time Control",
"summary": "Maintenance Timesheets Timesheet Time Control",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"category": "Hidden",
"author": "Tecnativa,Odoo Community Association (OCA)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ def _relation_with_timesheet_line(self):
)
def _compute_show_time_control(self):
result = super()._compute_show_time_control()
self.filtered(lambda x: not x.project_id.allow_timesheets).update(
{"show_time_control": False}
)
for item in self.filtered(lambda x: not x.project_id.allow_timesheets):
item.show_time_control = False
return result

def button_start_work(self):
Expand Down
1 change: 1 addition & 0 deletions maintenance_timesheet_time_control/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Maintenance request must have a project defined for seeing the start/stop buttons.
37 changes: 21 additions & 16 deletions maintenance_timesheet_time_control/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,22 +367,23 @@ <h1 class="title">Maintenance Timesheets Time Control</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:f87f5fb20528f45f783949d8c35ae4bf7da709b0eb88e4a84af270582ddf93e2
!! source digest: sha256:999ce7cd27b56d7796c9594d15f4413473560b6e533bdd0fdcb842b877b2370d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/maintenance/tree/15.0/maintenance_timesheet_time_control"><img alt="OCA/maintenance" src="https://img.shields.io/badge/github-OCA%2Fmaintenance-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/maintenance-15-0/maintenance-15-0-maintenance_timesheet_time_control"><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/maintenance&amp;target_branch=15.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/maintenance/tree/16.0/maintenance_timesheet_time_control"><img alt="OCA/maintenance" src="https://img.shields.io/badge/github-OCA%2Fmaintenance-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/maintenance-16-0/maintenance-16-0-maintenance_timesheet_time_control"><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/maintenance&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>It allows to track the exact moment when a timesheet line is started (not only
the day, but also the minute and second) and let users start and stop timers
easily.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#installation" id="toc-entry-1">Installation</a></li>
<li><a class="reference internal" href="#usage" id="toc-entry-2">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-3">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-4">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-5">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-6">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-7">Maintainers</a></li>
<li><a class="reference internal" href="#configuration" id="toc-entry-2">Configuration</a></li>
<li><a class="reference internal" href="#usage" id="toc-entry-3">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="toc-entry-4">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="toc-entry-5">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="toc-entry-6">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="toc-entry-7">Contributors</a></li>
<li><a class="reference internal" href="#maintainers" id="toc-entry-8">Maintainers</a></li>
</ul>
</li>
</ul>
Expand All @@ -398,8 +399,12 @@ <h1><a class="toc-backref" href="#toc-entry-1">Installation</a></h1>
<li><a class="reference external" href="https://github.com/OCA/project">OCA/project</a></li>
</ul>
</div>
<div class="section" id="configuration">
<h1><a class="toc-backref" href="#toc-entry-2">Configuration</a></h1>
<p>Maintenance request must have a project defined for seeing the start/stop buttons.</p>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
<h1><a class="toc-backref" href="#toc-entry-3">Usage</a></h1>
<p>In general the usage instructions from <tt class="docutils literal">project_timesheet_time_control</tt> apply with the following additions.</p>
<p>Via maintenance requests:</p>
<ol class="arabic simple">
Expand All @@ -417,23 +422,23 @@ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
to another user.</p>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-3">Bug Tracker</a></h1>
<h1><a class="toc-backref" href="#toc-entry-4">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/maintenance/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/maintenance/issues/new?body=module:%20maintenance_timesheet_time_control%0Aversion:%2015.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/maintenance/issues/new?body=module:%20maintenance_timesheet_time_control%0Aversion:%2016.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">
<h1><a class="toc-backref" href="#toc-entry-4">Credits</a></h1>
<h1><a class="toc-backref" href="#toc-entry-5">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#toc-entry-5">Authors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-6">Authors</a></h2>
<ul class="simple">
<li>Tecnativa</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-7">Contributors</a></h2>
<ul class="simple">
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Víctor Martínez</li>
Expand All @@ -443,15 +448,15 @@ <h2><a class="toc-backref" href="#toc-entry-6">Contributors</a></h2>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<h2><a class="toc-backref" href="#toc-entry-8">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 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/maintenance/tree/15.0/maintenance_timesheet_time_control">OCA/maintenance</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/maintenance/tree/16.0/maintenance_timesheet_time_control">OCA/maintenance</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
@@ -1,44 +1,38 @@
# Copyright 2022-2023 Tecnativa - Víctor Martínez
# Copyright 2022-2024 Tecnativa - Víctor Martínez
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0

from datetime import datetime, timedelta

from odoo import exceptions
from odoo.tests import common, new_test_user, users
from odoo.tests import new_test_user, users

from odoo.addons.base.tests.common import BaseCommon

class TestMaintenanceTimesheetTimeControl(common.TransactionCase):

class TestMaintenanceTimesheetTimeControl(BaseCommon):
@classmethod
def setUpClass(cls):
super().setUpClass()
ctx = {
"mail_create_nolog": True,
"mail_create_nosubscribe": True,
"mail_notrack": True,
"no_reset_password": True,
}
maintenance_group = "maintenance.group_equipment_manager"
timesheet_group = "hr_timesheet.group_hr_timesheet_user"
cls.user = new_test_user(
cls.env,
login="test-maintenance-user",
groups="%s,%s" % (maintenance_group, timesheet_group),
context=ctx,
)
cls.employee = cls.env["hr.employee"].create(
{"name": "Test employee", "user_id": cls.user.id}
groups="maintenance.group_equipment_manager,"
"hr_timesheet.group_hr_timesheet_user",
)
cls.user.action_create_employee()
cls.project = cls.env["project.project"].create(
{"name": "Test project", "allow_timesheets": True}
)
cls.category = cls.env["maintenance.equipment.category"].create(
{"name": "Test category"}
)
cls.team = cls.env["maintenance.team"].create({"name": "Test team"})
cls.equipment = cls.env["maintenance.equipment"].create(
{
"name": "Test computer",
"category_id": cls.env.ref("maintenance.equipment_computer").id,
"category_id": cls.category.id,
"project_id": cls.project.id,
"maintenance_team_id": cls.env.ref(
"maintenance.equipment_team_maintenance"
).id,
"maintenance_team_id": cls.team.id,
}
)

Expand Down
Loading

0 comments on commit e094182

Please sign in to comment.