我通过控制器创建了crm.lead模型的记录,我还想在日志记录中上传图像或文件。
class RequestForQuote(http.Controller):
@route('/form/sinsert', type="http", auth="public", website=True, csrf=True)
def qoute_application_process(self,**kwargs):
values = {}
for field_name, field_value in kwargs.items():
values[field_name] = field_value
internal_notes = values['comment'] + ' , ' +values['commercial_company_name'] + ", " +values['contact_address']+ ' ' +values['contact_city'] +' '+ \
values['contact_state'] +' '+values['zip'] + ', '+ values['meeting_ids']
name = values['first_name'] +' '+values['last_name']
opportunity = request.env['crm.lead'].sudo().create({'name': name ,'date_deadline':values['date'],'email_from':values['email'],
'description':internal_notes,'type':'opportunity'
})
return werkzeug.utils.redirect('/form/thankyou')
答案 0 :(得分:0)
要创建内部记事,您只需致电self.message_post
:
self.message_post(body="Internal note", attachments=[('Image', self.partner_id.image)])
您可以在mail.thread
阅读更多内容