From ae497d22e515d062f6ec0bad01b9d9820003c2db Mon Sep 17 00:00:00 2001 From: William Braeckman Date: Mon, 12 Dec 2022 08:45:01 +0000 Subject: [PATCH] [FIX] website_sale{,_stock}: fix issue with tests Multiple tests introduced in 16.0 created a product template and then a default product for that template, however a default product is already created by default in the product module when creating a template and it somecases triggered an unicity constraint. closes odoo/odoo#108523 X-original-commit: 3c9ff6e148cd0ee77442dd31079f0fec9c456b4c Related: odoo/enterprise#35180 Signed-off-by: William Braeckman (wbr) --- .../website_sale/tests/test_website_sale_cart_abandoned.py | 6 +----- .../tests/test_website_sale_stock_abandoned_cart_email.py | 5 +---- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/addons/website_sale/tests/test_website_sale_cart_abandoned.py b/addons/website_sale/tests/test_website_sale_cart_abandoned.py index 76a11756b88..fb270261c8e 100644 --- a/addons/website_sale/tests/test_website_sale_cart_abandoned.py +++ b/addons/website_sale/tests/test_website_sale_cart_abandoned.py @@ -198,11 +198,7 @@ class TestWebsiteSaleCartAbandoned(TestWebsiteSaleCartAbandonedCommon): 'list_price': 0.0, 'name': 'free_product' }) - free_product_product = self.env['product.product'].create({ - 'list_price': 0.0, - 'name': 'free_product', - 'product_tmpl_id': free_product_template.id - }) + free_product_product = free_product_template.product_variant_id order_line = [[0, 0, { 'name': 'The Product', 'product_id': free_product_product.id, diff --git a/addons/website_sale_stock/tests/test_website_sale_stock_abandoned_cart_email.py b/addons/website_sale_stock/tests/test_website_sale_stock_abandoned_cart_email.py index 7e8c06d5bef..ee9252340f7 100644 --- a/addons/website_sale_stock/tests/test_website_sale_stock_abandoned_cart_email.py +++ b/addons/website_sale_stock/tests/test_website_sale_stock_abandoned_cart_email.py @@ -20,10 +20,7 @@ class TestWebsiteSaleStockAbandonedCartEmail(TestWebsiteSaleCartAbandonedCommon) 'type': 'product', 'allow_out_of_stock_order': False }) - storable_product_product = self.env['product.product'].create({ - 'name': 'storable_product_product', - 'product_tmpl_id': storable_product_template.id, - }) + storable_product_product = storable_product_template.product_variant_id order_line = [[0, 0, { 'name': 'The Product', 'product_id': storable_product_product.id,