Sever Script: Check if fields changed?

I have a custom App that will use the Google Geocode API to geocode and address field to get the latitude/longitude.

I only want to call the API if the address field is being changed.

Is there a way within frappe to check if a field is being changed?

old_doc = doc.get_doc_before_save()
if old_doc.price != doc.price:
    # price changed
    pass

https://frappeframework.com/docs/user/en/api/document#doc-get-doc-before-save

1 Like