PURPOSE This new module adds a booths management capabilities to the event module. The event manager will be able to manage booking to physical booths hosted at his event by first creating several booths categories depending for example on the booths size, the number of tables, extra services, ... He will then create the actual booths to offer to the final users. This module adds two main models : - Event Booth Category which is used to differenciate the booths type. - Event Booth which is the actual Booth that will be booked. The booking is done directly on the booth form view by setting a partner and his contact informations and by setting the booth state to unavailable. If the event manager want to book a booth for later use he can set the state to unavailable without setting a partner. The booking of a booth will be displayed in the chatter of the related event to ease the event manager overview The user manager can use event template to adds booths by default when setting the template to an event. LINKS Task-2318655 Closes : odoo/odoo#71104
57 lines
2.4 KiB
Python
57 lines
2.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from datetime import datetime, timedelta
|
|
|
|
from odoo.addons.event_booth.tests.common import TestEventBoothCommon
|
|
from odoo.fields import Datetime as FieldsDatetime
|
|
from odoo.tests.common import users
|
|
|
|
|
|
class TestEventData(TestEventBoothCommon):
|
|
|
|
@users('user_eventmanager')
|
|
def test_event_booth_contact(self):
|
|
""" Test contact details computation """
|
|
customer = self.env['res.partner'].browse(self.event_customer.ids)
|
|
category = self.env['event.booth.category'].browse(self.event_booth_category_1.ids)
|
|
self.assertTrue(all(
|
|
bool(customer[fname])
|
|
for fname in ['name', 'email', 'country_id', 'phone']
|
|
)
|
|
)
|
|
customer_email = customer.email
|
|
|
|
event = self.env['event.event'].create({
|
|
'name': 'Event',
|
|
'date_begin': FieldsDatetime.to_string(datetime.today() + timedelta(days=1)),
|
|
'date_end': FieldsDatetime.to_string(datetime.today() + timedelta(days=15)),
|
|
'event_type_id': False,
|
|
})
|
|
self.assertEqual(event.event_booth_ids, self.env['event.booth'])
|
|
|
|
booth = self.env['event.booth'].create({
|
|
'name': 'Test Booth',
|
|
'booth_category_id': category.id,
|
|
'event_id': event.id,
|
|
'partner_id': customer.id,
|
|
})
|
|
self.assertEqual(booth.contact_name, customer.name)
|
|
self.assertEqual(booth.contact_email, customer_email)
|
|
self.assertEqual(booth.contact_phone, customer.phone)
|
|
self.assertFalse(booth.contact_mobile, 'Data has no mobile')
|
|
|
|
booth.write({
|
|
'contact_email': '"New Emails" <new.email@test.example.com',
|
|
'contact_phone': False,
|
|
})
|
|
self.assertEqual(booth.contact_email, '"New Emails" <new.email@test.example.com')
|
|
self.assertEqual(booth.contact_phone, False)
|
|
self.assertEqual(customer.email, customer_email, 'No sync from booth to partner')
|
|
|
|
# partial update of contact fields: we may end up with mixed contact information, is it a good idea ?
|
|
booth.write({'partner_id': self.event_customer2.id})
|
|
self.assertEqual(booth.contact_name, customer.name)
|
|
self.assertEqual(booth.contact_email, '"New Emails" <new.email@test.example.com')
|
|
self.assertEqual(booth.contact_phone, self.event_customer2.phone)
|