From 2e291fd0a6c2b21751b5ee786cede51f6e9d600f Mon Sep 17 00:00:00 2001 From: Rodia Date: Sat, 11 Jan 2025 17:00:17 -0500 Subject: [PATCH] Fix: Test, Products Info --- modules/sale_don_confiao/routes.py | 7 ++++++- modules/sale_don_confiao/tests/test_api_donconfiao.py | 3 +-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/sale_don_confiao/routes.py b/modules/sale_don_confiao/routes.py index 09374a0..1e59114 100644 --- a/modules/sale_don_confiao/routes.py +++ b/modules/sale_don_confiao/routes.py @@ -79,9 +79,14 @@ def search_products(request, pool, product_name): products = Product.search_read( [('name', 'like', product_name)], order=[('id', 'ASC')], - fields_names=['id', 'name', 'list_price']) + fields_names=[ + 'id', 'name', 'list_price', + 'description', 'template.forecast_quantity' + ]) + return products + @app.route('//sale_don_confiao/sales', methods=['GET']) @allow_null_origin @with_pool diff --git a/modules/sale_don_confiao/tests/test_api_donconfiao.py b/modules/sale_don_confiao/tests/test_api_donconfiao.py index 085d422..e41137a 100644 --- a/modules/sale_don_confiao/tests/test_api_donconfiao.py +++ b/modules/sale_don_confiao/tests/test_api_donconfiao.py @@ -101,7 +101,6 @@ class DonConfiaoApiRouteTestCase( template, = ProductTemplate.create([{ 'name': 'Product', 'default_uom': Uom.search([('name', '=', 'Unit')])[0].id, - 'list_price': 5000 }]) Product.create([{'template': template.id}]) @@ -129,8 +128,8 @@ class DonConfiaoApiRouteTestCase( products = json.loads( response.get_data().decode()) - raise Exception(products) self.assertEqual(response.status_code, HTTPStatus.OK) + self.assertEqual(len(products), 2) def test_get_sales(self): pool = Pool(DB_NAME)