Feat: Fields

This commit is contained in:
Rodia 2025-02-08 16:19:48 -05:00
parent f5ccc9af45
commit 0663b9ef84
2 changed files with 19 additions and 11 deletions

View File

@ -78,15 +78,22 @@ def categories(request, pool):
@don_confiao_application @don_confiao_application
def products(request, pool): def products(request, pool):
Product = pool.get('product.product') Product = pool.get('product.product')
products = Product.search_read([ with Transaction().set_context(
('salable', '=', True) {'company': 1, 'locations': [3]}):
], order=[ products = Product.search_read([
('id', 'ASC') ('salable', '=', True)
], fields_names=[ ], order=[
'id', ('id', 'ASC')
'name' ], fields_names=[
]) 'id',
return products 'name',
'template.list_price',
'default_uom.name',
'description',
'quantity',
])
return products
@app.route( @app.route(
@ -108,6 +115,7 @@ def search_products(request, pool, product_name: str):
'id', 'id',
'name', 'name',
'template.list_price', 'template.list_price',
'default_uom.name',
'description', 'description',
'quantity', 'quantity',
]) ])

View File

@ -2,7 +2,7 @@ import pudb
import requests import requests
import json import json
url = 'http://localhost:8000' url = 'http://localhost:18030'
key = '9a9ffc430146447d81e6698240199a4be2b0e774cb18474999d0f60e33b5b1eb1cfff9d9141346a98844879b5a9e787489c891ddc8fb45cc903b7244cab64fb1' key = '9a9ffc430146447d81e6698240199a4be2b0e774cb18474999d0f60e33b5b1eb1cfff9d9141346a98844879b5a9e787489c891ddc8fb45cc903b7244cab64fb1'
db = 'tryton' db = 'tryton'
application_name = 'sale_don_confiao' application_name = 'sale_don_confiao'
@ -15,7 +15,7 @@ response_parties = requests.get(
}) })
response_party = requests.get( response_party = requests.get(
base_url+'/party/2753', base_url + '/party/2753',
headers={ headers={
'Authorization': f'bearer {key}', 'Authorization': f'bearer {key}',
}) })