[ADD] base_ical

This commit is contained in:
Holger Brunn
2023-07-10 21:17:17 +02:00
committed by fkantelberg
parent 35dbc22d7e
commit 1e6b6ceda7
28 changed files with 1162 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
# Copyright 2023 Hunki Enterprises BV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0)
from odoo import http
class MyController(http.Controller):
@http.route(
"/base_ical/<string:token>",
auth="public",
csrf=False,
methods=["GET"],
type="http",
)
def get_ical(self, token):
# TODO: respect if-modified-since headers
token = (
http.request.env["base.ical.token"].sudo().search([("token", "=", token)])
)
if not token:
return http.request.not_found()
response = http.request.make_response(
token.ical_id.with_user(token.user_id)._get_ical(),
headers={"content-type": "text/calendar"},
)
return response