Previous Transaction Date

Hello team,

When a Sales Order is cancelled and amended, the field “Amended from” indicates the first version of the document.

I also need to print the transaction date of that first version in the new Sales Order, but I can’t find the way to do so…

Any help would be appreciated.

Hi @Francisco_Buendia . Create a custom field “Previous Transaction Date” (perhaps under “Amended From” > Create a validation on save to check if “Amended From” is not Empty > Get the date of the previous document through the “Amended From” field as it shows the previous document > Set the date on the “Previous Transaction Date” custom field. If you are not familiar with scripting yet, you might want to take a look at it here


Yep… this is exactly what I haven’t figured out how to do it. Could you please be so kind to give me any more specific idea… please?

@Francisco_Buendia Add this in your Python Script def triggered on save (validate)

if (doc.amended_from) :
    prev_po = frappe.get_doc("Purchase Order", doc.amended_from)
    doc.previous_transaction_date = prev_po.transaction_date


I’m using Frappe Cloud… should be coded in Java, right?

I tried with this:
But doesn’t work.

if you are using ERPNext Cloud, yes it should be in javascript (Custom Script)

have you tried this?

No, I haven’t… but I’ll take look and test.

1 Like