Browse Source

July 09: [FIX] Bug Fixed 'odoo_website_helpdesk'

pull/354/merge
Cybrosys Technologies 1 week ago
parent
commit
f2165f3a0f
  1. 37
      odoo_website_helpdesk/controller/website_form.py
  2. 14
      odoo_website_helpdesk/doc/RELEASE_NOTES.md
  3. 2
      odoo_website_helpdesk/static/description/index.html

37
odoo_website_helpdesk/controller/website_form.py

@ -68,12 +68,23 @@ class WebsiteFormInherit(WebsiteForm):
return json.dumps(
{'error': "No stage found with the lowest sequence."})
products = kwargs.get('product')
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 request.env.user and request.env.user.id != request.env.ref(
'base.public_user').id:
partner_create = request.env.user.partner_id
else:
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:
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:
split_product = products.split(',')
product_list = [int(i) for i in split_product]
@ -103,20 +114,8 @@ class WebsiteFormInherit(WebsiteForm):
'ticket_type_id': kwargs.get('ticket_type_id'),
'category_id': kwargs.get('category'),
}
ticket_id = request.env['ticket.helpdesk'].sudo().create(rec_val)
if ticket_id and partner_create.email:
request.env['mail.mail'].sudo().create({
'subject': 'Your Ticket Has Been Created',
'body_html': f"<p>Hello {partner_create.name},</p><p>Your ticket <strong>{ticket_id.name}</strong> with the subject <strong>{ticket_id.subject}</strong> has been successfully submitted. Our support team will contact you soon.</p> <p>Thank You.</p>",
'email_to': partner_create.email,
'email_from': request.env.user.email or 'support@example.com',
}).send()
ticket_id.message_post(
body="A confirmation email regarding the ticket creation has been sent to the customer.",
subject="Ticket Confirmation Email",
message_type='email',
subtype_xmlid="mail.mt_comment",
)
request.session['ticket_number'] = ticket_id.name
request.session['ticket_id'] = ticket_id.id
model_record = request.env['ir.model'].sudo().search(

14
odoo_website_helpdesk/doc/RELEASE_NOTES.md

@ -11,15 +11,7 @@
##### UPDT
-A new contact record is created upon form submission.
#### 13.05.2025
#### 05.07.2025
#### Version 18.0.1.0.2
##### UPDT
-A confirmation email will be sent to the customer upon ticket creation.
##### FIX
- Tickets created was not visible for the user.

2
odoo_website_helpdesk/static/description/index.html

@ -910,8 +910,6 @@ Website Ticket Creation
<div class="col-md-12 mb-4">
<p style="font-weight:400; font-size:16px; line-height:150%; text-align:center; color:var(--text-color-light)">Then you may see the ticket's Reference Code in the Thank You page that appears when the helpdesk ticket is generated.
</p>
<p style="font-weight:400; font-size:16px; line-height:150%; text-align:center; color:var(--text-color-light)">A confirmation email will be sent to the customer upon ticket creation.
</p>
</div>
<div class="col-md-12 text-center">
<div class="d-inline-block p-3 shadow-sm"

Loading…
Cancel
Save