diff options
| author | Thibault Delavallée <tde@odoo.com> | 2020-03-31 09:43:09 +0000 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2020-04-03 11:07:55 +0000 |
| commit | d2840a0519725c8d55cafe9e2b91ebbfe515c804 (patch) | |
| tree | afb4de9be079586baa802e7e8d16a46220efce8c /addons/event/tests/test_event_internals.py | |
| parent | 55c8367ce7d6801d4af3dc813c63eafa4725657e (diff) | |
[FIX] event: include timezoned event date_end in registration open computation
Purpose of this commit is to try to lessen random conditions being concatenated
in templates by correctly computing event_registrations_open field that is
now correctly based on
* event.date_end -> if event is done, registrations are not open anymore;
* event.start_sale_date -> lowest start date of tickets (if any; start_sale_date
is False if no ticket are defined, see _compute_start_sale_date);
* any ticket is available for sale (seats available) if any;
* seats are unlimited or seats are available;
Some better timezone computation is included even if it could be done better.
Task ID 2228189
Community PR odoo/odoo#48652
X-original-commit: a11af9074499465b6dd8ad1400e60c7af96e21c7
Diffstat (limited to 'addons/event/tests/test_event_internals.py')
| -rw-r--r-- | addons/event/tests/test_event_internals.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/addons/event/tests/test_event_internals.py b/addons/event/tests/test_event_internals.py index 862f19aaddf..51dd7c33258 100644 --- a/addons/event/tests/test_event_internals.py +++ b/addons/event/tests/test_event_internals.py @@ -157,6 +157,14 @@ class TestEventData(TestEventCommon): def test_event_registrable(self): """Test if `_compute_event_registrations_open` works properly.""" event = self.event_0.with_user(self.env.user) + event.write({ + 'date_begin': datetime(2020, 1, 30, 8, 0, 0), + 'date_end': datetime(2020, 1, 31, 8, 0, 0), + }) + self.assertFalse(event.event_registrations_open) + event.write({ + 'date_end': datetime(2020, 2, 4, 8, 0, 0), + }) self.assertTrue(event.event_registrations_open) # ticket without dates boundaries -> ok |
