Fix has_code field on edit and create