main.py 1.91 KB
Newer Older
Arturo Jasso Origel committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
# -*- coding: utf-8 -*-
# Part of Softhealer Technologies.

from odoo import http, _
from odoo.http import request, content_disposition
import json
from datetime import datetime
from dateutil.relativedelta import relativedelta
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
import re
from odoo.exceptions import AccessError, MissingError, UserError
from odoo.addons.sh_all_in_one_helpdesk.controllers.main import DownloadReport

import logging
_logger = logging.getLogger(__name__)



class WebsiteTickets(DownloadReport):

    @http.route('/helpdesk/ticket/feedback/<ticket_id>', type="http", auth="public", website=True, csrf=False)
    def helpdesk_ticket_feedback_thanks(self, ticket_id, **kw):
        dic = {}
        if kw.get('problem_solved') == 'True':
            dic.update({
                'problem_solved_on_time':True
            })
        else:
            dic.update({
                'problem_solved_on_time':False
            })

        if kw.get('good_actitude') == 'True':
            dic.update({
                'good_service_actitude':True
            })
        else:
            dic.update({
                'good_service_actitude':False
            })
        
        if kw.get('soon_attention') == 'True':
            dic.update({
                'begin_before_ten_min':True
            })
        else:
            dic.update({
                'begin_before_ten_min':False
            })
        if kw.get('smiley') != '':
            dic.update({
                'priority_new': kw.get('smiley'),
            })
        if kw.get('comment') != '':
            dic.update({
                'customer_comment': kw.get('comment'),
            })
        ticket = request.env['helpdesk.ticket'].sudo().search(
            [('id', '=', int(ticket_id))], limit=1)
        if ticket:
            ticket.sudo().write(dic)
        return http.request.render(
            'sh_all_in_one_helpdesk.ticket_feedback_thank_you', {})