mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[FIX] account_payment_order: Don't fail due to tz
When the test hour is around midnight, and demo data using CET/CEST timezones, current code fails due to some asserts not having this into consideration. This fix avoids such problem, and irons the execution no matter the hour.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
|
||||
{
|
||||
"name": "Account Payment Order",
|
||||
"version": "14.0.1.8.0",
|
||||
"version": "14.0.1.8.1",
|
||||
"license": "AGPL-3",
|
||||
"author": "ACSONE SA/NV, "
|
||||
"Therp BV, "
|
||||
|
||||
@@ -158,7 +158,9 @@ class TestPaymentOrderOutbound(TestPaymentOrderOutboundBase):
|
||||
line_create = (
|
||||
self.env["account.payment.line.create"]
|
||||
.with_context(active_model="account.payment.order", active_id=order.id)
|
||||
.create({"date_type": "move", "move_date": datetime.now()})
|
||||
.create(
|
||||
{"date_type": "move", "move_date": datetime.now() + timedelta(days=1)}
|
||||
)
|
||||
)
|
||||
line_create.payment_mode = "any"
|
||||
line_create.move_line_filters_change()
|
||||
@@ -167,7 +169,9 @@ class TestPaymentOrderOutbound(TestPaymentOrderOutboundBase):
|
||||
line_created_due = (
|
||||
self.env["account.payment.line.create"]
|
||||
.with_context(active_model="account.payment.order", active_id=order.id)
|
||||
.create({"date_type": "due", "due_date": datetime.now()})
|
||||
.create(
|
||||
{"date_type": "due", "due_date": datetime.now() + timedelta(days=1)}
|
||||
)
|
||||
)
|
||||
line_created_due.populate()
|
||||
line_created_due.create_payment_lines()
|
||||
@@ -226,7 +230,7 @@ class TestPaymentOrderOutbound(TestPaymentOrderOutboundBase):
|
||||
}
|
||||
)
|
||||
with self.assertRaises(ValidationError):
|
||||
outbound_order.date_scheduled = date.today() - timedelta(days=1)
|
||||
outbound_order.date_scheduled = date.today() - timedelta(days=2)
|
||||
|
||||
def test_manual_line_and_manual_date(self):
|
||||
# Create payment order
|
||||
@@ -273,9 +277,13 @@ class TestPaymentOrderOutbound(TestPaymentOrderOutboundBase):
|
||||
outbound_order.payment_line_ids[0].date,
|
||||
outbound_order.payment_line_ids[0].bank_line_id.date,
|
||||
)
|
||||
self.assertEqual(outbound_order.payment_line_ids[1].date, date.today())
|
||||
self.assertEqual(
|
||||
outbound_order.payment_line_ids[1].bank_line_id.date, date.today()
|
||||
outbound_order.payment_line_ids[1].date,
|
||||
fields.Date.context_today(outbound_order),
|
||||
)
|
||||
self.assertEqual(
|
||||
outbound_order.payment_line_ids[1].bank_line_id.date,
|
||||
fields.Date.context_today(outbound_order),
|
||||
)
|
||||
|
||||
def test_supplier_refund(self):
|
||||
|
||||
Reference in New Issue
Block a user