Skip to content

Commit

Permalink
[FIX] account_invoice_constraint_chronology - fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
luc-demeyer committed Dec 21, 2024
1 parent ed2f94a commit 2ef3985
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright 2021 CorporateHub (https://corporatehub.eu)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from datetime import timedelta
from datetime import date, timedelta

from odoo import fields
from odoo.exceptions import UserError
Expand Down Expand Up @@ -170,11 +170,19 @@ def test_modify_invoice_date_validated_past_invoice(self):
# it should be able to validate, but if we change the date
# higher than YYYYYMM15 or lower than YYYYYMM05
# it should not be able to validate.
after_5_days = self.today + timedelta(days=5)
after_10_days = self.today + timedelta(days=10)
after_15_days = self.today + timedelta(days=15)
after_20_days = self.today + timedelta(days=20)
after_25_days = self.today + timedelta(days=25)

# in order to avoid a raise caused by the sequence mixin we must ensure
# that all dates are in the same year, hence we set the invoice_1 date
# in the middle of the year
mid_year_date = date(self.today.year, 7, 1)
self.invoice_1.date = mid_year_date
self.invoice_1.invoice_date = mid_year_date

after_5_days = mid_year_date + timedelta(days=5)
after_10_days = mid_year_date + timedelta(days=10)
after_15_days = mid_year_date + timedelta(days=15)
after_20_days = mid_year_date + timedelta(days=20)
after_25_days = mid_year_date + timedelta(days=25)

self.invoice_1.action_post()

Expand Down

0 comments on commit 2ef3985

Please sign in to comment.