Merge pull request #28790 from frappe/mergify/bp/develop/pr-28786

fix: Error on Invoice generation (backport #28786)