Skip to content

Commit

Permalink
[UPD] project_forecast_line_deadlin: unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsirintanis committed Feb 15, 2024
1 parent dbf7074 commit 3bce03a
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 2 deletions.
10 changes: 9 additions & 1 deletion project_forecast_line_deadline/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Project Forecast Line Deadline
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ea788cff0014c732b888e45d5f6507e5e56734ac294dd1f66a17869302d9a906
!! source digest: sha256:4c04f49f08ce276ca174ba379146c7cc26f2311e6c1f40b10d42313865eb2fb4
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png
Expand Down Expand Up @@ -76,6 +76,14 @@ 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.

.. |maintainer-ntsirintanis| image:: https://github.com/ntsirintanis.png?size=40px
:target: https://github.com/ntsirintanis
:alt: ntsirintanis

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-ntsirintanis|

This module is part of the `OCA/project <https://github.com/OCA/project/tree/14.0/project_forecast_line_deadline>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 3 additions & 1 deletion project_forecast_line_deadline/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Project Forecast Line Deadline</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:ea788cff0014c732b888e45d5f6507e5e56734ac294dd1f66a17869302d9a906
!! source digest: sha256:4c04f49f08ce276ca174ba379146c7cc26f2311e6c1f40b10d42313865eb2fb4
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Alpha" src="https://img.shields.io/badge/maturity-Alpha-red.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/project/tree/14.0/project_forecast_line_deadline"><img alt="OCA/project" src="https://img.shields.io/badge/github-OCA%2Fproject-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/project-14-0/project-14-0-project_forecast_line_deadline"><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/project&amp;target_branch=14.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module sets end date for forecast based on the deadline of connected task(s)</p>
Expand Down Expand Up @@ -418,6 +418,8 @@ <h2><a class="toc-backref" href="#toc-entry-5">Maintainers</a></h2>
<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/ntsirintanis"><img alt="ntsirintanis" src="https://github.com/ntsirintanis.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/project/tree/14.0/project_forecast_line_deadline">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>
Expand Down
1 change: 1 addition & 0 deletions project_forecast_line_deadline/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_forecast_line_deadline
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Copyright 2024 Therp BV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

import odoo.tests.common as common


class TestForecastLineDeadline(common.TransactionCase):
def setUp(self):
super().setUp()
self.project_task = self.env.ref("project.project_task_1")

def test_forecast_end_deadline(self):
"""Test forecast_date_planned_end vs date_deadline"""
task = self.project_task
# See that relevant date fields are falsy
self.assertFalse(task.forecast_date_planned_end)
self.assertFalse(task.date_deadline)
# Set deadline for task
task.date_deadline = "2022-01-01"
# Date fields are equal
self.assertEqual(task.forecast_date_planned_end, task.date_deadline)
# Set forecast_date_deadline manually
task.forecast_date_planned_end = "2022-02-01"
# Dates are not the same anymore
self.assertNotEqual(task.forecast_date_planned_end, task.date_deadline)
# Reset both date fields to False
task.date_deadline = False
self.assertFalse(task.forecast_date_planned_end)

0 comments on commit 3bce03a

Please sign in to comment.