'Set the data property with the diff of the docs if present'

def set_diff(self, old, new):

    diff = get_diff(old, new)
    if diff:
        self.ref_doctype = new.doctype
        self.docname = new.name
        self.data = frappe.as_json(diff)
        return True
    else:
        return False
