How table is locked on edit mode?

need to know how ERPNext handel if two users editing same record in the same time?

do record is locked for the first user who editing record?


As far as I know there is no lock and lock check before user starts editing the doc. multi user can open same doc and editing it, the first user can save the changes to database together with the modified timestamp. when the 2nd user finished the change and try to save to database, the original timestamp when read the doc is checked, if system detected the timestamp changed by other change(the first user change), there will be error message shown to the 2nd user. the 2nd user need to refresh the doc and edit, save again.