From 695c97638cef22bb2429e3b9e5f3c2a723e94425 Mon Sep 17 00:00:00 2001 From: Rodia Date: Sat, 18 Jan 2025 15:50:33 -0500 Subject: [PATCH] Fix: List Price, Company Context --- modules/sale_don_confiao/routes.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/modules/sale_don_confiao/routes.py b/modules/sale_don_confiao/routes.py index ea92487..36056a9 100644 --- a/modules/sale_don_confiao/routes.py +++ b/modules/sale_don_confiao/routes.py @@ -1,4 +1,5 @@ from trytond.wsgi import app +from trytond.transaction import Transaction from trytond.protocols.wrappers import ( with_pool, with_transaction, @@ -96,17 +97,18 @@ def products(request, pool): @with_transaction() @don_confiao_application def search_products(request, pool, product_name: str): - Product = pool.get('product.product') - products = Product.search_read([ - ('name', 'ilike', f'%{product_name}%') - ], order=[ - ('id', 'ASC') - ], fields_names=[ - 'id', - 'name', - 'list_price', - 'description' - ]) + with Transaction().set_context({'company': 1}): + Product = pool.get('product.product') + products = Product.search_read([ + ('name', 'ilike', f'%{product_name}%') + ], order=[ + ('id', 'ASC') + ], fields_names=[ + 'id', + 'name', + 'template.list_price', + 'description' + ]) return products