How to refer to a same document?

How to refer to the same document?
For example I want to use this method
frappe.db.set_value(“sales invoice”, ? ,“inv” ,new_path)

so how can I say ? is the current document ?

In what kind of context?

If you’re trying to do this from a javascript page, the current document name is generally in the variable cur_frm.doc.name.

Sorry, I didn’t mention that but I prefer to do it through python.

There’s not really a concept of the “current document” in the python backend. If you’re inside an document’s object context, it’s just self.name, but I’m not really sure why you’d want to call frappe.db.set_value from within the document itself.

1 Like

Okay I will explain my idea maybe you have a better one.

I want to copy a content of XML file and then save it to temp file; this step works.
So, I want to store the data in temp file to a long text field ; this step not works yet.

And the only way I found is the frappe.set_value to send the data to that field.

So do you recommend using javascript?

I wish I could help more, but your description still doesn’t explain what the “current document” is.