diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-08-03 10:25:29 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-08-03 10:25:29 +0700 |
| commit | aab3d15ab71dacee885beaa05a0ca9b5c7b652dd (patch) | |
| tree | cf2bce640a5b75e43c0c474d4d910420a4040512 | |
| parent | 316e94f7fd4e8c065c95b800341c48d6c84263a9 (diff) | |
Add order sequence on manufacture API
| -rw-r--r-- | indoteknik_api/controllers/api_v1/manufacture.py | 3 | ||||
| -rwxr-xr-x | indoteknik_custom/views/x_manufactures.xml | 2 |
2 files changed, 4 insertions, 1 deletions
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 @@ <field name="model">x_manufactures</field> <field name="arch" type="xml"> <tree> + <field name="sequence" string="Seq"/> <field name="x_name"/> <field name="x_negara_asal"/> <field name="x_short_desc"/> @@ -37,6 +38,7 @@ <group> <group> <field name="x_name"/> + <field name="sequence"/> <field name="x_negara_asal"/> <field name="x_short_desc"/> <field name="x_manufacture_level"/> |
