mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[IMP] - Add recurrence fields to product template and sale order line
This commit is contained in:
committed by
Thomas Binsfeld
parent
32b2e17660
commit
280eca9819
@@ -1,6 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 LasLabs Inc.
|
||||
# Copyright 2018 ACSONE SA/NV.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import test_product
|
||||
from . import test_sale_order
|
||||
from . import test_sale_order_line
|
||||
|
||||
@@ -27,6 +27,8 @@ class TestSaleOrder(TransactionCase):
|
||||
def test_action_done(self):
|
||||
""" It should create a contract when the sale for a contract is set
|
||||
to done for the first time """
|
||||
|
||||
self.assertTrue(self.sale.is_contract)
|
||||
self.env['account.analytic.account']._patch_method(
|
||||
'create', MagicMock()
|
||||
)
|
||||
|
||||
37
product_contract/tests/test_sale_order_line.py
Normal file
37
product_contract/tests/test_sale_order_line.py
Normal file
@@ -0,0 +1,37 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2018 ACSONE SA/NV.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from mock import MagicMock
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestSaleOrder(TransactionCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestSaleOrder, self).setUp()
|
||||
self.product = self.env.ref('product.product_product_1')
|
||||
self.sale = self.env.ref('sale.sale_order_2')
|
||||
self.contract = self.env['account.analytic.contract'].create({
|
||||
'name': 'Test',
|
||||
})
|
||||
self.product.product_tmpl_id.is_contract = True
|
||||
self.sale_order_line = self.sale.order_line.filtered(
|
||||
lambda l: l.product_id == self.product
|
||||
)
|
||||
|
||||
def test_onchange_product(self):
|
||||
""" It should get recurrence invoicing info to the sale line from
|
||||
its product """
|
||||
self.assertEqual(
|
||||
self.sale_order_line.recurring_rule_type,
|
||||
self.product.recurring_rule_type
|
||||
)
|
||||
self.assertEqual(
|
||||
self.sale_order_line.recurring_interval,
|
||||
self.product.recurring_interval
|
||||
)
|
||||
self.assertEqual(
|
||||
self.sale_order_line.recurring_invoicing_type,
|
||||
self.product.recurring_invoicing_type
|
||||
)
|
||||
Reference in New Issue
Block a user