Fix: List Price, Company Context
This commit is contained in:
parent
406a5bafda
commit
695c97638c
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user