From ca18c1e40971df1cf796ec5862688d8e1873e76e Mon Sep 17 00:00:00 2001 From: IT Fixcomart Date: Fri, 18 Nov 2022 14:02:44 +0700 Subject: Manufacture detail rest api --- indoteknik_api/controllers/api_v1/manufacture.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'indoteknik_api/controllers/api_v1') diff --git a/indoteknik_api/controllers/api_v1/manufacture.py b/indoteknik_api/controllers/api_v1/manufacture.py index 7d113b86..5b9d57b2 100644 --- a/indoteknik_api/controllers/api_v1/manufacture.py +++ b/indoteknik_api/controllers/api_v1/manufacture.py @@ -31,6 +31,18 @@ class Manufacture(controller.Controller): return self.response(data) + @http.route(prefix + 'manufacture/', auth='public', methods=['GET', 'OPTIONS']) + def get_manufacture(self, **kw): + if not self.authenticate(): + return self.response(code=401, description='Unauthorized') + + id = kw.get('id') + manufacture = request.env['x_manufactures'].search([('id', '=', id)], limit=1) + data = {} + if manufacture: + data = request.env['x_manufactures'].api_single_response(manufacture, with_detail=True) + return self.response(data) + @http.route(prefix + 'manufacture/page/', auth='public', methods=['GET']) def get_manufacture_by_page(self, **kw): if not self.authenticate(): -- cgit v1.2.3