summaryrefslogtreecommitdiff
path: root/addons/point_of_sale/tests
diff options
context:
space:
mode:
authorAntoine Prieels <anp@odoo.com>2020-07-23 12:07:38 +0000
committerAntoine Prieels <anp@odoo.com>2020-07-30 13:08:24 +0000
commit0c3fe8736d77763b4fb31fd76be1f41f1effd5c0 (patch)
treeb4c70ea1a2ad53ed2570622093a60dd5ba808711 /addons/point_of_sale/tests
parentd35adaa030e68f18516af312c2cdf013e9397114 (diff)
[IMP] point_of_sale: Product configurator
Configure products with create_variants = 'never' from the POS closes odoo/odoo#54956 Taskid: 208205 Related: odoo/upgrade#1522 Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Diffstat (limited to 'addons/point_of_sale/tests')
-rw-r--r--addons/point_of_sale/tests/test_frontend.py73
1 files changed, 73 insertions, 0 deletions
diff --git a/addons/point_of_sale/tests/test_frontend.py b/addons/point_of_sale/tests/test_frontend.py
index 759c23bee1e..73e9142de86 100644
--- a/addons/point_of_sale/tests/test_frontend.py
+++ b/addons/point_of_sale/tests/test_frontend.py
@@ -109,6 +109,12 @@ class TestPointOfSaleHttpCommon(odoo.tests.HttpCase):
'list_price': 5.10,
'taxes_id': False,
})
+ configurable_chair = env['product.product'].create({
+ 'name': 'Configurable Chair',
+ 'available_in_pos': True,
+ 'list_price': 10,
+ 'taxes_id': False,
+ })
attribute = env['product.attribute'].create({
'name': 'add 2',
@@ -124,6 +130,68 @@ class TestPointOfSaleHttpCommon(odoo.tests.HttpCase):
})
line.product_template_value_ids[0].price_extra = 2
+ chair_color_attribute = env['product.attribute'].create({
+ 'name': 'Color',
+ 'display_type': 'color',
+ 'create_variant': 'no_variant',
+ })
+ chair_color_red = env['product.attribute.value'].create({
+ 'name': 'Red',
+ 'attribute_id': chair_color_attribute.id,
+ 'html_color': '#ff0000',
+ })
+ chair_color_blue = env['product.attribute.value'].create({
+ 'name': 'Blue',
+ 'attribute_id': chair_color_attribute.id,
+ 'html_color': '#0000ff',
+ })
+ chair_color_line = env['product.template.attribute.line'].create({
+ 'product_tmpl_id': configurable_chair.product_tmpl_id.id,
+ 'attribute_id': chair_color_attribute.id,
+ 'value_ids': [(6, 0, [chair_color_red.id, chair_color_blue.id])]
+ })
+ chair_color_line.product_template_value_ids[0].price_extra = 1
+
+ chair_legs_attribute = env['product.attribute'].create({
+ 'name': 'Chair Legs',
+ 'display_type': 'select',
+ 'create_variant': 'no_variant',
+ })
+ chair_legs_metal = env['product.attribute.value'].create({
+ 'name': 'Metal',
+ 'attribute_id': chair_legs_attribute.id,
+ })
+ chair_legs_wood = env['product.attribute.value'].create({
+ 'name': 'Wood',
+ 'attribute_id': chair_legs_attribute.id,
+ })
+ chair_legs_line = env['product.template.attribute.line'].create({
+ 'product_tmpl_id': configurable_chair.product_tmpl_id.id,
+ 'attribute_id': chair_legs_attribute.id,
+ 'value_ids': [(6, 0, [chair_legs_metal.id, chair_legs_wood.id])]
+ })
+
+ chair_fabrics_attribute = env['product.attribute'].create({
+ 'name': 'Fabrics',
+ 'display_type': 'radio',
+ 'create_variant': 'no_variant',
+ })
+ chair_fabrics_leather = env['product.attribute.value'].create({
+ 'name': 'Leather',
+ 'attribute_id': chair_fabrics_attribute.id,
+ })
+ chair_fabrics_other = env['product.attribute.value'].create({
+ 'name': 'Other',
+ 'attribute_id': chair_fabrics_attribute.id,
+ 'is_custom': True,
+ })
+ chair_fabrics_line = env['product.template.attribute.line'].create({
+ 'product_tmpl_id': configurable_chair.product_tmpl_id.id,
+ 'attribute_id': chair_fabrics_attribute.id,
+ 'value_ids': [(6, 0, [chair_fabrics_leather.id, chair_fabrics_other.id])]
+ })
+ chair_color_line.product_template_value_ids[1].is_custom = True
+
fixed_pricelist = env['product.pricelist'].create({
'name': 'Fixed',
'item_ids': [(0, 0, {
@@ -437,3 +505,8 @@ class TestUi(TestPointOfSaleHttpCommon):
self.main_pos_config.write({ 'manage_orders': True, 'module_account': True })
self.main_pos_config.open_session_cb(check_coa=False)
self.start_tour("/pos/web?config_id=%d" % self.main_pos_config.id, 'OrderManagementScreenTour', login="admin", step_delay=50)
+
+ def test_04_product_configurator(self):
+ self.main_pos_config.write({ 'product_configurator': True })
+ self.main_pos_config.open_session_cb(check_coa=False)
+ self.start_tour("/pos/web?config_id=%d" % self.main_pos_config, 'ProductConfiguratorTour', login="admin", step_delay=50)