[v7] Deadlock in Item Attribute Table


Just was trying to add a new value in an existing attribute in v7 develop branch and found out the system just hangs and sometimes I get the error Another Transaction is blocking this and try after sometime

I have tried to do this after stopping and starting the bench but to no avail. I think the way the code is running to check the existing item codes for the attributes is creating a deadlock into the system, I think the problem is with:

Which used to be like this below:

@rmehta: Could you please shed some light on this as this commit was made by you:


Created github Issue [v7] Deadlock in Item Variant Table · Issue #5756 · frappe/erpnext · GitHub