summaryrefslogtreecommitdiff
path: root/indoteknik_api/controllers/controller.py
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2023-08-16 04:51:14 +0000
committerIT Fixcomart <it@fixcomart.co.id>2023-08-16 04:51:14 +0000
commita73c0825a264fc002e7496b07f238f79efd93086 (patch)
tree04b170cc3860f82d936b5dcb83451b963c524f95 /indoteknik_api/controllers/controller.py
parent3a954e59343d2d3a3df5436297f7007008ae62e8 (diff)
parent021f7ccc9f7b026e330352d34e695993116bdd99 (diff)
Merged in production (pull request #98)
Production
Diffstat (limited to 'indoteknik_api/controllers/controller.py')
-rw-r--r--indoteknik_api/controllers/controller.py22
1 files changed, 5 insertions, 17 deletions
diff --git a/indoteknik_api/controllers/controller.py b/indoteknik_api/controllers/controller.py
index 1e9f01ee..d40ccb5a 100644
--- a/indoteknik_api/controllers/controller.py
+++ b/indoteknik_api/controllers/controller.py
@@ -42,19 +42,10 @@ class Controller(http.Controller):
request.session.authenticate(db, username, password)
return True
except:
- try:
- authorization = wsgienv['HTTP_AUTHORIZATION']
- except:
- authorization = None
- request.session.authenticate(config.get('db_name'), 'it@fixcomart.co.id', 'Fixcomart378')
- token = request.env['ir.config_parameter'].sudo().get_param('rest_api_token') or ''
- result = False
- if authorization == token:
- result = True
+ if not request.env.uid:
+ request.session.authenticate(config.get('db_name'), 'it@fixcomart.co.id', 'Fixcomart378')
user_token = self.verify_user_token()
- if user_token:
- result = user_token
- return result
+ return user_token
def user_pricelist(self):
user_token = self.authenticate()
@@ -147,13 +138,10 @@ class Controller(http.Controller):
user = request.env['res.users'].browse([ user_token['id'] ])
if not user:
return False
- data = {
+ return {
'user_id': user.id,
- 'partner_id': None
+ 'partner_id': user.partner_id.id or None
}
- if user.partner_id:
- data['partner_id'] = user.partner_id.id
- return data
except:
return False