Skip to content

Commit

Permalink
[IMP] account_payment_mode: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
astirpe committed Nov 21, 2023
1 parent 129f42d commit 7b07dcf
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions account_payment_order/tests/test_payment_order_outbound.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ def setUpClass(cls, chart_template_ref=None):
("company_id", "=", cls.env.user.company_id.id),
]
cls.env["account.payment.order"].search(cls.domain).unlink()
cls.partner_bank = cls.env["res.partner.bank"].create(
{
"acc_number": "1234",
"partner_id": cls.partner.id,
"allow_out_payment": True,
}
)

def _create_supplier_invoice(self, ref):
invoice = self.env["account.move"].create(
Expand Down Expand Up @@ -451,3 +458,19 @@ def test_supplier_manual_refund(self):
self.assertEqual(len(payment_order.payment_line_ids), 1)

self.assertEqual("F1242 R1234", payment_order.payment_line_ids.communication)

def test_check_allow_out_payment(self):
"""Check that, in case option "Send Money" is not enabled on
the bank, out payments are not allowed.
"""
# Open invoice
self.invoice.action_post()

# Do not allow out payments
self.partner_bank.allow_out_payment = False

# Add to payment order using the wizard: error raised
with self.assertRaises(UserError):
self.env["account.invoice.payment.line.multi"].with_context(
active_model="account.move", active_ids=self.invoice.ids
).create({}).run()

0 comments on commit 7b07dcf

Please sign in to comment.