Commit 243a4bed authored by Jérome Perrin's avatar Jérome Perrin

Allow to set a different quantity on an event

parent b24039c3
......@@ -135,12 +135,10 @@ class Event(EmailDocument, Movement, AcknowledgeableMixin):
security.declareProtected(Permissions.AccessContentsInformation,
'getQuantity')
def getQuantity(self):
def getQuantity(self, default=1.):
"""Quantity is by default 1.0 on events.
"""
Quantity is set automatically on Events.
"""
# Provide opportunity to script this
return 1.
return self._baseGetQuantity(default)
security.declareProtected(Permissions.AccessContentsInformation,
'getExplanationValue')
......
......@@ -87,6 +87,17 @@ class TestCRM(BaseTestCRM):
'erp5_ingestion',
'erp5_crm',)
def test_Event_getQuantity(self):
event_module = self.portal.event_module
for portal_type in self.portal.getPortalEventTypeList():
event = event_module.newContent(portal_type=portal_type)
# quantity on events is 1 by default
self.assertEquals(1, event.getQuantity())
# but it can be overriden
event.setQuantity(321)
self.assertEquals(321, event.getQuantity())
def test_Event_CreateRelatedEvent(self):
# test workflow to create a related event from responded event
event_module = self.portal.event_module
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment