summaryrefslogtreecommitdiff
path: root/indoteknik_api/controllers/api_v2/product.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2023-04-28 09:03:04 +0700
committerstephanchrst <stephanchrst@gmail.com>2023-04-28 09:03:04 +0700
commit57d55f545da0fc501a9828bb3ca2988f126b241a (patch)
tree75b98126546eea20b90ca777b2887b4813946871 /indoteknik_api/controllers/api_v2/product.py
parent3592c254ca5baf4a0a769f500f9e28a9cbc272a7 (diff)
parent6fa5de951abc02884eb37cdc6786c0f3d141ccc5 (diff)
Merge branch 'staging' into release
Diffstat (limited to 'indoteknik_api/controllers/api_v2/product.py')
-rw-r--r--indoteknik_api/controllers/api_v2/product.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/indoteknik_api/controllers/api_v2/product.py b/indoteknik_api/controllers/api_v2/product.py
index 772906f6..d9b43bda 100644
--- a/indoteknik_api/controllers/api_v2/product.py
+++ b/indoteknik_api/controllers/api_v2/product.py
@@ -5,17 +5,19 @@ from odoo.http import request
class V2Product(controller.Controller):
prefix = '/api/v2/'
- @http.route(prefix + 'product/<id>', auth='public', methods=['GET'])
+ @http.route(prefix + 'product/<id>', auth='public', methods=['GET', 'OPTIONS'])
@controller.Controller.must_authorized()
def v2_get_product_by_id(self, **kw):
id = kw.get('id')
if not id:
return self.response(code=400, description='id is required')
+
+ pricelist = self.user_pricelist()
data = []
id = [int(x) for x in id.split(',')]
product_templates = request.env['product.template'].search([('id', 'in', id)])
if product_templates:
- data = [request.env['product.template'].v2_api_single_response(x, with_detail='DEFAULT') for x in product_templates]
+ data = [request.env['product.template'].v2_api_single_response(x, pricelist=pricelist, with_detail='DEFAULT') for x in product_templates]
return self.response(data) \ No newline at end of file