How to print opportunity comment with date, user , time

i want to print all comment( user, time, date, comment_text or content) on opportunity

Hi @maheshlangote,

you can make a new print template and insert a html section with something like this

<!-- communiction history -->
<table style="width: 100%; ">
  {% set communications = frappe.get_all('Communication', filters={'reference_doctype': 'Opportunity', 'reference_name': doc.name, 'comment_type': 'Comment'}, fields=['communication_date', 'sender_full_name', 'content']) %}
  {% for comm in communications %}
  <tr style="border: solid 1px silver;">
    <td>{{ frappe.utils.get_datetime(comm.communication_date).strftime('%d.%m.%Y') }} by 
     {{ comm.sender_full_name }}<br />
     {{ comm.content }}
    </td>
  </tr>
  {% endfor %}
</table> 

Hope this helps :wink:

3 Likes

Thanks @lasalesi But still communication Date is not coming

Hi @maheshlangote,

You can use

.strftime('%d.%m.%Y %H:%M')

to include the time…

Thanks lot @lasalesi :pray:
its working