Commit 388636c4 authored by Georgios Dagkakis's avatar Georgios Dagkakis

erp5_calendar: Make Presence Request more user-friendly in parameterisation and appearance.

This is equivalent to work done for Leave Request, at:
185285c4
(merge_request 493)

Follow a simple / non-simple approach, like for Task and its lines.

In default case, user would need only one Presence Request Period, which can be edited directly on PresenceRequest_view. So, in this case, hide the Listbox containing the Presence Request Periods and have default_presence_request_period being created / edited on background, which will acquire quantity, resource, start_date and stop_date from what is set at the view of the Parent.
In case one or more Presence Request Period are added manually, user would get listbox with sub-objects, and editing should be done directly on them, i.e. fields like my_default_presence_request_period_start_date will be disabled fromPresenceRequest_view.
Additionally, now Presence Request has it's own:
start_date: equal to the minimum start_date of all Presence Request Periods
stop_date: equal to the maximum stop_date of all Presence Request Periods
These values are set by interaction on Presence Request Period, triggered on setStartDate, _setStopDate. This helps so that presence_request_module listbox can have sortable dates.
Commit contains also test that should make it easier to understand.
parent 199e7247
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
<portal_type id="Leave Request"> <portal_type id="Leave Request">
<item>LeaveRequest</item> <item>LeaveRequest</item>
</portal_type> </portal_type>
<portal_type id="Presence Request">
<item>PresenceRequest</item>
</portal_type>
<portal_type id="System Preference"> <portal_type id="System Preference">
<item>CalendarPreference</item> <item>CalendarPreference</item>
</portal_type> </portal_type>
......
...@@ -72,6 +72,10 @@ ...@@ -72,6 +72,10 @@
<key> <string>title</string> </key> <key> <string>title</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>type_class</string> </key>
<value> <string>PresencePeriod</string> </value>
</item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
......
...@@ -21,10 +21,10 @@ ...@@ -21,10 +21,10 @@
</chain> </chain>
<chain> <chain>
<type>Presence Request</type> <type>Presence Request</type>
<workflow>edit_workflow, presence_request_workflow</workflow> <workflow>edit_workflow, presence_request_interaction_workflow, presence_request_workflow</workflow>
</chain> </chain>
<chain> <chain>
<type>Presence Request Period</type> <type>Presence Request Period</type>
<workflow>edit_workflow</workflow> <workflow>edit_workflow, presence_request_interaction_workflow</workflow>
</chain> </chain>
</workflow_chain> </workflow_chain>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Property Sheet" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_count</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>_mt_index</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>_tree</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PresenceRequest</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Property Sheet</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="Length" module="BTrees.Length"/>
</pickle>
<pickle> <int>0</int> </pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="OOBTree" module="BTrees.OOBTree"/>
</pickle>
<pickle>
<none/>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Acquired Property" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>acquisition_accessor_id</string> </key>
<value> <string>getPresenceRequestPeriodValue</string> </value>
</item>
<item>
<key> <string>acquisition_base_category</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>acquisition_object_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>alt_accessor_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>categories</string> </key>
<value>
<tuple>
<string>elementary_type/content</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_acquired_property_id</string> </key>
<value>
<tuple>
<string>quantity</string>
<string>resource</string>
<string>start_date</string>
<string>stop_date</string>
</tuple>
</value>
</item>
<item>
<key> <string>content_portal_type</string> </key>
<value> <string>python: (\'Presence Request Period\',)</string> </value>
</item>
<item>
<key> <string>content_translation_acquired_property_id</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>The default Presence Request Period</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>presence_request_period_property</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Acquired Property</string> </value>
</item>
<item>
<key> <string>storage_id</string> </key>
<value> <string>default_presence_request_period</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -116,6 +116,14 @@ ...@@ -116,6 +116,14 @@
<string>Calendar_getDestinationSubordinationTitle</string> <string>Calendar_getDestinationSubordinationTitle</string>
<string>Organisation</string> <string>Organisation</string>
</tuple> </tuple>
<tuple>
<string>delivery.start_date</string>
<string>Start Date</string>
</tuple>
<tuple>
<string>delivery.stop_date</string>
<string>Stop Date</string>
</tuple>
<tuple> <tuple>
<string>description</string> <string>description</string>
<string>Description</string> <string>Description</string>
......
return [
x for x in context.objectIds(portal_type=("Presence Request Period"))
] in ([], ['default_presence_request_period'])
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PresenceRequest_isSimple</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -83,6 +83,7 @@ ...@@ -83,6 +83,7 @@
<list> <list>
<string>listbox_start_date</string> <string>listbox_start_date</string>
<string>listbox_stop_date</string> <string>listbox_stop_date</string>
<string>listbox_quantity</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -91,6 +92,9 @@ ...@@ -91,6 +92,9 @@
<value> <value>
<list> <list>
<string>my_title</string> <string>my_title</string>
<string>my_destination_title</string>
<string>my_default_presence_request_period_quantity</string>
<string>my_default_presence_request_period_resource</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -98,7 +102,10 @@ ...@@ -98,7 +102,10 @@
<key> <string>right</string> </key> <key> <string>right</string> </key>
<value> <value>
<list> <list>
<string>my_destination_title</string> <string>my_start_date</string>
<string>my_stop_date</string>
<string>my_default_presence_request_period_start_date</string>
<string>my_default_presence_request_period_stop_date</string>
<string>my_translated_simulation_state_title</string> <string>my_translated_simulation_state_title</string>
</list> </list>
</value> </value>
......
...@@ -10,9 +10,12 @@ ...@@ -10,9 +10,12 @@
<key> <string>delegated_list</string> </key> <key> <string>delegated_list</string> </key>
<value> <value>
<list> <list>
<string>title</string> <string>columns</string>
<string>selection_name</string> <string>editable_columns</string>
<string>enabled</string>
<string>portal_types</string> <string>portal_types</string>
<string>selection_name</string>
<string>title</string>
</list> </list>
</value> </value>
</item> </item>
...@@ -54,6 +57,12 @@ ...@@ -54,6 +57,12 @@
<key> <string>tales</string> </key> <key> <string>tales</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
...@@ -62,10 +71,22 @@ ...@@ -62,10 +71,22 @@
<key> <string>form_id</string> </key> <key> <string>form_id</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>portal_types</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>selection_name</string> </key>
<value> <string></string> </value>
</item>
<item> <item>
<key> <string>target</string> </key> <key> <string>target</string> </key>
<value> <string></string> </value> <value> <string></string> </value>
</item> </item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary> </dictionary>
</value> </value>
</item> </item>
...@@ -73,6 +94,60 @@ ...@@ -73,6 +94,60 @@
<key> <string>values</string> </key> <key> <string>values</string> </key>
<value> <value>
<dictionary> <dictionary>
<item>
<key> <string>columns</string> </key>
<value>
<list>
<tuple>
<string>int_index</string>
<string>Int Index</string>
</tuple>
<tuple>
<string>title</string>
<string>Title</string>
</tuple>
<tuple>
<string>quantity</string>
<string>Quantity</string>
</tuple>
<tuple>
<string>start_date</string>
<string>Start Date</string>
</tuple>
<tuple>
<string>stop_date</string>
<string>Stop Date</string>
</tuple>
<tuple>
<string>translated_portal_type</string>
<string>Type</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>editable_columns</string> </key>
<value>
<list>
<tuple>
<string>start_date</string>
<string>Start Date</string>
</tuple>
<tuple>
<string>stop_date</string>
<string>Stop Date</string>
</tuple>
<tuple>
<string>quantity</string>
<string>Quantity</string>
</tuple>
</list>
</value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item> <item>
<key> <string>field_id</string> </key> <key> <string>field_id</string> </key>
<value> <string>listbox</string> </value> <value> <string>listbox</string> </value>
...@@ -110,4 +185,17 @@ ...@@ -110,4 +185,17 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: not here.PresenceRequest_isSimple()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData> </ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>enabled</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_default_presence_request_period_quantity</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>extra_context</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>extra_context</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>extra_context</string> </key>
<value>
<list/>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_quantity</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Calendar_viewFieldLibrary</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.PresenceRequest_isSimple()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>delegated_list</string> </key>
<value>
<list>
<string>enabled</string>
</list>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>my_default_presence_request_period_resource</string> </value>
</item>
<item>
<key> <string>message_values</string> </key>
<value>
<dictionary>
<item>
<key> <string>external_validator_failed</string> </key>
<value> <string>The input failed the external validator.</string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>overrides</string> </key>
<value>
<dictionary>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>tales</string> </key>
<value>
<dictionary>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</value>
</item>
<item>
<key> <string>values</string> </key>
<value>
<dictionary>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_presence_resource</string> </value>
</item>
<item>
<key> <string>form_id</string> </key>
<value> <string>Calendar_viewFieldLibrary</string> </value>
</item>
<item>
<key> <string>target</string> </key>
<value> <string>Click to edit the target</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: here.PresenceRequest_isSimple()</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InteractionWorkflowDefinition" module="Products.ERP5.InteractionWorkflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>creation_guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>groups</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>presence_request_interaction_workflow</string> </value>
</item>
<item>
<key> <string>manager_bypass</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Presence Request Interaction Workflow</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Interaction" module="Products.ERP5.Interaction"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_mapping</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>interactions</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="InteractionDefinition" module="Products.ERP5.Interaction"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>actbox_category</string> </key>
<value> <string>workflow</string> </value>
</item>
<item>
<key> <string>actbox_name</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>actbox_url</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>activate_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>after_script_name</string> </key>
<value>
<list>
<string>PresenceRequestPeriod_setPresenceRequestDate</string>
</list>
</value>
</item>
<item>
<key> <string>before_commit_script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>guard</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PresenceRequestPeriod_setPresenceRequestDate</string> </value>
</item>
<item>
<key> <string>method_id</string> </key>
<value>
<list>
<string>_setStartDate</string>
<string>_setStopDate</string>
</list>
</value>
</item>
<item>
<key> <string>once_per_transaction</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>portal_type_filter</string> </key>
<value>
<list>
<string>Presence Request Period</string>
</list>
</value>
</item>
<item>
<key> <string>portal_type_group_filter</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>script_name</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>temporary_document_disallowed</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>trigger_type</string> </key>
<value> <int>2</int> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Scripts" module="Products.DCWorkflow.Scripts"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_mapping</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>scripts</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
presence_request = state_change['object'].getParentValue()
presence_request_period_list = presence_request.objectValues(
portal_type='Presence Request Period',
)
presence_request.setStartDate(
min([x.getStartDate() for x in presence_request_period_list])
)
presence_request.setStopDate(
max([x.getStopDate() for x in presence_request_period_list])
)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>PresenceRequestPeriod_setPresenceRequestDate</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Variables" module="Products.DCWorkflow.Variables"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_mapping</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>variables</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Worklists" module="Products.DCWorkflow.Worklists"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_mapping</string> </key>
<value>
<dictionary/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>worklists</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Leave Request | LeaveRequest Leave Request | LeaveRequest
Presence Request | PresenceRequest
System Preference | CalendarPreference System Preference | CalendarPreference
\ No newline at end of file
...@@ -11,5 +11,7 @@ Leave Request | edit_workflow ...@@ -11,5 +11,7 @@ Leave Request | edit_workflow
Leave Request | leave_request_interaction_workflow Leave Request | leave_request_interaction_workflow
Leave Request | leave_request_workflow Leave Request | leave_request_workflow
Presence Request Period | edit_workflow Presence Request Period | edit_workflow
Presence Request Period | presence_request_interaction_workflow
Presence Request | edit_workflow Presence Request | edit_workflow
Presence Request | presence_request_interaction_workflow
Presence Request | presence_request_workflow Presence Request | presence_request_workflow
\ No newline at end of file
LeaveRequest LeaveRequest
PresenceRequest
\ No newline at end of file
...@@ -2,4 +2,5 @@ group_calendar_interaction_workflow ...@@ -2,4 +2,5 @@ group_calendar_interaction_workflow
group_calendar_workflow group_calendar_workflow
leave_request_interaction_workflow leave_request_interaction_workflow
leave_request_workflow leave_request_workflow
presence_request_interaction_workflow
presence_request_workflow presence_request_workflow
\ No newline at end of file
...@@ -1717,6 +1717,100 @@ class TestCalendar(ERP5ReportTestCase): ...@@ -1717,6 +1717,100 @@ class TestCalendar(ERP5ReportTestCase):
self.assertEqual(leave_request.getStartDate(), default_start_date) self.assertEqual(leave_request.getStartDate(), default_start_date)
self.assertEqual(leave_request.getStopDate(), extra_stop_date) self.assertEqual(leave_request.getStopDate(), extra_stop_date)
def test_PresenceRequest_defaultPresenceRequestPeriod(self):
'''
Check check how default_presence_request_period is created and when
fields of PresenceRequest_view are visible or not
'''
default_start_date = DateTime('2018/01/01')
default_stop_date = DateTime('2018/01/03')
extra_start_date = DateTime('2018/01/05')
extra_stop_date = DateTime('2018/01/08')
default_quantity = 2.0
def checkDisplayedAsSimple():
self.assertEqual(
my_default_presence_request_period_start_date.get_value("enabled"),
True,
)
self.assertEqual(
my_default_presence_request_period_stop_date.get_value("enabled"),
True,
)
self.assertEqual(my_start_date.get_value("enabled"), False)
self.assertEqual(my_start_date.get_value("enabled"), False)
self.assertEqual(listbox.get_value("enabled"), False)
# Add a Presence Request, we should have no sub-objects and it should be
# displayed as simple (no listbox and fields to be edited on Delivery)
presence_request = self.portal.presence_request_module.newContent()
PresenceRequest_view = presence_request.PresenceRequest_view
my_default_presence_request_period_start_date = PresenceRequest_view.\
my_default_presence_request_period_start_date
my_default_presence_request_period_stop_date = PresenceRequest_view.\
my_default_presence_request_period_stop_date
my_start_date = PresenceRequest_view.my_start_date
my_stop_date = PresenceRequest_view.my_stop_date
listbox = PresenceRequest_view.listbox
checkDisplayedAsSimple()
self.assertEqual(
len(presence_request.objectValues(portal_type='Presence Request Period')), 0
)
# Edit properties, default_presence_request_period should be created, yet
# Presence Request is still displayed as simple
presence_request.edit(
default_presence_request_period_start_date=default_start_date,
default_presence_request_period_stop_date=default_stop_date,
default_presence_request_period_quantity=default_quantity,
)
checkDisplayedAsSimple()
presence_request_period_list = presence_request.objectValues(
portal_type='Presence Request Period'
)
self.assertEqual(len(presence_request_period_list), 1)
default_presence_request_period = presence_request_period_list[0]
self.assertEqual(
default_presence_request_period.getId(), 'default_presence_request_period'
)
self.assertEqual(default_presence_request_period.getStartDate(), default_start_date)
self.assertEqual(default_presence_request_period.getStopDate(), default_stop_date)
self.assertEqual(default_presence_request_period.getQuantity(), default_quantity)
self.assertEqual(presence_request.getStartDate(), default_start_date)
self.assertEqual(presence_request.getStopDate(), default_stop_date)
extra_presence_request_period = presence_request.newContent(
portal_type = 'Presence Request Period',
)
extra_presence_request_period.edit(
start_date=extra_start_date,
stop_date=extra_stop_date,
quantity=1.0,
)
self.assertEqual(
len(presence_request.objectValues(portal_type='Presence Request Period')), 2
)
# Since we have more than 1 Presence Request Periods, now we get the non-simple
# display (with listbox and not fields to be edited on Delivery)
self.assertEqual(
my_default_presence_request_period_start_date.get_value("enabled"),
False,
)
self.assertEqual(
my_default_presence_request_period_stop_date.get_value("enabled"),
False,
)
self.assertEqual(my_start_date.get_value("enabled"), True)
self.assertEqual(my_start_date.get_value("enabled"), True)
self.assertEqual(listbox.get_value("enabled"), True)
# yet, start and stop dates are not editable in Delivery level
# and they are defined by the movement values
self.assertEqual(my_start_date.get_value("editable"), 0)
self.assertEqual(my_start_date.get_value("editable"), 0)
self.assertEqual(presence_request.getStartDate(), default_start_date)
self.assertEqual(presence_request.getStopDate(), extra_stop_date)
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestCalendar)) suite.addTest(unittest.makeSuite(TestCalendar))
......
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