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.

36 lines
1.3 KiB

6 years ago
  1. # Copyright 2016 Tecnativa - Carlos Dauden
  2. # Copyright 2017 Tecnativa - Pedro M. Baeza
  3. # Copyright 2018 Roel Adriaans - roel@road-support.nl
  4. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  5. from odoo.addons.contract.tests.test_contract import TestContractBase
  6. class TestContract(TestContractBase):
  7. @classmethod
  8. def setUpClass(cls):
  9. # Reuse the tests from the contract module, but replace the
  10. # contract line
  11. super(TestContract, cls).setUpClass()
  12. cls.acct_line.unlink()
  13. cls.section = cls.env['sale.layout_category'].create({
  14. 'name': 'Services',
  15. 'subtotal': True,
  16. 'pagebreak': True,
  17. 'sequence': 1
  18. })
  19. cls.line_vals.update({
  20. 'layout_category_id': cls.section.id,
  21. })
  22. cls.acct_line = cls.env['account.analytic.invoice.line'].create(
  23. cls.line_vals,
  24. )
  25. def test_create_invoice(self):
  26. """ Create contract with section"""
  27. self.assertTrue(self.acct_line.layout_category_id)
  28. self.contract.recurring_create_invoice()
  29. invoice_id = self.env['account.invoice'].search(
  30. [('contract_id', '=', self.contract.id)])
  31. self.assertEqual(invoice_id.invoice_line_ids.layout_category_id.id,
  32. self.line_vals['layout_category_id'])