You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							62 lines
						
					
					
						
							2.3 KiB
						
					
					
				
			
		
		
		
			
			
			
		
		
	
	
							62 lines
						
					
					
						
							2.3 KiB
						
					
					
				| # -*- coding: utf-8 -*- | |
| ############################################################################# | |
| # | |
| #    Cybrosys Technologies Pvt. Ltd. | |
| # | |
| #    Copyright (C) 2022-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | |
| #    Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) | |
| # | |
| #    You can modify it under the terms of the GNU LESSER | |
| #    GENERAL PUBLIC LICENSE (LGPL v3), Version 3. | |
| # | |
| #    This program is distributed in the hope that it will be useful, | |
| #    but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |
| #    GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. | |
| # | |
| #    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE | |
| #    (LGPL v3) along with this program. | |
| #    If not, see <http://www.gnu.org/licenses/>. | |
| # | |
| ############################################################################# | |
| 
 | |
| from odoo import http | |
| from odoo.addons.portal.controllers import portal | |
| from odoo.http import request | |
| 
 | |
| 
 | |
| class TicketPortal(portal.CustomerPortal): | |
| 
 | |
|     def _prepare_home_portal_values(self, counters): | |
|         values = super()._prepare_home_portal_values(counters) | |
|         if 'ticket_count' in counters: | |
|             ticket_count = request.env['help.ticket'].search_count( | |
|                 self._get_tickets_domain()) if request.env[ | |
|                 'help.ticket'].check_access_rights( | |
|                 'read', raise_exception=False) else 0 | |
|             values['ticket_count'] = ticket_count | |
|         return values | |
| 
 | |
|     # checking domain: | |
|     def _get_tickets_domain(self): | |
|         return [('customer_id', '=', request.env.user.partner_id.id)] | |
| 
 | |
|     @http.route(['/my/tickets'], type='http', auth="user", website=True) | |
|     def portal_my_tickets(self): | |
|         domain = self._get_tickets_domain() | |
|         tickets = request.env['help.ticket'].search(domain) | |
|         values = { | |
|             'default_url': "/my/tickets", | |
|             'tickets': tickets, | |
|             'page_name': 'ticket', | |
|         } | |
|         return request.render("odoo_website_helpdesk.portal_my_tickets", | |
|                               values) | |
| 
 | |
| 
 | |
| class WebsiteDesk(http.Controller): | |
| 
 | |
|     @http.route(['/helpdesk_ticket'], type='http', auth="public", website=True, | |
|                 sitemap=True) | |
|     def helpdesk_ticket(self, **kwargs): | |
|         return request.render('odoo_website_helpdesk.ticket_form')
 | |
| 
 |