Files
contract/product_contract/tests/test_product_template.py
Ted Salmon 33f76c28f5 [ADD] product_contract: Create module
* Add contract functionality to `product.templates`
* Add logic to create contracts from `sale.order` that contains contract products.
2017-04-26 08:58:52 -07:00

32 lines
1023 B
Python

# -*- coding: utf-8 -*-
# Copyright 2017 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import TransactionCase
class TestProductTemplate(TransactionCase):
def setUp(self):
super(TestProductTemplate, self).setUp()
self.product = self.env.ref(
'product.product_product_4_product_template'
)
self.contract = self.env['account.analytic.contract'].create({
'name': 'Test',
'recurring_rule_type': 'yearly',
'recurring_interval': 12345,
})
def test_change_is_contract(self):
""" It should verify that the contract_template_id is removed
when is_contract is False """
self.product.is_contract = True
self.product.contract_template_id = self.contract.id
self.product.is_contract = False
self.product._change_is_contract()
self.assertEquals(
len(self.product.contract_template_id),
0
)