Commit af58412e authored by Boxiang Sun's avatar Boxiang Sun

erp5_post: Change the post state from "draft" to "publish" after add that post.

parent 1e8ffb54
...@@ -4,7 +4,7 @@ now = DateTime() ...@@ -4,7 +4,7 @@ now = DateTime()
# create an HTML Post # create an HTML Post
post_module = portal.post_module post_module = portal.post_module
post_1 = post_module.newContent(portal_type='HTML Post') post = post_module.newContent(portal_type='HTML Post')
# get the related object # get the related object
object_list = portal.portal_catalog(relative_url=follow_up) # with id keyword, this function will return a sequence data type which contains one element. object_list = portal.portal_catalog(relative_url=follow_up) # with id keyword, this function will return a sequence data type which contains one element.
...@@ -18,7 +18,7 @@ follow_up_object.edit( ...@@ -18,7 +18,7 @@ follow_up_object.edit(
modification_date = now modification_date = now
) )
post_1.edit( post.edit(
start_date=now, start_date=now,
follow_up_value=follow_up_object, follow_up_value=follow_up_object,
predecessor_value = predecessor if predecessor else None, predecessor_value = predecessor if predecessor else None,
...@@ -32,12 +32,13 @@ if file != "undefined": ...@@ -32,12 +32,13 @@ if file != "undefined":
'file': file} 'file': file}
document = context.Base_contribute(**document_kw) document = context.Base_contribute(**document_kw)
# set relation between post and document # set relation between post and document
post_1.setSuccessorValueList([document]) post.setSuccessorValueList([document])
# depending on security model this should be changed accordingly # depending on security model this should be changed accordingly
document.publish() document.publish()
post.publish()
# We need to reindex the object on server. So the page will get the post which # We need to reindex the object on server. So the page will get the post which
# just submmitted. # just submmitted.
post_1.immediateReindexObject() post.immediateReindexObject()
return return
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