Commit 7bf59d6f authored by Nicolas Wavrant's avatar Nicolas Wavrant

erp5_corporate_identity: get latest Letter Post for the Letter's preview

parent 74e43c89
if context.getSimulationState() in ('started', 'stop', 'delivered') \
and context.getAggregate(portal_type='Letter Post') is not None:
# Get the latest Letter Post, in case the Letter was sent
# more than once. We can load objects into memory, as this case must be
# extremeley rare
return sorted(
context.getAggregateValueList(portal_type='Letter Post'),
key=lambda x:x.getCreationDate()
)[-1].absolute_url() + "/getData"
return context.getTextContent()
<?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>Letter_renderForPreview</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -11,6 +11,7 @@
<value>
<list>
<string>default</string>
<string>enabled</string>
<string>renderjs_extra</string>
<string>title</string>
</list>
......@@ -56,6 +57,12 @@
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>enabled</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string></string> </value>
......@@ -67,7 +74,7 @@
<item>
<key> <string>renderjs_extra</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
<item>
......@@ -85,6 +92,10 @@
<key> <string>default</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>field_id</string> </key>
<value> <string>my_view_mode_text_content</string> </value>
......@@ -117,7 +128,7 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: context.Letter_getPredecessor(context_url=context.getRelativeUrl()).absolute_url()+\'/getData\'</string> </value>
<value> <string>python: here.Letter_renderForPreview()</string> </value>
</item>
</dictionary>
</pickle>
......@@ -130,7 +141,20 @@
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: context.Letter_getRenderJSExtraPreviewParameterList(context_url=context.getRelativeUrl())</string> </value>
<value> <string>python: here.getAggregate(portal_type="Letter Post")</string> </value>
</item>
</dictionary>
</pickle>
</record>
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="TALESMethod" module="Products.Formulator.TALESField"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_text</string> </key>
<value> <string>python: [(\'editor\', here.getAggregateValue(portal_type=\'Letter Post\', default=context).Base_getEditorFieldPreferredTextEditor()), (\'maximize\', True)]</string> </value>
</item>
</dictionary>
</pickle>
......
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