refactor: update kiosk controller routes to use jsonrpc type instead of json
This commit is contained in:
parent
6fc645230d
commit
f667025d92
@ -28,7 +28,7 @@ class HrExpenseKioskController(http.Controller):
|
|||||||
'json': json,
|
'json': json,
|
||||||
})
|
})
|
||||||
|
|
||||||
@http.route('/hr_expense/kiosk_data/<string:token>', type='json', auth='public')
|
@http.route('/hr_expense/kiosk_data/<string:token>', type='jsonrpc', auth='public')
|
||||||
def get_kiosk_data(self, token):
|
def get_kiosk_data(self, token):
|
||||||
""" Get all employees for selection. """
|
""" Get all employees for selection. """
|
||||||
company = self._check_token(token)
|
company = self._check_token(token)
|
||||||
@ -57,7 +57,7 @@ class HrExpenseKioskController(http.Controller):
|
|||||||
'categories': products,
|
'categories': products,
|
||||||
}
|
}
|
||||||
|
|
||||||
@http.route('/hr_expense/kiosk_validate_pin/<string:token>', type='json', auth='public')
|
@http.route('/hr_expense/kiosk_validate_pin/<string:token>', type='jsonrpc', auth='public')
|
||||||
def validate_pin(self, token, employee_id, pin):
|
def validate_pin(self, token, employee_id, pin):
|
||||||
""" Validates the 4-digit PIN of the employee. """
|
""" Validates the 4-digit PIN of the employee. """
|
||||||
if not self._check_token(token):
|
if not self._check_token(token):
|
||||||
@ -72,14 +72,14 @@ class HrExpenseKioskController(http.Controller):
|
|||||||
else:
|
else:
|
||||||
return {'status': 'error', 'message': _("Incorrect PIN.")}
|
return {'status': 'error', 'message': _("Incorrect PIN.")}
|
||||||
|
|
||||||
@http.route('/hr_expense/kiosk_get_pending/<string:token>', type='json', auth='public')
|
@http.route('/hr_expense/kiosk_get_pending/<string:token>', type='jsonrpc', auth='public')
|
||||||
def get_pending(self, token, employee_id):
|
def get_pending(self, token, employee_id):
|
||||||
""" Returns pending realizations for the employee. """
|
""" Returns pending realizations for the employee. """
|
||||||
if not self._check_token(token):
|
if not self._check_token(token):
|
||||||
return []
|
return []
|
||||||
return request.env['hr.expense.realization'].sudo().get_pending_realizations(employee_id)
|
return request.env['hr.expense.realization'].sudo().get_pending_realizations(employee_id)
|
||||||
|
|
||||||
@http.route('/hr_expense/kiosk_get_submitted/<string:token>', type='json', auth='public')
|
@http.route('/hr_expense/kiosk_get_submitted/<string:token>', type='jsonrpc', auth='public')
|
||||||
def get_submitted(self, token, employee_id):
|
def get_submitted(self, token, employee_id):
|
||||||
""" Returns submitted expenses for the employee. """
|
""" Returns submitted expenses for the employee. """
|
||||||
if not self._check_token(token):
|
if not self._check_token(token):
|
||||||
@ -110,7 +110,7 @@ class HrExpenseKioskController(http.Controller):
|
|||||||
})
|
})
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@http.route('/hr_expense/kiosk_submit_realization/<string:token>', type='json', auth='public')
|
@http.route('/hr_expense/kiosk_submit_realization/<string:token>', type='jsonrpc', auth='public')
|
||||||
def submit_realization(self, token, employee_id, expense_id, lines=None):
|
def submit_realization(self, token, employee_id, expense_id, lines=None):
|
||||||
""" Creates a realization report from the kiosk. """
|
""" Creates a realization report from the kiosk. """
|
||||||
if not self._check_token(token):
|
if not self._check_token(token):
|
||||||
@ -146,7 +146,7 @@ class HrExpenseKioskController(http.Controller):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
return {'status': 'error', 'message': str(e)}
|
return {'status': 'error', 'message': str(e)}
|
||||||
|
|
||||||
@http.route('/hr_expense/kiosk_submit_new_expense/<string:token>', type='json', auth='public')
|
@http.route('/hr_expense/kiosk_submit_new_expense/<string:token>', type='jsonrpc', auth='public')
|
||||||
def submit_new_expense(self, token, employee_id, product_id, amount, description, payment_mode=None, image_base64=None):
|
def submit_new_expense(self, token, employee_id, product_id, amount, description, payment_mode=None, image_base64=None):
|
||||||
""" Creates a new expense (e.g. out of pocket) from the kiosk. """
|
""" Creates a new expense (e.g. out of pocket) from the kiosk. """
|
||||||
if not self._check_token(token):
|
if not self._check_token(token):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user