[FIX] mrp: test_oee works during the weekend

It happens due to workcenter working hours,
the workcenter is not active during the weekend thus
the productivity loss are not counted in the oee.

This commit removes 2 days to the test date if it is
during the weekend.
This commit is contained in:
Arnold Moyaux
2018-02-05 11:48:56 +01:00
parent 13c885195d
commit dad3b4a663
+5 -2
View File
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import datetime
from datetime import datetime, timedelta
from odoo.addons.mrp.tests.common import TestMrpCommon
@@ -18,7 +18,10 @@ class TestOee(TestMrpCommon):
def test_wrokcenter_oee(self):
""" Test case workcenter oee. """
day = datetime.date.today()
day = datetime.date(datetime.today())
# Make the test work the weekend. It will fails due to workcenter working hours.
if day.weekday() in (5, 6):
day -= timedelta(days=2)
# Productive time duration (13 min)
self.create_productivity_line(self.env.ref('mrp.block_reason7'), str(day) + " " + "10:43:22", str(day) + " " + "10:56:22")