mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
Update test suite
Fix bug in account_banking_mandate when a res.partner.bank is not attached to a particular company (company_id is NOT required on res.partner.bank)
This commit is contained in:
committed by
Marçal Isern
parent
fd1ec5ab85
commit
48db1b15ae
@@ -1,7 +1,6 @@
|
||||
# © 2017 Creu Blanca
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
@@ -48,37 +47,6 @@ class TestPaymentMode(TransactionCase):
|
||||
}
|
||||
)
|
||||
|
||||
def test_constrains(self):
|
||||
with self.assertRaises(ValidationError):
|
||||
self.payment_mode_c1.write(
|
||||
{"generate_move": True, "offsetting_account": False}
|
||||
)
|
||||
with self.assertRaises(ValidationError):
|
||||
self.payment_mode_c1.write(
|
||||
{
|
||||
"generate_move": True,
|
||||
"offsetting_account": "bank_account",
|
||||
"move_option": False,
|
||||
}
|
||||
)
|
||||
with self.assertRaises(ValidationError):
|
||||
self.payment_mode_c1.write(
|
||||
{
|
||||
"generate_move": True,
|
||||
"offsetting_account": "transfer_account",
|
||||
"transfer_account_id": False,
|
||||
}
|
||||
)
|
||||
with self.assertRaises(ValidationError):
|
||||
self.payment_mode_c1.write(
|
||||
{
|
||||
"generate_move": True,
|
||||
"offsetting_account": "transfer_account",
|
||||
"transfer_account_id": self.account.id,
|
||||
"transfer_journal_id": False,
|
||||
}
|
||||
)
|
||||
|
||||
def test_onchange_generate_move(self):
|
||||
self.payment_mode_c1.generate_move = True
|
||||
self.payment_mode_c1.generate_move_change()
|
||||
@@ -87,11 +55,6 @@ class TestPaymentMode(TransactionCase):
|
||||
self.payment_mode_c1.generate_move_change()
|
||||
self.assertFalse(self.payment_mode_c1.move_option)
|
||||
|
||||
def test_onchange_offsetting_account(self):
|
||||
self.payment_mode_c1.offsetting_account = "bank_account"
|
||||
self.payment_mode_c1.offsetting_account_change()
|
||||
self.assertFalse(self.payment_mode_c1.transfer_account_id)
|
||||
|
||||
def test_onchange_payment_type(self):
|
||||
self.payment_mode_c1.payment_method_id = self.manual_in
|
||||
self.payment_mode_c1.payment_method_id_change()
|
||||
|
||||
@@ -115,7 +115,7 @@ class TestPaymentOrderInbound(TestPaymentOrderInboundBase):
|
||||
|
||||
with self.assertRaises(UserError):
|
||||
bank_line.unlink()
|
||||
payment_order.action_done_cancel()
|
||||
payment_order.action_uploaded_cancel()
|
||||
self.assertEqual(payment_order.state, "cancel")
|
||||
payment_order.cancel2draft()
|
||||
payment_order.unlink()
|
||||
|
||||
@@ -48,8 +48,8 @@ class TestPaymentOrderOutbound(AccountTestInvoicingCommon):
|
||||
).id,
|
||||
}
|
||||
)
|
||||
cls.invoice = cls._create_supplier_invoice(cls)
|
||||
cls.invoice_02 = cls._create_supplier_invoice(cls)
|
||||
cls.invoice = cls._create_supplier_invoice(cls, "F1242")
|
||||
cls.invoice_02 = cls._create_supplier_invoice(cls, "F1243")
|
||||
cls.bank_journal = cls.company_data["default_journal_bank"]
|
||||
# Make sure no other payment orders are in the DB
|
||||
cls.domain = [
|
||||
@@ -59,11 +59,12 @@ class TestPaymentOrderOutbound(AccountTestInvoicingCommon):
|
||||
]
|
||||
cls.env["account.payment.order"].search(cls.domain).unlink()
|
||||
|
||||
def _create_supplier_invoice(self):
|
||||
def _create_supplier_invoice(self, ref):
|
||||
invoice = self.env["account.move"].create(
|
||||
{
|
||||
"partner_id": self.partner.id,
|
||||
"move_type": "in_invoice",
|
||||
"ref": ref,
|
||||
"payment_mode_id": self.mode.id,
|
||||
"invoice_date": fields.Date.today(),
|
||||
"invoice_line_ids": [
|
||||
@@ -157,8 +158,7 @@ class TestPaymentOrderOutbound(AccountTestInvoicingCommon):
|
||||
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")
|
||||
self.assertEqual(order.state, "uploaded")
|
||||
|
||||
def test_cancel_payment_order(self):
|
||||
# Open invoice
|
||||
@@ -193,7 +193,7 @@ class TestPaymentOrderOutbound(AccountTestInvoicingCommon):
|
||||
|
||||
with self.assertRaises(UserError):
|
||||
bank_line.unlink()
|
||||
payment_order.action_done_cancel()
|
||||
payment_order.action_uploaded_cancel()
|
||||
self.assertEqual(payment_order.state, "cancel")
|
||||
payment_order.cancel2draft()
|
||||
payment_order.unlink()
|
||||
|
||||
Reference in New Issue
Block a user