mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[9.0][ADD] procurement_auto_create_group: add tests
This commit is contained in:
@@ -54,6 +54,7 @@ Credits
|
||||
Contributors
|
||||
------------
|
||||
* Jordi Ballester <jordi.ballester@eficent.com>
|
||||
* Lois Rilo <lois.rilo@eficent.com>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
5
procurement_auto_create_group/tests/__init__.py
Normal file
5
procurement_auto_create_group/tests/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2017 Eficent Business and IT Consulting Services S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import test_auto_create
|
||||
46
procurement_auto_create_group/tests/test_auto_create.py
Normal file
46
procurement_auto_create_group/tests/test_auto_create.py
Normal file
@@ -0,0 +1,46 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2017 Eficent Business and IT Consulting Services S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from openerp.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestProcurementAutoCreateGroup(TransactionCase):
|
||||
def setUp(self, *args, **kwargs):
|
||||
super(TestProcurementAutoCreateGroup, self).setUp(*args, **kwargs)
|
||||
self.po_model = self.env['procurement.order']
|
||||
self.pr_model = self.env['procurement.rule']
|
||||
self.product_12 = self.env.ref('product.product_product_12')
|
||||
|
||||
# Create rules:
|
||||
self.no_auto_create = self.pr_model.create({
|
||||
'name': 'rule without autocreate',
|
||||
'auto_create_group': False,
|
||||
'action': [],
|
||||
})
|
||||
self.auto_create = self.pr_model.create({
|
||||
'name': 'rule with autocreate',
|
||||
'auto_create_group': True,
|
||||
'action': [],
|
||||
})
|
||||
|
||||
def test_auto_create_group(self):
|
||||
"""Test auto creation of group."""
|
||||
proc1 = self.po_model.create({
|
||||
'name': 'proc01',
|
||||
'product_id': self.product_12.id,
|
||||
'product_qty': 1.0,
|
||||
'product_uom': self.product_12.uom_id.id,
|
||||
'rule_id': self.no_auto_create.id,
|
||||
})
|
||||
self.assertFalse(proc1.group_id,
|
||||
"Procurement Group should not have been assigned.")
|
||||
proc2 = self.po_model.create({
|
||||
'name': 'proc02',
|
||||
'product_id': self.product_12.id,
|
||||
'product_qty': 1.0,
|
||||
'product_uom': self.product_12.uom_id.id,
|
||||
'rule_id': self.auto_create.id,
|
||||
})
|
||||
self.assertTrue(proc2.group_id,
|
||||
"Procurement Group has not been assigned.")
|
||||
Reference in New Issue
Block a user