Thibault Francois
4 years ago
7 changed files with 79 additions and 18 deletions
-
16beesdoo_website_shift/views/my_shift_website_templates.xml
-
1macavrac_base/__init__.py
-
2macavrac_base/__manifest__.py
-
1macavrac_base/controllers/__init__.py
-
16macavrac_base/controllers/main.py
-
10macavrac_base/models/planning.py
-
51macavrac_base/views/shift.xml
@ -1 +1,2 @@ |
|||
from . import models |
|||
from . import controllers |
@ -0,0 +1 @@ |
|||
from . import main |
@ -0,0 +1,16 @@ |
|||
|
|||
from odoo import http |
|||
from odoo.http import request |
|||
|
|||
from werkzeug.exceptions import Forbidden |
|||
|
|||
class WebsiteMacavracShiftController(http.Controller): |
|||
|
|||
@http.route("/shift/<int:shift_id>/unsubscribe", auth="user", website=True) |
|||
def unsubscribe_to_shift(self, shift_id=-1, **kw): |
|||
shift = request.env["beesdoo.shift.shift"].sudo().browse(shift_id) |
|||
# Get current user |
|||
if request.env.user.partner_id != shift.worker_id or not shift.can_unsubscribe: |
|||
raise Forbidden() |
|||
shift.worker_id = False |
|||
return request.redirect(kw["nexturl"]) |
Write
Preview
Loading…
Cancel
Save
Reference in new issue