Browse Source

July 17: [FIX] Bug Fixed 'odoo_website_helpdesk'

16.0
Cybrosys Technologies 3 days ago
parent
commit
36d36b5879
  1. 2
      odoo_website_helpdesk/__manifest__.py
  2. 34
      odoo_website_helpdesk/controller/website.py
  3. 5
      odoo_website_helpdesk/doc/RELEASE_NOTES.md

2
odoo_website_helpdesk/__manifest__.py

@ -21,7 +21,7 @@
############################################################################# #############################################################################
{ {
'name': "Website Helpdesk Support Ticket Management", 'name': "Website Helpdesk Support Ticket Management",
'version': '16.0.3.0.2', 'version': '16.0.3.0.3',
'category': 'Website', 'category': 'Website',
'summary': """Helpdesk Module for community""", 'summary': """Helpdesk Module for community""",
'description': 'Can create ticket from website also and can manage it from' 'description': 'Can create ticket from website also and can manage it from'

34
odoo_website_helpdesk/controller/website.py

@ -30,6 +30,7 @@ from odoo.addons.website.controllers.form import WebsiteForm
class HelpdeskProduct(http.Controller): class HelpdeskProduct(http.Controller):
"""It controls the website products and return the product.""" """It controls the website products and return the product."""
@http.route('/product', auth='public', type='json') @http.route('/product', auth='public', type='json')
def product(self): def product(self):
"""Product control function""" """Product control function"""
@ -45,6 +46,7 @@ class WebsiteFormInherit(WebsiteForm):
controller to display a list of tickets for the current user in their controller to display a list of tickets for the current user in their
portal, and overrides the website form controller's method for handling portal, and overrides the website form controller's method for handling
form submissions to create a new help desk ticket instead.""" form submissions to create a new help desk ticket instead."""
def _handle_website_form(self, model_name, **kwargs): def _handle_website_form(self, model_name, **kwargs):
"""Website Help Desk Form""" """Website Help Desk Form"""
if model_name == 'help.ticket': if model_name == 'help.ticket':
@ -56,12 +58,28 @@ class WebsiteFormInherit(WebsiteForm):
if rec == lowest_sequence: if rec == lowest_sequence:
lowest_stage_id = lowest_sequence lowest_stage_id = lowest_sequence
products = kwargs.get('product') products = kwargs.get('product')
partner_create = request.env['res.partner'].sudo().create({
'name':kwargs.get('customer_name'), # Check if user is logged in and not public user
'company_name':kwargs.get('company'), if request.env.user and request.env.user.id != request.env.ref(
'phone':kwargs.get('phone'), 'base.public_user').id:
'email':kwargs.get('email_from') partner_create = request.env.user.partner_id
}) else:
# Check if partner already exists with the same email
email = kwargs.get('email_from')
existing_partner = request.env['res.partner'].sudo().search([
('email', '=', email)
], limit=1)
if existing_partner:
partner_create = existing_partner
else:
# Create new partner only if it doesn't exist
partner_create = request.env['res.partner'].sudo().create({
'name': kwargs.get('customer_name'),
'company_name': kwargs.get('company'),
'phone': kwargs.get('phone'),
'email': kwargs.get('email_from')
})
if products: if products:
splited_product = products.split(',') splited_product = products.split(',')
product_list = [int(i) for i in splited_product] product_list = [int(i) for i in splited_product]
@ -86,7 +104,7 @@ class WebsiteFormInherit(WebsiteForm):
data = self.extract_data(model_record, request.params) data = self.extract_data(model_record, request.params)
if ('ticket_attachment' in request.params or if ('ticket_attachment' in request.params or
request.httprequest.files or data.get( request.httprequest.files or data.get(
'attachments')): 'attachments')):
attached_files = data.get('attachments') attached_files = data.get('attachments')
for attachment in attached_files: for attachment in attached_files:
attached_file = attachment.read() attached_file = attachment.read()
@ -122,7 +140,7 @@ class WebsiteFormInherit(WebsiteForm):
data = self.extract_data(model_record, request.params) data = self.extract_data(model_record, request.params)
if ('ticket_attachment' in request.params or if ('ticket_attachment' in request.params or
request.httprequest.files or data.get( request.httprequest.files or data.get(
'attachments')): 'attachments')):
attached_files = data.get('attachments') attached_files = data.get('attachments')
for attachment in attached_files: for attachment in attached_files:
attached_file = attachment.read() attached_file = attachment.read()

5
odoo_website_helpdesk/doc/RELEASE_NOTES.md

@ -15,3 +15,8 @@
#### Version 16.0.3.0.2 #### Version 16.0.3.0.2
##### UPDT ##### UPDT
-A confirmation email will be sent to the customer upon ticket creation. -A confirmation email will be sent to the customer upon ticket creation.
#### 14.07.2025
#### Version 16.0.3.0.3
##### FIX
- Tickets created was not visible for the user.

Loading…
Cancel
Save