Browse Source
[IMP] - Create contract on sale order confirmation
[IMP] - Create contract on sale order confirmation
- On Sale Order confirmation, a contract is created for each contract template used on sale order lines - A not finished contract can be mentioned on sale order line - A sale order line linked to a contract will update it and don't create a new one if it had the same templatepull/208/head
sbejaoui
6 years ago
committed by
Thomas Binsfeld
6 changed files with 205 additions and 80 deletions
-
65product_contract/models/sale_order.py
-
62product_contract/models/sale_order_line.py
-
1product_contract/tests/__init__.py
-
102product_contract/tests/test_sale_order.py
-
37product_contract/tests/test_sale_order_line.py
-
18product_contract/views/sale_order.xml
@ -1,37 +0,0 @@ |
|||||
# -*- 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 |
|
||||
) |
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue