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):
context.activate(
tag=script.id,
).LetterPostModule_exportExportableLetterPostActivity(user.getId())
).LetterPostModule_exportExportableLetterPostActivity(user.getUserId())
return context.Base_redirect('view',
keep_items=dict(portal_status_message=N_("Report Started")))
......@@ -2,13 +2,17 @@ portal = context.getPortalObject()
N_ = portal.Base_translateString
letter_post_list = context.searchFolder(simulation_state='exportable')
merged_pdf_content = ""
merged_pdf_content = None
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()
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(
portal_type='PDF',
......@@ -17,7 +21,7 @@ result_pdf = portal.document_module.newContent(
)
portal.portal_notifications.activate(activity='SQLQueue').sendMessage(
recipient=user_name,
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',
......
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