mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
[FIX] account_payment_order: allow multiple payment lines without move line
This commit is contained in:
@@ -224,7 +224,9 @@ class AccountPaymentOrder(models.Model):
|
||||
@api.constrains("payment_line_ids")
|
||||
def _check_payment_lines(self):
|
||||
for order in self:
|
||||
move_line_ids = [x.move_line_id.id for x in order.payment_line_ids]
|
||||
move_line_ids = [
|
||||
x.move_line_id.id for x in order.payment_line_ids if x.move_line_id
|
||||
]
|
||||
if len(move_line_ids) != len(set(move_line_ids)):
|
||||
raise ValidationError(
|
||||
_(
|
||||
|
||||
@@ -7,6 +7,7 @@ from datetime import date, datetime, timedelta
|
||||
|
||||
from odoo import fields
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.fields import Command
|
||||
from odoo.tests import Form, tagged
|
||||
|
||||
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
|
||||
@@ -479,6 +480,33 @@ class TestPaymentOrderOutbound(TestPaymentOrderOutboundBase):
|
||||
|
||||
self.assertEqual("F/1234 FR/1234", payment_order.payment_line_ids.communication)
|
||||
|
||||
def test_multiple_lines_without_move_line(self):
|
||||
"""Test that a payment order with multiple lines without related
|
||||
journal items can be created"""
|
||||
self.env["account.payment.order"].create(
|
||||
{
|
||||
"date_prefered": "due",
|
||||
"payment_type": "outbound",
|
||||
"payment_mode_id": self.mode.id,
|
||||
"journal_id": self.bank_journal.id,
|
||||
"description": "order with manual line",
|
||||
"payment_line_ids": [
|
||||
Command.create(
|
||||
{
|
||||
"partner_id": self.partner.id,
|
||||
"amount_currency": 101.00,
|
||||
}
|
||||
),
|
||||
Command.create(
|
||||
{
|
||||
"partner_id": self.partner.id,
|
||||
"amount_currency": 101.00,
|
||||
}
|
||||
),
|
||||
],
|
||||
}
|
||||
)
|
||||
|
||||
def test_supplier_manual_refund(self):
|
||||
"""
|
||||
Confirm the supplier invoice with reference
|
||||
|
||||
Reference in New Issue
Block a user