From 2b0587fb52bf50d303e3a99ae8aded942ccb69b1 Mon Sep 17 00:00:00 2001
From: "Thomas Josse (thjo)" <thjo@odoo.com>
Date: Thu, 20 Oct 2022 13:46:44 +0000
Subject: [PATCH] [FIX] event_sale: remove 'need to be paid' banner for free
 ticket
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This commit fixes an issue where if a ticket is free, the registration would
still "need to be paid" by the attendee.

This behavior is contradictory for a free ticket, so the attendee now has to
pay the ticket if it is not paid and is not a free ticket.

task-3012928

closes odoo/odoo#102996

Signed-off-by: Warnon Aurélien (awa) <awa@odoo.com>
---
 addons/event_sale/models/event_registration.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/addons/event_sale/models/event_registration.py b/addons/event_sale/models/event_registration.py
index 1acb6126adba..c44f4a8148d1 100644
--- a/addons/event_sale/models/event_registration.py
+++ b/addons/event_sale/models/event_registration.py
@@ -128,6 +128,6 @@ class EventRegistration(models.Model):
         res.update({
             'payment_status': self.payment_status,
             'payment_status_value': dict(self._fields['payment_status']._description_selection(self.env))[self.payment_status],
-            'has_to_pay': not self.is_paid,
+            'has_to_pay': self.payment_status == 'to_pay',
         })
         return res
-- 
GitLab