Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion portal_event_tickets/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"summary": """Allows to customers see their tickets for events at the Portal""",
"category": "Marketing",
"images": ["images/banner.jpg"],
"version": "17.0.1.1.0",
"version": "17.0.2.0.0",
"author": "IT-Projects LLC",
"support": "[email protected]",
"website": "https://github.com/it-projects-llc/website-addons",
Expand Down
29 changes: 19 additions & 10 deletions portal_event_tickets/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def account(self, *args, **kw):
return response

@http.route(
["/my/tickets", "/my/tickets/page/<int:page>"],
["/my/registrations", "/my/registrations/page/<int:page>"],
type="http",
auth="user",
website=True,
Expand All @@ -64,7 +64,7 @@ def portal_my_tickets(self, page=1, date_begin=None, date_end=None, **kw):
ticket_count = Registration.search_count(domain)
# make pager
pager = request.website.pager(
url="/my/tickets",
url="/my/registrations",
url_args={"date_begin": date_begin, "date_end": date_end},
total=ticket_count,
page=page,
Expand All @@ -80,7 +80,7 @@ def portal_my_tickets(self, page=1, date_begin=None, date_end=None, **kw):
"page_name": "tickets",
"tickets": tickets,
"pager": pager,
"default_url": "/my/tickets",
"default_url": "/my/registrations",
}
)
return request.render("portal_event_tickets.portal_my_tickets", values)
Expand Down Expand Up @@ -120,7 +120,9 @@ def _has_ticket_access(self, ticket, to_update=False):

return env.user.has_group("event.group_event_manager")

@http.route(["/my/tickets/<int:ticket>"], type="http", auth="user", website=True)
@http.route(
["/my/registrations/<int:ticket>"], type="http", auth="user", website=True
)
def ticket_page(self, ticket=None, **kw):
values = self._prepare_portal_layout_values()
ticket = request.env["event.registration"].browse(ticket)
Expand All @@ -135,7 +137,10 @@ def ticket_page(self, ticket=None, **kw):
return request.render("portal_event_tickets.portal_ticket_page", values)

@http.route(
["/my/tickets/pdf/<int:ticket_id>"], type="http", auth="user", website=True
["/my/registrations/pdf/<int:ticket_id>"],
type="http",
auth="user",
website=True,
)
def portal_get_ticket(self, ticket_id=None, **kw):
ticket = request.env["event.registration"].browse(ticket_id)
Expand Down Expand Up @@ -165,7 +170,7 @@ def portal_get_ticket(self, ticket_id=None, **kw):
return request.make_response(pdf, headers=pdfhttpheaders)

