Merge pull request #4726 from expsa/ENS-3756

[IMP] odex_mobile: store fcm token endpoint
This commit is contained in:
abdurrahman-saber 2025-09-22 11:29:46 +03:00 committed by GitHub
commit 4b9a335bc8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 0 deletions

View File

@ -12,3 +12,4 @@ from . import employee_other_request
from . import content_common from . import content_common
from . import official_mission from . import official_mission
from . import atendance_register from . import atendance_register
from . import fcm

View File

@ -0,0 +1,17 @@
from odoo import http
from odoo.http import request
class FcmController(http.Controller):
@http.route('/fcm/update', type='json', auth="public", website=True)
def update_fcm_token(self, **kw):
partner_id = kw.get('partner_id')
fcm_token = kw.get('token')
try:
if partner_id and fcm_token and len(fcm_token):
request.env['res.partner'].search([('id', '=', int(partner_id))]).write({'fcm_token': fcm_token})
except Exception:
return False
return True