Single Doctype Read Only Field Bug

Hi !

There is bug while saving Single Doctype.

I know, when we save doctype with Is Single button checked, it does not create any table in database. but it should not throw any error related to any Referential Keys also.

After adding Read Only field in Single Doctype its throwing error:

Traceback (most recent call last):
  File "/home/production/production/apps/frappe/frappe/desk/form/save.py", line 22, in savedocs
    doc.save()
  File "/home/production/production/apps/frappe/frappe/model/document.py", line 223, in save
    return self._save(*args, **kwargs)
  File "/home/production/production/apps/frappe/frappe/model/document.py", line 269, in _save
    self.run_post_save_methods()
  File "/home/production/production/apps/frappe/frappe/model/document.py", line 770, in run_post_save_methods
    self.run_method("on_update")
  File "/home/production/production/apps/frappe/frappe/model/document.py", line 651, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/production/production/apps/frappe/frappe/model/document.py", line 860, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/production/production/apps/frappe/frappe/model/document.py", line 843, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/production/production/apps/frappe/frappe/model/document.py", line 645, in 
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/production/production/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 188, in on_update
    self.update_fields_to_fetch()
  File "/home/production/production/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 110, in update_fields_to_fetch
    frappe.db.sql(query)
  File "/home/production/production/apps/frappe/frappe/database.py", line 148, in sql
    self._cursor.execute(query)
  File "/home/production/production/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/production/production/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
ProgrammingError: (1146, "Table 'bba45b38bdd2aa96.tabLocal Setting' doesn't exist")

Traceback (most recent call last):
  File "/home/production/production/apps/frappe/frappe/app.py", line 55, in application
    response = frappe.handler.handle()
  File "/home/production/production/apps/frappe/frappe/handler.py", line 19, in handle
    execute_cmd(cmd)
  File "/home/production/production/apps/frappe/frappe/handler.py", line 40, in execute_cmd
    ret = frappe.call(method, **frappe.form_dict)
  File "/home/production/production/apps/frappe/frappe/__init__.py", line 898, in call
    return fn(*args, **newargs)
  File "/home/production/production/apps/frappe/frappe/desk/form/save.py", line 22, in savedocs
    doc.save()
  File "/home/production/production/apps/frappe/frappe/model/document.py", line 223, in save
    return self._save(*args, **kwargs)
  File "/home/production/production/apps/frappe/frappe/model/document.py", line 269, in _save
    self.run_post_save_methods()
  File "/home/production/production/apps/frappe/frappe/model/document.py", line 770, in run_post_save_methods
    self.run_method("on_update")
  File "/home/production/production/apps/frappe/frappe/model/document.py", line 651, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/production/production/apps/frappe/frappe/model/document.py", line 860, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/production/production/apps/frappe/frappe/model/document.py", line 843, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/production/production/apps/frappe/frappe/model/document.py", line 645, in 
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/production/production/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 188, in on_update
    self.update_fields_to_fetch()
  File "/home/production/production/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 110, in update_fields_to_fetch
    frappe.db.sql(query)
  File "/home/production/production/apps/frappe/frappe/database.py", line 148, in sql
    self._cursor.execute(query)
  File "/home/production/production/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/production/production/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
ProgrammingError: (1146, "Table 'bba45b38bdd2aa96.tabLocal Setting' doesn't exist")

Try this. This should help.
Save the doctype without read-only fields. Now edit doctype and add read-only fields.