| 1 |
from odoo import http |
| 2 |
from odoo.http import request |
| 3 |
|
| 4 |
|
| 5 |
class NemhandelWebhookController(http.Controller): |
| 6 |
|
| 7 |
@http.route( |
| 8 |
'/nemhandel/webhook/new-message', |
| 9 |
type='http', |
| 10 |
auth='public', |
| 11 |
methods=['POST'], |
| 12 |
csrf=False, |
| 13 |
) |
| 14 |
def webhook_nemhandel_new_message(self, token): |
| 15 |
edi_client = request.env['account_edi_proxy_client.user']._get_nemhandel_user_from_token(token, url=request.httprequest.url) |
| 16 |
|
| 17 |
cron = request.env.ref( |
| 18 |
'l10n_dk_nemhandel.ir_cron_nemhandel_get_new_documents', |
| 19 |
raise_if_not_found=False, |
| 20 |
) |
| 21 |
if edi_client and cron: |
| 22 |
cron.sudo()._trigger() |
| 23 |
|
| 24 |
return http.Response(status=204) |
| 25 |
|
| 26 |
@http.route( |
| 27 |
'/nemhandel/webhook/message-state-update', |
| 28 |
type='http', |
| 29 |
auth='public', |
| 30 |
methods=['POST'], |
| 31 |
csrf=False, |
| 32 |
) |
| 33 |
def webhook_nemhandel_message_update(self, token): |
| 34 |
edi_client = request.env['account_edi_proxy_client.user']._get_nemhandel_user_from_token(token, url=request.httprequest.url) |
| 35 |
|
| 36 |
cron = request.env.ref( |
| 37 |
'l10n_dk_nemhandel.ir_cron_nemhandel_get_message_status', |
| 38 |
raise_if_not_found=False, |
| 39 |
) |
| 40 |
if edi_client and cron: |
| 41 |
cron.sudo()._trigger() |
| 42 |
|
| 43 |
return http.Response(status=204) |
| 44 |
|
| 45 |
@http.route( |
| 46 |
'/nemhandel/webhook/user-state-update', |
| 47 |
type='http', |
| 48 |
auth='public', |
| 49 |
methods=['POST'], |
| 50 |
csrf=False, |
| 51 |
) |
| 52 |
def webhook_nemhandel_user_update(self, token): |
| 53 |
edi_client = request.env['account_edi_proxy_client.user']._get_nemhandel_user_from_token(token, url=request.httprequest.url) |
| 54 |
|
| 55 |
cron = request.env.ref( |
| 56 |
'l10n_dk_nemhandel.ir_cron_nemhandel_get_participant_status', |
| 57 |
raise_if_not_found=False, |
| 58 |
) |
| 59 |
if edi_client and cron: |
| 60 |
cron.sudo()._trigger() |
| 61 |
|
| 62 |
return http.Response(status=204) |