fix: prepend absolute base URL to rating links using new helper method in helpdesk ticket
This commit is contained in:
parent
d360565e4d
commit
7efc02a656
@ -41,31 +41,31 @@
|
||||
<table style="width:100%; text-align:center; margin-top: 1rem;">
|
||||
<tr>
|
||||
<td style="padding: 0 8px;">
|
||||
<a t-attf-href="/rating/{{ access_token }}/1" style="text-decoration: none; font-size: 48px; color: #FFD700; display: inline-block; transition: transform 0.2s;">
|
||||
<a t-attf-href="{{ object.get_base_url() }}/rating/{{ access_token }}/1" style="text-decoration: none; font-size: 48px; color: #FFD700; display: inline-block; transition: transform 0.2s;">
|
||||
★
|
||||
</a>
|
||||
<div style="font-size: 11px; color: #666; margin-top: 4px;">Poor</div>
|
||||
</td>
|
||||
<td style="padding: 0 8px;">
|
||||
<a t-attf-href="/rating/{{ access_token }}/2" style="text-decoration: none; font-size: 48px; color: #FFD700; display: inline-block; transition: transform 0.2s;">
|
||||
<a t-attf-href="{{ object.get_base_url() }}/rating/{{ access_token }}/2" style="text-decoration: none; font-size: 48px; color: #FFD700; display: inline-block; transition: transform 0.2s;">
|
||||
★
|
||||
</a>
|
||||
<div style="font-size: 11px; color: #666; margin-top: 4px;">Fair</div>
|
||||
</td>
|
||||
<td style="padding: 0 8px;">
|
||||
<a t-attf-href="/rating/{{ access_token }}/3" style="text-decoration: none; font-size: 48px; color: #FFD700; display: inline-block; transition: transform 0.2s;">
|
||||
<a t-attf-href="{{ object.get_base_url() }}/rating/{{ access_token }}/3" style="text-decoration: none; font-size: 48px; color: #FFD700; display: inline-block; transition: transform 0.2s;">
|
||||
★
|
||||
</a>
|
||||
<div style="font-size: 11px; color: #666; margin-top: 4px;">Good</div>
|
||||
</td>
|
||||
<td style="padding: 0 8px;">
|
||||
<a t-attf-href="/rating/{{ access_token }}/4" style="text-decoration: none; font-size: 48px; color: #FFD700; display: inline-block; transition: transform 0.2s;">
|
||||
<a t-attf-href="{{ object.get_base_url() }}/rating/{{ access_token }}/4" style="text-decoration: none; font-size: 48px; color: #FFD700; display: inline-block; transition: transform 0.2s;">
|
||||
★
|
||||
</a>
|
||||
<div style="font-size: 11px; color: #666; margin-top: 4px;">Very Good</div>
|
||||
</td>
|
||||
<td style="padding: 0 8px;">
|
||||
<a t-attf-href="/rating/{{ access_token }}/5" style="text-decoration: none; font-size: 48px; color: #FFD700; display: inline-block; transition: transform 0.2s;">
|
||||
<a t-attf-href="{{ object.get_base_url() }}/rating/{{ access_token }}/5" style="text-decoration: none; font-size: 48px; color: #FFD700; display: inline-block; transition: transform 0.2s;">
|
||||
★
|
||||
</a>
|
||||
<div style="font-size: 11px; color: #666; margin-top: 4px;">Excellent</div>
|
||||
|
||||
@ -12,6 +12,18 @@ class HelpdeskTicket(models.Model):
|
||||
help='HTML representation of rating stars'
|
||||
)
|
||||
|
||||
def get_base_url(self):
|
||||
"""
|
||||
Returns the base URL for the current record, prioritizing the domain
|
||||
of the website associated with the helpdesk team.
|
||||
"""
|
||||
self.ensure_one()
|
||||
# Check if website_id exists on team_id (added by website_helpdesk)
|
||||
# and if it has a domain configured.
|
||||
if 'website_id' in self.team_id._fields and self.team_id.website_id.domain:
|
||||
return self.team_id.website_id.domain.rstrip('/')
|
||||
return super().get_base_url()
|
||||
|
||||
@api.depends('rating_ids', 'rating_ids.rating', 'rating_ids.create_date', 'rating_count')
|
||||
def _compute_rating_stars_html(self):
|
||||
"""Compute HTML representation of rating stars"""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user