Commit 4a70ddda 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 46c0776f
...@@ -16,7 +16,7 @@ if person_value.getDefaultEmailText('') in ('', None): ...@@ -16,7 +16,7 @@ if person_value.getDefaultEmailText('') in ('', None):
context.activate( context.activate(
tag=script.id, tag=script.id,
).LetterPostModule_exportExportableLetterPostActivity(user.getId()) ).LetterPostModule_exportExportableLetterPostActivity(user.getUserId())
return context.Base_redirect('view', return context.Base_redirect('view',
keep_items=dict(portal_status_message=N_("Report Started"))) keep_items=dict(portal_status_message=N_("Report Started")))
...@@ -2,13 +2,17 @@ portal = context.getPortalObject() ...@@ -2,13 +2,17 @@ portal = context.getPortalObject()
N_ = portal.Base_translateString N_ = portal.Base_translateString
letter_post_list = context.searchFolder(simulation_state='exportable') letter_post_list = context.searchFolder(simulation_state='exportable')
merged_pdf_content = None
merged_pdf_content = ""
for letter_post in letter_post_list: for letter_post in letter_post_list:
letter_post = letter_post.getObject() letter_post = letter_post.getObject()
merged_pdf_content = portal.ERP5Site_mergePDFList([merged_pdf_content, letter_post.getData()])
letter_post.activate().export() if merged_pdf_content is None:
merged_pdf_content = letter_post.getData()
else:
merged_pdf_content = portal.ERP5Site_mergePDFList([merged_pdf_content, letter_post.getData()])
letter_post.activate(activity='SQLQueue').export()
result_pdf = portal.document_module.newContent( result_pdf = portal.document_module.newContent(
portal_type='PDF', portal_type='PDF',
...@@ -17,7 +21,7 @@ result_pdf = portal.document_module.newContent( ...@@ -17,7 +21,7 @@ result_pdf = portal.document_module.newContent(
) )
portal.portal_notifications.activate(activity='SQLQueue').sendMessage( portal.portal_notifications.activate(activity='SQLQueue').sendMessage(
recipient=user_name, recipient=[user_name,],
subject=N_('Letters to print'), subject=N_('Letters to print'),
message='Please find the PDF aggregating all letters to send here : %s' % result_pdf.getAbsoluteUrl(), message='Please find the PDF aggregating all letters to send here : %s' % result_pdf.getAbsoluteUrl(),
message_text_format='text/plain', message_text_format='text/plain',
......
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