Skip to content

Commit

Permalink
[16.0][ADD] event_sale_seat_reserve
Browse files Browse the repository at this point in the history
  • Loading branch information
ilo committed Aug 1, 2024
1 parent 8d22ee6 commit 83ddd9a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
10 changes: 9 additions & 1 deletion event_sale_seat_reserve/models/sale_order_line.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Copyright 2024 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl-3.0).

import logging
from odoo import models
from odoo.tools import config

_logger = logging.getLogger(__name__)


class SaleOrderLine(models.Model):
Expand All @@ -24,6 +27,11 @@ def _update_registrations(
registrations = RegistrationSudo.search(
[("sale_order_line_id", "in", self.ids), ("state", "=", "draft")]
)
if config["test_enable"] and not self.env.context.get("test_event_seat_reserve"):
_logger.info(
"Test mode is enabled, skipping the reservation of the seats"
)
return res
registrations.action_set_reserved()
return res

Expand Down
3 changes: 3 additions & 0 deletions event_sale_seat_reserve/tests/test_event_sale_seat_reserve.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ class TestEventSaleSeatReserve(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
test_context = cls.env.context.copy()
test_context["test_event_seat_reserve"] = True
cls.env = cls.env(context=dict(test_context, tracking_disable=True))
# ../event/data/event_demo.xml
# using this demo data, we have a max_seats = 4
# and 3 registrations
Expand Down
2 changes: 1 addition & 1 deletion test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
odoo-addon-event_seat_reserve @ git+https://github.com/OCA/event.git@refs/pull/394/head#subdirectory=event_seat_reserve
odoo-addon-event_seat_reserve @ git+https://github.com/OCA/event.git@refs/pull/394/head#subdirectory=setup/event_seat_reserve

0 comments on commit 83ddd9a

Please sign in to comment.