helpdesk_config_settings.py 10.2 KB
Newer Older
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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
# -*- coding: utf-8 -*-
# Part of Softhealer Technologies.

from odoo import models, fields, api


class ResCompany(models.Model):
    _inherit = 'res.company'

    category = fields.Boolean('Category')
    sub_category = fields.Boolean('Sub Category')
    customer_rating = fields.Boolean('Customer Rating')
    auto_close_ticket = fields.Boolean('Auto Close Ticket')
    close_days = fields.Integer('No of Days')
    new_stage_id = fields.Many2one('helpdesk.stages', string="Draft/New Stage")
    done_stage_id = fields.Many2one('helpdesk.stages', string="Resolved Stage")
    cancel_stage_id = fields.Many2one('helpdesk.stages', string="Cancel Stage")
    allocation_mail_template_id = fields.Many2one(
        'mail.template', string='Ticket Allocation To User Mail Template')
    reply_mail_template_id = fields.Many2one(
        'mail.template', string='Ticket Reply Mail Template')
    dashboard_filter = fields.Many2many('helpdesk.stages',
                                        'rel_company_stage_counter',
                                        string="Dashbaord Filter",
                                        required=True)
    dashboard_tables = fields.Many2many('helpdesk.stages',
                                        'rel_company_stage_tables',
                                        string="Dashbaord Tables",
                                        required=True)
    reopen_stage_id = fields.Many2one('helpdesk.stages',
                                      string="Re-Opened Stage")
    close_stage_id = fields.Many2one('helpdesk.stages', string="Closed Stage")
    sh_default_team_id = fields.Many2one('helpdesk.team',
                                         string="Default Team")
    sh_default_user_id = fields.Many2one('res.users',
                                         string="Default Assign User")
    sh_display_multi_user = fields.Boolean('Display Multi Users ?')
    sh_configure_activate = fields.Boolean('Manage Products')
    sh_display_ticket_reminder = fields.Boolean('Ticket Reminder ?')
    sh_ticket_product_detail = fields.Boolean(
        "Ticket Product details in Message?", default=True)
    sh_signature = fields.Boolean("Signature?", default=True)
    sh_display_in_chatter = fields.Boolean("Display in Chatter Message?",
                                           default=True)
    sh_pdf_in_message = fields.Boolean("Send Report URL in Message?",
                                       default=True)
    sh_ticket_url_in_message = fields.Boolean("Send Ticket URL in Message?",
                                              default=True)
    sh_receive_email_seeing_ticket = fields.Boolean(
        'Get email when customer view ticket ?')
    sh_auto_add_customer_as_follower = fields.Boolean(
        'Auto add customer as follower when create ticket ?', default=True)

    sh_customer_replied = fields.Boolean(
        'Stage change when customer replied ?')

    sh_customer_replied_stage_id = fields.Many2one(
        'helpdesk.stages', string='Customer Replied Stage')

    sh_staff_replied_stage_id = fields.Many2one('helpdesk.stages',
                                                string='Staff Replied Stage')

    sh_staff_replied = fields.Boolean('Stage change when staff replied ?')
    sh_file_size = fields.Integer('Portal Attachment Size(KB)')

    access_for_everyone = fields.Boolean(
        string='Access For Everyone')

