def METHOD_NAME(self):
    reverse_vals = self.reverse_vals
    invoice = self.invoice
    self.assertEqual(
        invoice.state,
        "draft",
        "Invoice should be in state Draft",
    )
    invoice.action_post()
    self.assertEqual(
        invoice.state,
        "posted",
        "Invoice should be in state Posted",
    )
    move_reversal = (
        self.env["account.move.reversal"]
        .with_context(active_model="account.move", active_ids=invoice.ids)
        .create(reverse_vals)
    )
    with self.assertRaises(UserError):
        move_reversal.reverse_moves()
    invoice["fiscal_operation_id"] = (self.env.ref("l10n_br_fiscal.fo_venda").id,)
    with self.assertRaises(UserError):
        move_reversal.reverse_moves()
    for line_id in invoice.invoice_line_ids:
        line_id["fiscal_operation_id"] = (
            self.env.ref("l10n_br_fiscal.fo_venda").id,
        )
        line_id["fiscal_operation_line_id"] = self.env.ref(
            "l10n_br_fiscal.fo_venda_venda"
        ).id
    reversal = move_reversal.reverse_moves()
    reverse_move = self.env["account.move"].browse(reversal["res_id"])
    self.assertTrue(reverse_move)
    self.assertEqual(
        reverse_move.operation_name,
        "Devolução de Venda",
        "The refund process was unsuccessful.",
    )