feat: Add public API endpoint /api/loyalty/branches to retrieve company branch details.
This commit is contained in:
parent
b1eb7fb39a
commit
e5077a2319
@ -32,3 +32,18 @@ class AppNotificationController(http.Controller):
|
||||
'status': 'success',
|
||||
'data': notifications
|
||||
}
|
||||
|
||||
@http.route('/api/loyalty/branches', type='json', auth='public', methods=['POST'], csrf=False)
|
||||
def fetch_branches(self, **kw):
|
||||
"""
|
||||
Public endpoint for the Flutter app to get branches without exposing API keys.
|
||||
"""
|
||||
try:
|
||||
branches = request.env['res.company'].sudo().search_read(
|
||||
[('parent_id', '!=', False)],
|
||||
['name', 'street', 'city', 'phone'],
|
||||
limit=50
|
||||
)
|
||||
return {'status': 'success', 'data': branches}
|
||||
except Exception as e:
|
||||
return {'status': 'error', 'message': str(e)}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user