Get referenced doc from related documents

I want to get the referenced Quotation from my Sales Order’s related documents from my .py file.

I have a function hooked to Sales Order on_submit.

How would I do this in any other DocType with a referenced doc?

I can’t find any property in the documentation.

hi @codeag,

there is already link available to Quotation in Sales Order Item. You will just need to extract the quotation documents name,

Please refer to the following code to retrieve the Quotation docname from sales Order.

quotations = list(set([item.prevdoc_docname for item in doc.items]))

for any other doctype you can also use the get_linked_doc() method, please refer linked_with.py.

Thanks, Makarand

1 Like

This topic was automatically closed after 24 hours. New replies are no longer allowed.