mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[13.0][IMP] account_payment_order - move date should be bank line date when offsetting_account is bank_account
This commit is contained in:
committed by
Pedro M. Baeza
parent
35fb316970
commit
3c11cf2aab
@@ -8,7 +8,7 @@
|
||||
|
||||
{
|
||||
"name": "Account Payment Order",
|
||||
"version": "14.0.1.0.4",
|
||||
"version": "14.0.1.0.5",
|
||||
"license": "AGPL-3",
|
||||
"author": "ACSONE SA/NV, "
|
||||
"Therp BV, "
|
||||
|
||||
@@ -420,6 +420,7 @@ class AccountPaymentOrder(models.Model):
|
||||
return True
|
||||
|
||||
def _prepare_move(self, bank_lines=None):
|
||||
move_date = False
|
||||
if self.payment_type == "outbound":
|
||||
ref = _("Payment order %s") % self.name
|
||||
else:
|
||||
@@ -428,6 +429,8 @@ class AccountPaymentOrder(models.Model):
|
||||
ref += " - " + bank_lines.name
|
||||
if self.payment_mode_id.offsetting_account == "bank_account":
|
||||
journal_id = self.journal_id.id
|
||||
if bank_lines:
|
||||
move_date = bank_lines[0].date
|
||||
elif self.payment_mode_id.offsetting_account == "transfer_account":
|
||||
journal_id = self.payment_mode_id.transfer_journal_id.id
|
||||
vals = {
|
||||
@@ -436,6 +439,8 @@ class AccountPaymentOrder(models.Model):
|
||||
"payment_order_id": self.id,
|
||||
"line_ids": [],
|
||||
}
|
||||
if move_date:
|
||||
vals.update({"date": move_date})
|
||||
total_company_currency = total_payment_currency = 0
|
||||
for bline in bank_lines:
|
||||
total_company_currency += bline.amount_company_currency
|
||||
|
||||
@@ -140,6 +140,7 @@ class TestPaymentOrderOutbound(TransactionCase):
|
||||
order.draft2open()
|
||||
order.open2generated()
|
||||
order.generated2uploaded()
|
||||
self.assertEqual(order.move_ids[0].date, order.bank_line_ids[0].date)
|
||||
order.action_done()
|
||||
self.assertEqual(order.state, "done")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user