summaryrefslogtreecommitdiff
path: root/addons/purchase_stock/tests/test_product_template.py
diff options
context:
space:
mode:
Diffstat (limited to 'addons/purchase_stock/tests/test_product_template.py')
-rw-r--r--addons/purchase_stock/tests/test_product_template.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/addons/purchase_stock/tests/test_product_template.py b/addons/purchase_stock/tests/test_product_template.py
new file mode 100644
index 00000000..0692ac02
--- /dev/null
+++ b/addons/purchase_stock/tests/test_product_template.py
@@ -0,0 +1,26 @@
+from odoo.tests.common import TransactionCase
+
+
+class TestProductTemplate(TransactionCase):
+ def test_name_search(self):
+ partner = self.env['res.partner'].create({
+ 'name': 'Azure Interior',
+ })
+
+ seller = self.env['product.supplierinfo'].create({
+ 'name': partner.id,
+ 'price': 12.0,
+ 'delay': 1,
+ 'product_code': 'VOB2a',
+ })
+
+ product_tmpl = self.env['product.template'].create({
+ 'name': 'Rubber Duck',
+ 'type': 'product',
+ 'default_code': 'VOB2A',
+ 'seller_ids': [seller.id],
+ 'purchase_ok': True,
+ })
+ ns = self.env['product.template'].with_context(partner_id=partner.id).name_search('VOB2', [['purchase_ok', '=', True]])
+ self.assertEqual(len(ns), 1, "name_search should have 1 item")
+ self.assertEqual(ns[0][1], '[VOB2A] Rubber Duck', "name_search should return the expected result")