Merge PR #1343 into 16.0

Signed-off-by pedrobaeza
This commit is contained in:
OCA-git-bot
2024-09-02 15:30:03 +00:00
2 changed files with 16 additions and 0 deletions

View File

@@ -149,6 +149,8 @@ class AccountPaymentOrder(models.Model):
),
"currency_id": payment.currency_id.id,
"amount_currency": payment.amount * sign,
# Same logic as the individual payments
"date_maturity": payment.payment_line_ids[0].date,
}
return vals
@@ -181,6 +183,8 @@ class AccountPaymentOrder(models.Model):
),
"currency_id": payments[0].currency_id.id,
"amount_currency": amount_payment_currency * sign,
# All the lines should have the same date following _prepare_trf_moves
"date_maturity": payments.payment_line_ids[:1].date,
}
return vals

View File

@@ -1,6 +1,9 @@
# Copyright 2022 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from freezegun import freeze_time
from odoo import fields
from odoo.tests.common import tagged
from odoo.addons.account_payment_order.tests.test_payment_order_inbound import (
@@ -10,9 +13,12 @@ from odoo.addons.account_payment_order.tests.test_payment_order_inbound import (
@tagged("post_install", "-at_install")
class TestPaymentOrderInbound(TestPaymentOrderInboundBase):
@freeze_time("2024-04-01")
def test_grouped_output(self):
self.inbound_mode.generate_move = True
self.inbound_mode.post_move = True
self.inbound_order.date_prefered = "fixed"
self.inbound_order.date_scheduled = "2024-08-01"
self.inbound_order.draft2open()
self.inbound_order.open2generated()
self.inbound_order.generated2uploaded()
@@ -35,3 +41,9 @@ class TestPaymentOrderInbound(TestPaymentOrderInboundBase):
grouped_moves = self.inbound_order.grouped_move_ids
self.assertTrue(grouped_moves)
self.assertTrue(grouped_moves.line_ids[0].reconciled)
self.assertTrue(
all(
x.date_maturity == fields.Date.from_string("2024-08-01")
for x in grouped_moves.line_ids
)
)