Commit e0828e20 authored by Xiaowu Zhang's avatar Xiaowu Zhang

erp5_hr: improve add position application

parent 32896659
from erp5.component.module.DateUtils import addToDate
from DateTime import DateTime
requester = None
if not first_name or not last_name:
raise ValueError('first or last name is not provided')
for person in context.portal_catalog(portal_type='Person', title='%s %s'%(first_name, last_name)):
if person.getFirstName() == first_name and person.getLastName() == last_name:
requester = person
......@@ -46,7 +48,7 @@ if web_message_date or web_message_text or web_message_title:
if response_template:
response = context.event_module.newContent(
portal_type='Mail Message',
source=context.ERP5Site_getAuthenticatedMemberPersonValue(),
source_value=context.ERP5Site_getAuthenticatedMemberPersonValue(),
destination_value=requester,
title='Re: %s' % web_message_title,
start_date=addToDate(web_message_date,to_add={'minute': 1}),
......@@ -55,7 +57,12 @@ if web_message_date or web_message_text or web_message_title:
content_type='Mail Message')
response.Event_setTextContentFromNotificationMessage(
reference=response_template,
substitution_method_parameter_dict=dict(reply_body= event.getReplyBody(),reply_subject= event.getReplySubject()))
substitution_method_parameter_dict=dict(mapping_dict = {'reply_body': event.getReplyBody(),
'reply_subject': event.getReplySubject(),
'sender_name': context.ERP5Site_getAuthenticatedMemberPersonValue().getTitle(),
'recipient_first_name': first_name,
'position_title':context.restrictedTraverse(position).getTitle()
}))
......
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