From dad3b4a663dc73abebc12def5e9c3fab2901fe17 Mon Sep 17 00:00:00 2001 From: Arnold Moyaux Date: Mon, 5 Feb 2018 11:38:50 +0100 Subject: [PATCH] [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. --- addons/mrp/tests/test_oee.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/mrp/tests/test_oee.py b/addons/mrp/tests/test_oee.py index 80a4dcc8cd6..4fbed9b6d5f 100644 --- a/addons/mrp/tests/test_oee.py +++ b/addons/mrp/tests/test_oee.py @@ -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")