Request a method to fix NameError: name 'currency' is not defined in sales invoice

Previously, fields had been added to various doctypes, but I still couldn’t find the part that caused sales invoice error name ‘currency’.

This only happens when you seem to have tampered with the code or doctype, otherwise there is no issue in versions 14 and 15. And check the error log by console log f12

Thank you very much, I can fix this.
Just add the currency variable to the file.