Skip to content

Commit

Permalink
Port tests to v16
Browse files Browse the repository at this point in the history
  • Loading branch information
eLBati committed Apr 3, 2024
1 parent 2f69aeb commit b7a2fa7
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions l10n_it_withholding_tax/tests/test_withholding_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,33 +325,33 @@ def test_wt_after_repost(self):
self.assertEqual(self.invoice.state, "posted")

def _create_bill(self):
bill_model = self.env["account.invoice"].with_context(type="in_invoice")
bill_model = self.env["account.move"].with_context(default_move_type="in_invoice")
bill_form = Form(bill_model)
bill_form.name = "Test Supplier Invoice WT"
bill_form.partner_id = self.env.ref("base.res_partner_12")
bill_form.invoice_date = time.strftime("%Y") + "-07-15"
with bill_form.invoice_line_ids.new() as line:
line.name = "Advice"
line.price_unit = 1000
line.invoice_line_tax_wt_ids.clear()
line.invoice_line_tax_wt_ids.add(self.wt1040)
bill = bill_form.save()
bill.action_invoice_open()
bill.action_post()
return bill

def _get_refund(self, bill):
refund_wizard_model = self.env["account.invoice.refund"].with_context(
refund_wizard_model = self.env["account.move.reversal"].with_context(
active_id=bill.id,
active_ids=bill.ids,
active_model=bill._name,
)
refund_wizard_form = Form(refund_wizard_model)
refund_wizard_form.filter_refund = "cancel"
refund_wizard_form.refund_method = "cancel"
refund_wizard = refund_wizard_form.save()
refund_result = refund_wizard.invoice_refund()
refund_result = refund_wizard.reverse_moves()

refund_model = refund_result.get("res_model")
refund_domain = refund_result.get("domain")
refund = self.env[refund_model].search(refund_domain, limit=1)
refund_id = refund_result.get("res_id")
refund = self.env[refund_model].browse(refund_id)
return refund

def test_refund_wt_propagation(self):
Expand Down Expand Up @@ -383,8 +383,8 @@ def test_refund_reconciliation_amount(self):
# Assert: The reconciliation is for the whole bill
reconciliation = self.env["account.partial.reconcile"].search(
[
("debit_move_id", "in", refund.move_id.line_ids.ids),
("credit_move_id", "in", bill.move_id.line_ids.ids),
("debit_move_id", "in", refund.line_ids.ids),
("credit_move_id", "in", bill.line_ids.ids),
]
)
self.assertEqual(reconciliation.amount, bill_amount)
Expand All @@ -403,8 +403,8 @@ def test_refund_wt_moves(self):
# Assert: There are no Withholding Tax Moves
reconciliation = self.env["account.partial.reconcile"].search(
[
("debit_move_id", "in", refund.move_id.line_ids.ids),
("credit_move_id", "in", bill.move_id.line_ids.ids),
("debit_move_id", "in", refund.line_ids.ids),
("credit_move_id", "in", bill.line_ids.ids),
]
)
withholding_tax_moves = self.env["withholding.tax.move"].search(
Expand Down

0 comments on commit b7a2fa7

Please sign in to comment.