summaryrefslogtreecommitdiff
path: root/fixco_api/controllers/api_v1
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2024-05-28 10:50:29 +0700
committerstephanchrst <stephanchrst@gmail.com>2024-05-28 10:50:29 +0700
commit0f700ade1d878e3b7031c8abc5f7d1bdb6ccaaf7 (patch)
treec1f26871ca3855f9c3fedbde3568f5f96627cc61 /fixco_api/controllers/api_v1
parent3df675a6ec324cce7a0235ccfa265e4f11cf2387 (diff)
initial commit for api
Diffstat (limited to 'fixco_api/controllers/api_v1')
-rw-r--r--fixco_api/controllers/api_v1/__init__.py1
-rw-r--r--fixco_api/controllers/api_v1/partner.py25
2 files changed, 26 insertions, 0 deletions
diff --git a/fixco_api/controllers/api_v1/__init__.py b/fixco_api/controllers/api_v1/__init__.py
new file mode 100644
index 0000000..3f4a5ff
--- /dev/null
+++ b/fixco_api/controllers/api_v1/__init__.py
@@ -0,0 +1 @@
+from . import partner \ No newline at end of file
diff --git a/fixco_api/controllers/api_v1/partner.py b/fixco_api/controllers/api_v1/partner.py
new file mode 100644
index 0000000..66e9db4
--- /dev/null
+++ b/fixco_api/controllers/api_v1/partner.py
@@ -0,0 +1,25 @@
+from .. import controller
+from odoo import http
+from odoo.http import request
+
+
+class Partner(controller.Controller):
+ _name = 'res.partner'
+ prefix = '/api/v1/'
+
+ @http.route(prefix + 'partner/address/', auth='public', methods=['GET', 'OPTIONS'])
+ @controller.Controller.must_authorized()
+ def get_partner_address_by_id(self, **kw):
+ partner = request.env[self._name].search([('id', '=', 14)])
+ # return self.response(partner)
+ return self.response({
+ 'id': partner.id,
+ 'name': partner.name,
+ 'phone': partner.phone
+ })
+
+ @http.route('/odoo_controller/odoo_controller/', auth='public')
+ def index(self, **kw):
+ test = 'test doang bisa ga'
+ test2 = test
+ return test2