Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
583 Widoki

Hi,

We need to restrict closure of helpdesk ticket to customers, the main setting is enabled but the support staff or the staff to whom the ticket is assigned can close it. I want to try doing it through record rules to restrict the closure by customers only.


Thanks & Best Regards,


Awatar
Odrzuć
Najlepsza odpowiedź

Hi,

Please refer to the code:

from odoo import models, fields, api

from odoo.exceptions import UserError


class HelpdeskTicket(models.Model):

    _inherit = 'helpdesk.ticket'


    @api.constrains('stage_id')

    def _check_close_by_customer(self):

        for ticket in self:

            if ticket.stage_id.is_close and self.env.user.has_group('base.group_user'):

                # staff/internal user trying to close

                raise UserError("Only the customer can close this ticket.")


Hope it helps.

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
kwi 25
766
1
sie 25
598
0
mar 25
1980
0
paź 24
1945
1
wrz 24
2048