Erpnext upgrade from 12 to 13

Hi all,
I just updated my erpnext bench from version-12 to version-13 ( contain 1 custom app) with no error
the bench start run also fine but when I try to do new Purchase Order I keep getting Invalid “depends_on” expression and also can not save the new doc.

Where and what should I check this errors came from ?
It is because my custom apps ? cause when I try to install clean version-13 without custom app, it run smoothly without this kind of error .
I have try to disable my hooks and custom client script but still no good result.
I read from the forum that this error can be resolv by updating through bench but in my case did not resolve the problem. Should I check my custom fields? what should I watch for ?

in the inspect console I got this line, 11 times = the number of invalid “depends on” error
Uncaught (in promise) Error: Invalid “depends_on” expression
Error evaluating the following expression:
desk.min.js?ver=1680974110.0:8865 let out = {frappe.user.has_role(“System Manager”)}
; return out

erpnext 13.49.11
frappe 13.52.0

Thanks and regards,



check the depends_on value on fields of Purchase Order DocType, or reset all customization on this Doctype (and the child DocType like Purchase Order Detail ( lines))

Good day

Perhaps you could try another way ? When I changed from 12 to 13, I did a fresh install on a
server and then, when everything seemed fine, I migrated the database from the 12 system to
the 13 system. Not sure what your setup is if you have the flexibility for something like this ?

I can’t however add anything in terms of solving the error-message your are getting.

Just a thought.

thanks for your reply,
I will try to reset the customization.

What I have done so far:

  1. I have just delete the transaction data => no good, I restore back.
  2. Try to debug and find the field that causing the problem via chrome debug but cant find it so far.
  3. Delete all custom field. => no good. I will try to reset the doctype customization like you suggested. ill go back .


thanks for your reply.
I think will do that too, I dont know if I can restore 12 data on 13 clean install … yet
I’ll get back asap




I quickly looked at my history … this is what I did
( I remember back in those days someone on this community assisted me with this )

sudo bench --force --site <your-site> restore /home/erpnext/frappe-bench/database.sql.gz
sudo bench --site <your-site> migrate

The database.sql.tgz file is your database backup from your 12 system

And you don;t have to unzip the tgz file

1 Like

Hi ,

I have tried ‘Reset to default’ on Purchase Order and all child tables:
Purchase Order Item Supplied
Payment Schedule
Purchase Order Item
Pricing Rule Detail
Purchase Taxes and Charges

The errors remain the same ( also the number of times they occured ).

Btw when doing reset to default on the tables, seems it did not actualy delete the customi fields.
So I delete them manualy.

also i do:
restart mariadb
bench build
bench start

I will try to install a clean version-13 and try it from there / install my custom app & restore my version-12 data.

thanks and regards,


Hi all,
I have found the error source.
It Is indeed the depends on value evaluation for one of my custom field which still remain after doing
restore default. the value is : eval: {frappe.user.has_role(“System Manager”)} … works on v12 but in v13 give me the error.
I then changed it to : frappe.user.has_role(“System Manager”); removing curly bracket, the ‘eval:’ string and put semicolon at the end… the errors gone.

Its a journey on upgrading from 12 to 13 system.
I think I should go for 14 if everything is ok.

Thank’s for the help guys, really appreciate .