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
1019 B

  1. # -*- coding: utf-8 -*-
  2. # Copyright 2017 LasLabs Inc.
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from odoo.tests.common import TransactionCase
  5. class TestProductTemplate(TransactionCase):
  6. def setUp(self):
  7. super(TestProductTemplate, self).setUp()
  8. self.product = self.env.ref(
  9. 'product.product_product_4_product_template'
  10. )
  11. self.contract = self.env['account.analytic.contract'].create({
  12. 'name': 'Test',
  13. 'recurring_rule_type': 'yearly',
  14. 'recurring_interval': 1,
  15. })
  16. def test_change_is_contract(self):
  17. """ It should verify that the contract_template_id is removed
  18. when is_contract is False """
  19. self.product.is_contract = True
  20. self.product.contract_template_id = self.contract.id
  21. self.product.is_contract = False
  22. self.product._change_is_contract()
  23. self.assertEquals(
  24. len(self.product.contract_template_id),
  25. 0
  26. )