Commit 4bc22d6c authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_corporate_identity: check if it's module before access attribute

parent e8ee581e
......@@ -32,6 +32,7 @@ if doc_save:
web_page.edit(
text_content=doc_html_file
)
if not context.isModuleType():
context.setAggregate(web_page.getRelativeUrl())
message = context.Base_translateString(
'%(portal_type)s created successfully as Web Page.' % {
......
......@@ -111,12 +111,18 @@ doc_content, report_override_doc_title, report_override_doc_subtitle = doc_repor
report_title=doc_translated_title,
override_batch_mode=override_batch_mode
)
doc_reference = html_quote(override_document_reference) if override_document_reference else doc.getReference() or blank
doc_short_title = translateText(report_override_doc_subtitle if report_override_doc_subtitle else html_quote(doc_report_title) if doc_report_title else doc.getShortTitle() or blank)
doc_version = html_quote(override_document_version) if override_document_version else getattr(doc, "version", None) or "001"
doc_title = translateText(html_quote(override_document_title) if override_document_title else report_override_doc_title if report_override_doc_title else doc.getTitle() or blank)
doc_language = html_quote(override_document_language) if override_document_language else doc_language
if doc.isModuleType():
doc_reference = html_quote(override_document_reference) if override_document_reference else blank
doc_short_title = translateText(report_override_doc_subtitle if report_override_doc_subtitle else html_quote(doc_report_title) if doc_report_title else blank)
doc_version = html_quote(override_document_version) if override_document_version else getattr(doc, "version", None) or "001"
doc_title = translateText(html_quote(override_document_title) if override_document_title else report_override_doc_title if report_override_doc_title else blank)
doc_language = html_quote(override_document_language) if override_document_language else doc_language
else:
doc_reference = html_quote(override_document_reference) if override_document_reference else doc.getReference() or blank
doc_short_title = translateText(report_override_doc_subtitle if report_override_doc_subtitle else html_quote(doc_report_title) if doc_report_title else doc.getShortTitle() or blank)
doc_version = html_quote(override_document_version) if override_document_version else getattr(doc, "version", None) or "001"
doc_title = translateText(html_quote(override_document_title) if override_document_title else report_override_doc_title if report_override_doc_title else doc.getTitle() or blank)
doc_language = html_quote(override_document_language) if override_document_language else doc_language
# test overrides
if override_batch_mode:
......
......@@ -36,7 +36,7 @@ if doc_save:
document.setContentType("application/pdf")
# setting aggregate in case context is an event
if context.portal_type != 'Web Page':
if context.portal_type != 'Web Page' and not context.isModuleType():
context.setAggregate(document.getRelativeUrl())
# try setting predecessor/related document to later distinguish this
......
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