From aab3d15ab71dacee885beaa05a0ca9b5c7b652dd Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 3 Aug 2023 10:25:29 +0700 Subject: Add order sequence on manufacture API --- indoteknik_api/controllers/api_v1/manufacture.py | 3 ++- indoteknik_custom/views/x_manufactures.xml | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/indoteknik_api/controllers/api_v1/manufacture.py b/indoteknik_api/controllers/api_v1/manufacture.py index 345fd660..cbee253d 100644 --- a/indoteknik_api/controllers/api_v1/manufacture.py +++ b/indoteknik_api/controllers/api_v1/manufacture.py @@ -16,6 +16,7 @@ class Manufacture(controller.Controller): level = kw.get('level') limit = int(kw.get('limit', 0)) offset = int(kw.get('offset', 0)) + order = 'sequence ASC' if name: name = '%' + name.replace(' ', '%') + '%' if '%' not in name else name @@ -26,7 +27,7 @@ class Manufacture(controller.Controller): return self.response(code=400, description='level possible value is prioritas, gold, silver') query.append(('x_manufacture_level', '=', level)) - manufactures = request.env['x_manufactures'].search(query, limit=limit, offset=offset) + manufactures = request.env['x_manufactures'].search(query, order=order, limit=limit, offset=offset) data = { 'manufacture_total': request.env['x_manufactures'].search_count(query), 'manufactures': [request.env['x_manufactures'].api_single_response(x) for x in manufactures] diff --git a/indoteknik_custom/views/x_manufactures.xml b/indoteknik_custom/views/x_manufactures.xml index a88c5d34..dd896179 100755 --- a/indoteknik_custom/views/x_manufactures.xml +++ b/indoteknik_custom/views/x_manufactures.xml @@ -16,6 +16,7 @@ x_manufactures + @@ -37,6 +38,7 @@ + -- cgit v1.2.3