You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.1 KiB

  1. # Copyright 2009-2020 Noviat.
  2. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  3. from odoo.tests.common import TransactionCase
  4. class TestAmlReportXlsx(TransactionCase):
  5. def setUp(self):
  6. super(TestAmlReportXlsx, self).setUp()
  7. self.report = self.env.ref(
  8. "account_move_line_report_xls.action_account_move_line_xlsx"
  9. )
  10. sale_journal = self.env["account.journal"].search([("type", "=", "sale")])[0]
  11. ar = self.env["account.account"].search([("internal_type", "=", "receivable")])[
  12. 0
  13. ]
  14. aml_vals = [
  15. {"name": "debit", "debit": 100, "account_id": ar.id},
  16. {"name": "credit", "credit": 100, "account_id": ar.id},
  17. ]
  18. am = self.env["account.move"].create(
  19. {
  20. "name": "test",
  21. "journal_id": sale_journal.id,
  22. "line_ids": [(0, 0, x) for x in aml_vals],
  23. }
  24. )
  25. self.amls = am.line_ids
  26. def test_aml_report_xlsx(self):
  27. report_xls = self.report.render_xlsx(self.amls.ids, None)
  28. self.assertEqual(report_xls[1], "xlsx")