Skip to content

Commit

Permalink
[FIX] website_event_attendee_fields: исправляем несовместимость функц…
Browse files Browse the repository at this point in the history
…ионала с portal_event_tickets

До исправления пользователь, который воспользовался функционалом Upgrade / Change ticket
не мог на себя оформить новый, т.к. всплывало сообщение, что пользователь с такой почтой уже зареган

Тут мы исключаем те регистрации, у которых есть корзина из обмениваемого тикета
  • Loading branch information
em230418 committed Dec 20, 2024
1 parent dfffc57 commit 48d14fe
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions website_event_attendee_fields/models/event_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,27 @@ def partner_is_participating(self, partner_id):
]
)
)

SaleOrderLine = self.env["sale.order.line"].sudo()
if "refund_source_line_id" in SaleOrderLine._fields:
# special case, when using portal_event_tickets
# User starts upgrading ticket
# Ticket that is being upgraded must be excluded from search
# That ticket is marked as refund in cart

currently_refunding_order_lines = SaleOrderLine.search(
[
(
"refund_source_line_id",
"in",
registration.sale_order_line_id.ids,
),
("state", "in", ("draft",)),
]
).refund_source_line_id

registration = registration.filtered(
lambda x: x.sale_order_line_id not in currently_refunding_order_lines
)

return registration

0 comments on commit 48d14fe

Please sign in to comment.