class HelpdeskSettings(models.TransientModel):
    _inherit = 'res.config.settings'

    access_for_everyone = fields.Boolean(
        string='Portal View Ticket with Access Token',
        related='company_id.access_for_everyone',
        readonly=False
    )

    company_id = fields.Many2one('res.company',
                                 string='Company',
                                 required=True,
                                 default=lambda self: self.env.company)
    category = fields.Boolean(string='Category',
                              related='company_id.category',
                              readonly=False)
    sub_category = fields.Boolean(string='Sub Category',
                                  related='company_id.sub_category',
                                  readonly=False)
    customer_rating = fields.Boolean(string='Customer Rating',
                                     related='company_id.customer_rating',
                                     readonly=False)
    auto_close_ticket = fields.Boolean(string='Auto Close Ticket',
                                       related='company_id.auto_close_ticket',
                                       readonly=False)
    close_days = fields.Integer(string='No of Days',
                                related='company_id.close_days',
                                readonly=False)
    new_stage_id = fields.Many2one('helpdesk.stages',
                                   string="Draft/New Stage",
                                   related='company_id.new_stage_id',
                                   readonly=False)
    done_stage_id = fields.Many2one('helpdesk.stages',
                                    string="Resolved Stage",
                                    related='company_id.done_stage_id',
                                    readonly=False)
    cancel_stage_id = fields.Many2one('helpdesk.stages',
                                      string="Cancel Stage",
                                      related='company_id.cancel_stage_id',
                                      readonly=False)
    allocation_mail_template_id = fields.Many2one(
        'mail.template',
        string='Ticket Allocation To User Mail Template',
        related='company_id.allocation_mail_template_id',
        readonly=False)
    reply_mail_template_id = fields.Many2one(
        'mail.template',
        string='Ticket Reply Mail Template',
        related='company_id.reply_mail_template_id',
        readonly=False)
    dashboard_filter = fields.Many2many('helpdesk.stages',
                                        'rel_company_stage_counter',
                                        string="Dashbaord Filter",
                                        related="company_id.dashboard_filter",
                                        readonly=False,
                                        required=True)
    dashboard_tables = fields.Many2many('helpdesk.stages',
                                        'rel_company_stage_tables',
                                        string="Dashbaord Tables",
                                        related="company_id.dashboard_tables",
                                        readonly=False,
                                        required=True)
    reopen_stage_id = fields.Many2one('helpdesk.stages',
                                      string="Re-Opened Stage",
                                      readonly=False,
                                      related='company_id.reopen_stage_id')
    close_stage_id = fields.Many2one('helpdesk.stages',
                                     string="Closed Stage",
                                     readonly=False,
                                     related='company_id.close_stage_id')
    sh_default_team_id = fields.Many2one(
        'helpdesk.team',
        string="Default Team",
        readonly=False,
        related='company_id.sh_default_team_id')
    sh_default_user_id = fields.Many2one(
        'res.users',
        string="Default Assign User",
        readonly=False,
        related='company_id.sh_default_user_id')
    sh_display_multi_user = fields.Boolean(
        'Display Multi Users ?',
        related='company_id.sh_display_multi_user',
        readonly=False)
    sh_configure_activate = fields.Boolean(
        'Manage Products',
        related='company_id.sh_configure_activate',
        readonly=False)
    sh_display_ticket_reminder = fields.Boolean(
        'Ticket Reminder ?',
        related='company_id.sh_display_ticket_reminder',
        readonly=False)
    sh_ticket_product_detail = fields.Boolean(
        "Ticket Product details in Message?",
        related='company_id.sh_ticket_product_detail',
        readonly=False)
    sh_signature = fields.Boolean("Signature?",
                                  related='company_id.sh_signature',
                                  readonly=False)
    sh_display_in_chatter = fields.Boolean(
        "Display in Chatter Message?",
        related='company_id.sh_display_in_chatter',
        readonly=False)
    sh_pdf_in_message = fields.Boolean("Send Report URL in Message?",
                                       related='company_id.sh_pdf_in_message',
                                       readonly=False)
    sh_ticket_url_in_message = fields.Boolean(
        "Send Ticket URL in Message?",
        related='company_id.sh_ticket_url_in_message',
        readonly=False)
    sh_receive_email_seeing_ticket = fields.Boolean(
        'Get email when customer view ticket ?',
        related='company_id.sh_receive_email_seeing_ticket',
        readonly=False)
    sh_auto_add_customer_as_follower = fields.Boolean(
        'Auto add customer as follower when create ticket ?',
        related='company_id.sh_auto_add_customer_as_follower',
        readonly=False)

    sh_customer_replied = fields.Boolean(
        'Stage change when customer replied ?',
        related='company_id.sh_customer_replied',
        readonly=False)

    sh_customer_replied_stage_id = fields.Many2one(
        'helpdesk.stages',
        string='Customer Replied Stage',
        related='company_id.sh_customer_replied_stage_id',
        readonly=False)
    sh_staff_replied_stage_id = fields.Many2one(
        'helpdesk.stages',
        string='Staff Replied Stage',
        related='company_id.sh_staff_replied_stage_id',
        readonly=False)

    sh_staff_replied = fields.Boolean('Stage change when staff replied ?',
                                      related='company_id.sh_staff_replied',
                                      readonly=False)
    sh_file_size = fields.Integer('Portal Attachment Size(KB)',related='company_id.sh_file_size',readonly=False)

    @api.onchange('sh_default_team_id')
    def onchange_sh_default_team_id(self):
        if self.sh_default_team_id:
            domain = {}
            domain = {
                'sh_default_user_id':
                [('id', 'in', self.sh_default_team_id.team_members.ids)]
            }
            return {'domain': domain}