@http.route(
["/my/tickets/transfer"],
["/my/registrations/transfer"],
type="http",
auth="user",
methods=["GET"],
Expand All @@ -181,7 +186,7 @@ def ticket_transfer_editor(self, **kw):
return request.render("portal_event_tickets.portal_ticket_transfer", values)

@http.route(
["/my/tickets/transfer"],
["/my/registrations/transfer"],
type="http",
auth="user",
methods=["POST"],
Expand Down Expand Up @@ -238,7 +243,7 @@ def _ticket_transfer(self, env, to_email, ticket_id):
return error

@http.route(
["/my/tickets/transfer/receive"],
["/my/registrations/transfer/receive"],
type="http",
auth="user",
methods=["GET", "POST"],
Expand Down Expand Up @@ -312,10 +317,14 @@ def ticket_transfer_receive(self, transfer_ticket=None, **kw):
receiver.sudo().write(partner_vals)

ticket.sudo().transferring_finished()
return request.redirect("/my/tickets")
return request.redirect("/my/registrations")

@http.route(
["/my/tickets/change"], type="http", auth="user", methods=["POST"], website=True
["/my/registrations/change"],
type="http",
auth="user",
methods=["POST"],
website=True,
)
def ticket_change(self, ticket_id, **kw):
ticket = request.env["event.registration"].browse(int(ticket_id))
Expand Down
2 changes: 1 addition & 1 deletion portal_event_tickets/data/mail_template_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

<div style="padding:0px;width:600px;margin:auto;background: #FFFFFF repeat top /100%;color:#777777">
<div style="text-align: center; margin-top: 16px;">
<a t-attf-href="/my/tickets/transfer/receive?transfer_ticket={{ object.id }}" style="padding: 5px 10px; font-size: 12px; line-height: 18px; color: #FFFFFF; border-color:#875A7B; text-decoration: none; display: inline-block; margin-bottom: 0px; font-weight: 400; text-align: center; vertical-align: middle; cursor: pointer; white-space: nowrap; background-image: none; background-color: #875A7B; border: 1px solid #875A7B; border-radius:3px">Finish ticket transferring</a>
<a t-attf-href="/my/registrations/transfer/receive?transfer_ticket={{ object.id }}" style="padding: 5px 10px; font-size: 12px; line-height: 18px; color: #FFFFFF; border-color:#875A7B; text-decoration: none; display: inline-block; margin-bottom: 0px; font-weight: 400; text-align: center; vertical-align: middle; cursor: pointer; white-space: nowrap; background-image: none; background-color: #875A7B; border: 1px solid #875A7B; border-radius:3px">Finish ticket transferring</a>
</div>
</div>
</p>
Expand Down
2 changes: 1 addition & 1 deletion portal_event_tickets/i18n/portal_event_tickets.pot
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ msgid "\n"
"\n"
" <div style=\"padding:0px;width:600px;margin:auto;background: #FFFFFF repeat top /100%;color:#777777\">\n"
" <div style=\"text-align: center; margin-top: 16px;\">\n"
" <a href=\"/my/tickets/transfer/receive?transfer_ticket=${object.id}\" style=\"padding: 5px 10px; font-size: 12px; line-height: 18px; color: #FFFFFF; border-color:#875A7B; text-decoration: none; display: inline-block; margin-bottom: 0px; font-weight: 400; text-align: center; vertical-align: middle; cursor: pointer; white-space: nowrap; background-image: none; background-color: #875A7B; border: 1px solid #875A7B; border-radius:3px\">Finish ticket transferring</a>\n"
" <a href=\"/my/registrations/transfer/receive?transfer_ticket=${object.id}\" style=\"padding: 5px 10px; font-size: 12px; line-height: 18px; color: #FFFFFF; border-color:#875A7B; text-decoration: none; display: inline-block; margin-bottom: 0px; font-weight: 400; text-align: center; vertical-align: middle; cursor: pointer; white-space: nowrap; background-image: none; background-color: #875A7B; border: 1px solid #875A7B; border-radius:3px\">Finish ticket transferring</a>\n"
" </div>\n"
" </div>\n"
" You \n"
Expand Down
2 changes: 1 addition & 1 deletion portal_event_tickets/static/src/js/portal.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ publicWidget.registry.TransferTicketWidget = publicWidget.Widget.extend({
const $modal = $("#modal_attendees_registration");

/* Show form inline */
$modal.find("form").attr("action", "/my/tickets/transfer/receive");
$modal.find("form").attr("action", "/my/registrations/transfer/receive");
$modal.removeClass("modal fade");

/* Remove Cancel button; update title */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {registry} from "@web/core/registry";

registry.category("web_tour.tours").add("ticket_transfer_receive", {
test: true,
url: "/my/tickets/transfer/receive",
url: "/my/registrations/transfer/receive",
steps: () => [
{
content: "Fill attendees details",
Expand All @@ -20,7 +20,7 @@ registry.category("web_tour.tours").add("ticket_transfer_receive", {
trigger: 'button:contains("Confirm")',
},
{
content: "We are redirected to /my/tickets page",
content: "We are redirected to /my/registrations page",
trigger: ".breadcrumb-item:contains(Tickets)",
run: function () {
// It's needed to don't make a click on the link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import wsTourUtils from "@website_sale/js/tours/tour_utils";

registry.category("web_tour.tours").add("portal_event_tickets.ticket_upgrade_tour", {
test: true,
url: "/my/tickets",
url: "/my/registrations",
steps: () => [
{
content: "Choose first ticket",
Expand Down
4 changes: 3 additions & 1 deletion portal_event_tickets/tests/test_ticket_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ def test_ticket_access_pdf(self):
login = self.user_portal1.login
self.authenticate(login, login)

r = self.url_open(f"/my/tickets/pdf/{self.ticket1.id}", allow_redirects=False)
r = self.url_open(
f"/my/registrations/pdf/{self.ticket1.id}", allow_redirects=False
)
self.assertEqual(r.status_code, 200)
2 changes: 1 addition & 1 deletion portal_event_tickets/tests/test_ticket_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def test_ticket_upgrade(self):
self.assertEqual(len(reg), 1, "Unexpected behavior")

self.start_tour(
"/my/tickets",
"/my/registrations",
"portal_event_tickets.ticket_upgrade_tour",
login="portal",
step_delay=500,
Expand Down
22 changes: 15 additions & 7 deletions portal_event_tickets/views/portal_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<t t-if="ticket">
<a
t-if="ticket"
t-attf-href="/my/tickets?{{ keep_query() }}"
t-attf-href="/my/registrations?{{ keep_query() }}"
>Tickets
</a>
/ Ticket #
Expand All @@ -45,7 +45,7 @@
<xpath expr="//div[@id='portal_client_category']" position="inside">
<t t-call="portal.portal_docs_entry">
<t t-set="title">Tickets</t>
<t t-set="url" t-value="'/my/tickets'" />
<t t-set="url" t-value="'/my/registrations'" />
<t t-set="text">View your tickets</t>
<t
t-set="icon"
Expand Down Expand Up @@ -75,13 +75,15 @@
<td>
<a
class="ticket-id"
t-attf-href="/my/tickets/#{ticket.id}?#{keep_query()}"
t-attf-href="/my/registrations/#{ticket.id}?#{keep_query()}"
>#
<t t-esc="ticket.id" />
</a>
</td>
<td>
<a t-attf-href="/my/tickets/#{ticket.id}?#{keep_query()}">
<a
t-attf-href="/my/registrations/#{ticket.id}?#{keep_query()}"
>
<t t-esc="ticket.event_id.display_name" />
</a>
</td>
Expand Down Expand Up @@ -144,7 +146,7 @@
Upgrade / Change ticket
</a>
<a
t-attf-href="/my/tickets/pdf/#{ticket.id}"
t-attf-href="/my/registrations/pdf/#{ticket.id}"
class="btn btn-secondary d-block btn-block mb8"
>
<i class="fa fa-print" />
Expand Down Expand Up @@ -184,7 +186,10 @@
>
<div class="modal-dialog" role="document">
<div class="modal-content">
<form t-attf-action="/my/tickets/transfer" method="post">
<form
t-attf-action="/my/registrations/transfer"
method="post"
>
<input
type="hidden"
name="csrf_token"
Expand Down Expand Up @@ -253,7 +258,10 @@
>
<div class="modal-dialog" role="document">
<div class="modal-content">
<form t-attf-action="/my/tickets/change" method="post">
<form
t-attf-action="/my/registrations/change"
method="post"
>
<input
type="hidden"
name="csrf_token"
Expand Down