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.

31 lines
1.2 KiB

  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.ref('sale.sale_layout_cat_2')
  14. cls.line_vals.update({
  15. 'layout_category_id': cls.section.id,
  16. })
  17. cls.acct_line = cls.env['account.analytic.invoice.line'].create(
  18. cls.line_vals,
  19. )
  20. def test_create_invoice(self):
  21. """ Create contract with section"""
  22. self.assertTrue(self.acct_line.layout_category_id)
  23. self.contract.recurring_create_invoice()
  24. invoice_id = self.env['account.invoice'].search(
  25. [('contract_id', '=', self.contract.id)])
  26. self.assertEqual(invoice_id.invoice_line_ids.layout_category_id.id,
  27. self.line_vals['layout_category_id'])