Skip to content

Commit

Permalink
[IMP] sale_payment_sheet: add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
angelmoya committed Jun 6, 2023
1 parent 6fb6989 commit f749eb3
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion sale_payment_sheet/tests/test_sale_payment_sheet.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ def setUpClass(cls):
)
cls.invoice1 = cls._create_invoice(cls)
cls.invoice2 = cls._create_invoice(cls)
(cls.invoice1 + cls.invoice2).action_post()
cls.refund1 = cls._create_refund(cls)
(cls.invoice1 + cls.invoice2 + cls.refund1).action_post()

def _create_invoice(self):
with Form(
Expand All @@ -60,6 +61,18 @@ def _create_invoice(self):
line_form.price_unit = 100.00
return invoice_form.save()

def _create_refund(self):
with Form(
self.env["account.move"].with_context(default_move_type="out_refund")
) as invoice_form:
invoice_form.partner_id = self.partner
with invoice_form.invoice_line_ids.new() as line_form:
line_form.name = "invoice test"
line_form.account_id = self.account_invoice
line_form.quantity = 1.0
line_form.price_unit = 100.00
return invoice_form.save()

def test_payment_wizard(self):
PaymentWiz = self.env["sale.invoice.payment.wiz"].with_context(
active_model="account.move",
Expand Down Expand Up @@ -146,6 +159,8 @@ def test_payment_sheet_reopen(self):
self.assertFalse(sheet.statement_id)

def test_payment_sheet_unlink(self):
sheet = self._create_payment_sheet()
sheet.unlink()
sheet = self._create_payment_sheet()
sheet.button_confirm_sheet()
with self.assertRaises(UserError):
Expand Down

0 comments on commit f749eb3

Please sign in to comment.