diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2023-09-08 10:59:55 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2023-09-08 10:59:55 +0700 |
| commit | 43f020d6f6ba271381e934c9e811f052de70a779 (patch) | |
| tree | defc0674d2c659ca4d5e24cbb22d103dcd130ec0 /indoteknik_api/controllers/api_v3 | |
| parent | fa4f4e6f06ee77a2c448293c806d0f34e643f394 (diff) | |
fix flashsale product detail
Diffstat (limited to 'indoteknik_api/controllers/api_v3')
| -rw-r--r-- | indoteknik_api/controllers/api_v3/__init__.py | 1 | ||||
| -rw-r--r-- | indoteknik_api/controllers/api_v3/product.py | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/indoteknik_api/controllers/api_v3/__init__.py b/indoteknik_api/controllers/api_v3/__init__.py new file mode 100644 index 00000000..23275437 --- /dev/null +++ b/indoteknik_api/controllers/api_v3/__init__.py @@ -0,0 +1 @@ +from . import product
\ No newline at end of file diff --git a/indoteknik_api/controllers/api_v3/product.py b/indoteknik_api/controllers/api_v3/product.py new file mode 100644 index 00000000..3df34dc6 --- /dev/null +++ b/indoteknik_api/controllers/api_v3/product.py @@ -0,0 +1,18 @@ +from .. import controller +from odoo import http +from odoo.http import request + +class V3Product(controller.Controller): + prefix = '/api/v3/' + + @http.route(prefix + 'product/<id>', auth='public', methods=['GET', 'OPTIONS']) + @controller.Controller.must_authorized() + def get_product_solr_flag(self, **kw): + solr_model = request.env['apache.solr'] + + id = kw.get('id') + + products = request.env['product.template'].browse(int(id)) + result = products.solr_results(detail=True) + + return self.response(result, headers=[('Cache-Control', 'max-age=3600, public')])
\ No newline at end of file |
