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.

61 lines
1.9 KiB

  1. # Author: Julien Coux
  2. # Copyright 2016 Camptocamp SA
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from datetime import date
  5. from . import abstract_test_foreign_currency as a_t_f_c
  6. class TestOpenItems(a_t_f_c.AbstractTestForeignCurrency):
  7. """
  8. Technical tests for Open Items Report.
  9. """
  10. def _getReportModel(self):
  11. return self.env['report_open_items']
  12. def _getQwebReportName(self):
  13. return 'account_financial_report.report_open_items_qweb'
  14. def _getXlsxReportName(self):
  15. return 'a_f_r.report_open_items_xlsx'
  16. def _getXlsxReportActionName(self):
  17. return 'account_financial_report.action_report_open_items_xlsx'
  18. def _getReportTitle(self):
  19. return 'Odoo'
  20. def _getBaseFilters(self):
  21. return {
  22. 'date_at': date(date.today().year, 12, 31),
  23. 'company_id': self.company.id,
  24. 'foreign_currency': True,
  25. }
  26. def _getAdditionalFiltersToBeTested(self):
  27. return [
  28. {'only_posted_moves': True},
  29. {'hide_account_at_0': True},
  30. {'only_posted_moves': True, 'hide_account_at_0': True},
  31. ]
  32. def test_partner_filter(self):
  33. partner_1 = self.env.ref('base.res_partner_1')
  34. partner_2 = self.env.ref('base.res_partner_2')
  35. partner_3 = self.env.ref('base.res_partner_3')
  36. partner_4 = self.env.ref('base.res_partner_4')
  37. partner_1.write({'is_company': False,
  38. 'parent_id': partner_2.id})
  39. partner_3.write({'is_company': False})
  40. expected_list = [partner_2.id, partner_3.id, partner_4.id]
  41. context = {
  42. 'active_ids': [
  43. partner_1.id, partner_2.id, partner_3.id, partner_4.id
  44. ],
  45. 'active_model': 'res.partner'
  46. }
  47. wizard = self.env["open.items.report.wizard"].with_context(context)
  48. self.assertEqual(wizard._default_partners(), expected_list)