How to get doc name of quotation in sales order?

I created a sales order using items from my quotation (e.g. AA001). How can I print the quotation ID (AA001) in the sales order?

I saw a previous post addressing printing sales order number in the sales invoice using {{ doc.items[0].sales_order }}. How do i do it for quotation to sales order?

Hi @Joanne_yz
You can use the same approach as {{ doc.items[0].prevdoc_docname }} , but please be aware that this will only retrieve the value from the first row of the items table. There is a possibility of adding different quotations directly to the sales order using the Get Items From button.

Hi @Joanne_yz,

If you want to get multiple id then please apply it.

{% set quotation_ids = [] %}
{% for item in doc.items %}
    {% if item.prevdoc_docname not in quotation_ids %}
        {{ item.prevdoc_docname }}
        {% set _ = quotation_ids.append(item.prevdoc_docname) %}
    {% endif %}
{% endfor %}

Thank You!

Hi @Safvan_Ph @NCP , thanks for your replies.

I used {{ doc.items[0].quotation }} , but the result was no such element as shown below:

Tried using other names like Quotation, quotation_id etc. to no avail. Any idea what’s the problem?

@Joanne_yz
{{ doc.items[0].prevdoc_docname }} Please use this

Ah got it! Thank you so much!!