Debian Codegraph @

addons/website_sale_collect/tests/test_website.py

raw symbols SCIP
1 # Part of Odoo. See LICENSE file for full copyright and licensing details.
2
3 from odoo.fields import Command
4 from odoo.tests import tagged
5
6 from odoo.addons.website_sale_collect.tests.common import ClickAndCollectCommon
7
8
9 @tagged('post_install', '-at_install')
10 class TestWebsite(ClickAndCollectCommon):
11
12 @classmethod
13 def setUpClass(cls):
14 super().setUpClass()
15 cls.warehouse_2 = cls._create_warehouse()
16
17 def test_product_available_qty_if_in_store_dm_published(self):
18 self.website.warehouse_id = self.warehouse_2
19 free_qty = self.website._get_product_available_qty(self.storable_product)
20 self.assertEqual(free_qty, 10)
21
22 def test_product_available_qty_if_in_store_dm_unpublished(self):
23 self.in_store_dm.is_published = False
24 self.website.warehouse_id = self.warehouse_2
25 free_qty = self.website._get_product_available_qty(self.storable_product)
26 self.assertEqual(free_qty, 0)
27
28 def test_in_store_product_available_qty_for_order(self):
29 self.in_store_dm.warehouse_ids = [Command.link(self.warehouse_2.id)]
30 self._add_product_qty_to_wh(self.storable_product.id, 15, self.warehouse_2.lot_stock_id.id)
31 free_qty = self.website._get_max_in_store_product_available_qty(self.storable_product)
32 self.assertEqual(free_qty, 15)