Skip to content

Commit

Permalink
[IMP] sale_automatic_workflow: Use of freeze time to test dates
Browse files Browse the repository at this point in the history
If test is run at a certain date nearly midnight, the test that
evaluates invoice date from sale one was failing. So, freeze the date
at mid of day.
  • Loading branch information
rousseldenis committed Aug 23, 2024
1 parent 8a48464 commit 002fcd2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sale_automatic_workflow/tests/test_automatic_workflow.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Copyright 2014 Camptocamp SA (author: Guewen Baconnier)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

import logging
from datetime import timedelta
from unittest import mock

from freezegun import freeze_time

from odoo import fields
from odoo.tests import tagged
from odoo.tools.safe_eval import safe_eval
Expand Down Expand Up @@ -56,6 +57,7 @@ def test_onchange(self):
sale._onchange_workflow_process_id()
self.assertEqual(sale.picking_policy, "direct")

@freeze_time("2024-08-11 12:00:00")
def test_date_invoice_from_sale_order(self):
workflow = self.create_full_automatic()
# date_order on sale.order is date + time
Expand Down

0 comments on commit 002fcd2

Please sign in to comment.