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
3 Likes