Fix: List Price, Company Context

This commit is contained in:
Rodia 2025-01-18 15:50:33 -05:00
parent 406a5bafda
commit 695c97638c

View File

@ -1,4 +1,5 @@
from trytond.wsgi import app from trytond.wsgi import app
from trytond.transaction import Transaction
from trytond.protocols.wrappers import ( from trytond.protocols.wrappers import (
with_pool, with_pool,
with_transaction, with_transaction,
@ -96,17 +97,18 @@ def products(request, pool):
@with_transaction() @with_transaction()
@don_confiao_application @don_confiao_application
def search_products(request, pool, product_name: str): def search_products(request, pool, product_name: str):
Product = pool.get('product.product') with Transaction().set_context({'company': 1}):
products = Product.search_read([ Product = pool.get('product.product')
('name', 'ilike', f'%{product_name}%') products = Product.search_read([
], order=[ ('name', 'ilike', f'%{product_name}%')
('id', 'ASC') ], order=[
], fields_names=[ ('id', 'ASC')
'id', ], fields_names=[
'name', 'id',
'list_price', 'name',
'description' 'template.list_price',
]) 'description'
])
return products return products