from odoo import http
from odoo.http import request

class Dine360OnlineOrders(http.Controller):

    @http.route('/shop/update_service_mode', type='json', auth="public", website=True)
    def update_service_mode(self, service_mode, **post):
        order = request.website.sale_get_order()
        if order and service_mode in ['pickup', 'delivery', 'dine_in']:
            order.sudo().write({
                'fulfilment_type': service_mode,
                'order_source': 'online'
            })
        return True
