Commit ed74bdee authored by Nicolas Wavrant's avatar Nicolas Wavrant

fixup! erp5_interface_post: action to export all exportable Letter Post in only one PDF document

parent 36883757
portal = context.getPortalObject()
N_ = portal.Base_translateString
letter_post_list = context.searchFolder(simulation_state='exportable')
user = portal.portal_membership.getAuthenticatedMember()
person_value = user.getUserValue()
merged_pdf_content = ""
if person_value is None:
portal.changeSkin(None)
return context.Base_redirect('view', keep_items=dict(
portal_status_message=N_("No person found for your user")))
for letter_post in letter_post_list:
letter_post = letter_post.getObject()
merged_pdf_content = portal.ERP5Site_mergePDFList([letter_post.getData(), letter_post.getData()])
letter_post.activate().export()
if person_value.getDefaultEmailText('') in ('', None):
portal.changeSkin(None)
return context.Base_redirect('view', keep_items=dict(
portal_status_message=N_("You haven't defined your email address")))
result_pdf = portal.document_module.newContent(
portal_type='PDF',
title='Impression of Letter Post',
data=merged_pdf_content,
)
context.activate(
tag=script.id,
).LetterPostModule_exportExportableLetterPostActivity(user.getId())
return result_pdf.Base_redirect()
return context.Base_redirect('view',
keep_items=dict(portal_status_message=N_("Report Started")))
portal = context.getPortalObject()
N_ = portal.Base_translateString
letter_post_list = context.searchFolder(simulation_state='exportable')
merged_pdf_content = ""
for letter_post in letter_post_list:
letter_post = letter_post.getObject()
merged_pdf_content = portal.ERP5Site_mergePDFList([merged_pdf_content, letter_post.getData()])
letter_post.activate().export()
result_pdf = portal.document_module.newContent(
portal_type='PDF',
title='Impression of Letter Post',
data=merged_pdf_content,
)
portal.portal_notifications.activate(activity='SQLQueue').sendMessage(
recipient=user_name,
subject=N_('Letters to print'),
message='Please find the PDF aggregating all letters to send here : %s' % result_pdf.getAbsoluteUrl(),
message_text_format='text/plain',
notifier_list=('Mail Message',),
store_as_event=False,
)
<?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>user_name</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>LetterPostModule_exportExportableLetterPostActivity</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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