closes https://github.com/frappe/erpnext/issues/45571 (cherry picked from commit 827afbfa2e)
827afbfa2e