From 54e8a81809d4555be898eb02fd74327ec7678207 Mon Sep 17 00:00:00 2001 From: Patrick Hoste Date: Thu, 26 Nov 2020 15:11:51 +0000 Subject: [PATCH] [FIX] event_sale: correctly use event_ok instead of event_id for event-based SO lines When confirming a sale.order that includes a product that is either an event registration or an event stand it shows the event edit registration wizard which has no sense for the event stand part. Fix the event_configurator_tour since the autocomplete showed the wrong product at the first place. The test was based on the event_id field of the sale.order.line but should be based on the event_ok field instead. Also add more text to the tour so the autocomplete shows the right product at first place. LINKS Task ID-2318655 Task ID-2558875 PR odoo/odoo#71787 --- addons/event_sale/models/sale_order.py | 4 ++-- addons/event_sale/static/tests/tours/event_configurator_ui.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/event_sale/models/sale_order.py b/addons/event_sale/models/sale_order.py index 57d9c3ad140..9f94ca70e19 100644 --- a/addons/event_sale/models/sale_order.py +++ b/addons/event_sale/models/sale_order.py @@ -23,7 +23,7 @@ class SaleOrder(models.Model): for so in self: # confirm registration if it was free (otherwise it will be confirmed once invoice fully paid) so.order_line._update_registrations(confirm=so.amount_total == 0, cancel_to_draft=False) - if any(line.event_id for line in so.order_line): + if any(line.event_ok for line in so.order_line): return self.env['ir.actions.act_window'] \ .with_context(default_sale_order_id=so.id) \ ._for_xml_id('event_sale.action_sale_order_event_registration') @@ -74,7 +74,7 @@ class SaleOrderLine(models.Model): RegistrationSudo = self.env['event.registration'].sudo() registrations = RegistrationSudo.search([('sale_order_line_id', 'in', self.ids)]) registrations_vals = [] - for so_line in self.filtered('event_id'): + for so_line in self.filtered('event_ok'): existing_registrations = registrations.filtered(lambda self: self.sale_order_line_id.id == so_line.id) if confirm: existing_registrations.filtered(lambda self: self.state not in ['open', 'cancel']).action_confirm() diff --git a/addons/event_sale/static/tests/tours/event_configurator_ui.js b/addons/event_sale/static/tests/tours/event_configurator_ui.js index a7419871bbe..26ea664e804 100644 --- a/addons/event_sale/static/tests/tours/event_configurator_ui.js +++ b/addons/event_sale/static/tests/tours/event_configurator_ui.js @@ -20,7 +20,7 @@ tour.register('event_configurator_tour', { }, { trigger: 'div[name="product_id"] input, div[name="product_template_id"] input', run: function (actions) { - actions.text('Event'); + actions.text('Event Registration'); } }, { trigger: 'ul.ui-autocomplete a:contains("Event")',