Following steps worked for me, most of the errors are because of missing certain fields and modules in different versions of erpnext 12. use bench migrate --skip-failing after switching branch from v12 to v13.
Upgrade The System
sudo apt update
sudo apt upgrade
Update node-npm-yarn
curl -fsSL https://deb.nodesource.com/setup_10.x| sudo -E bash -
sudo apt-get install -y nodejs
sudo npm install -g npm
sudo npm install -g yarn
Upgrade Frappe Bench
sudo -H pip3 install --upgrade frappe-bench
Update
bench setup requirements
bench update
Switch Branch and Upgrade
bench switch-to-branch version-13 frappe erpnext --upgrade
bench migrate --skip-failing
Bench update --reset
bench update --patch
Update and build bench
bench update
bench build