AttributeError: 'User' object has no attribute 'frappe_userid'

Hi all
while trying to get an update version of erpnext running bench update

I always got errors . Here you have the whole update operation log (it’s an update starting from a version 7 installation) :

erpuser@gestionaledev:~/frappe-bench$ bench update

INFO:bench.utils:updating bench
Already up-to-date.
Requirement already satisfied: Pillow in ./env/lib/python2.7/site-packages
INFO:bench.app:pulling frappe
From https://github.com/frappe/frappe

  • branch develop -> FETCH_HEAD
    Already up-to-date.
    INFO:bench.app:pulling erpnext
    From https://github.com/frappe/erpnext
  • branch develop -> FETCH_HEAD
    Already up-to-date.
    Requirement already up-to-date: pip in ./env/lib/python2.7/site-packages
    Migrating gestionale-devel
    Executing erpnext.patches.v7_1.update_portal_roles in gestionale-devel (5659670f3d74cb4f)
    /home/erpuser/frappe-bench/env/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
    SNIMissingWarning
    /home/erpuser/frappe-bench/env/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
    InsecurePlatformWarning
    /home/erpuser/frappe-bench/env/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
    InsecurePlatformWarning
    /home/erpuser/frappe-bench/env/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
    InsecurePlatformWarning

Traceback (most recent call last):
File “/usr/lib/python2.7/runpy.py”, line 162, in _run_module_as_main
main”, fname, loader, pkg_name)
File “/usr/lib/python2.7/runpy.py”, line 72, in _run_code
exec code in run_globals
File “/home/erpuser/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 79, in
main()
File “/home/erpuser/frappe-bench/apps/frappe/frappe/utils/bench_helper.py”, line 16, in main
click.Group(commands=commands)(prog_name=‘bench’)
File “/home/erpuser/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 716, in call
return self.main(*args, **kwargs)
File “/home/erpuser/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 696, in main
rv = self.invoke(ctx)
File “/home/erpuser/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erpuser/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 1060, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erpuser/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/erpuser/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py”, line 534, in invoke
return callback(*args, **kwargs)
File “/home/erpuser/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py”, line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File “/home/erpuser/frappe-bench/apps/frappe/frappe/commands/init.py”, line 24, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File “/home/erpuser/frappe-bench/apps/frappe/frappe/commands/site.py”, line 209, in migrate
migrate(context.verbose, rebuild_website=rebuild_website)
File “/home/erpuser/frappe-bench/apps/frappe/frappe/migrate.py”, line 30, in migrate
frappe.modules.patch_handler.run_all()
File “/home/erpuser/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 29, in run_all
if not run_single(patchmodule = patch):
File “/home/erpuser/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 63, in run_single
return execute_patch(patchmodule, method, methodargs)
File “/home/erpuser/frappe-bench/apps/frappe/frappe/modules/patch_handler.py”, line 83, in execute_patch
frappe.get_attr(patchmodule.split()[0] + “.execute”)()
File “/home/erpuser/frappe-bench/apps/erpnext/erpnext/patches/v7_1/update_portal_roles.py”, line 15, in execute
user.set_default_roles()
File “/home/erpuser/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py”, line 124, in set_default_roles
self.add_roles(rule.get(‘role’))
File “/home/erpuser/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py”, line 375, in add_roles
self.save()
File “/home/erpuser/frappe-bench/apps/frappe/frappe/model/document.py”, line 233, in save
return self._save(*args, **kwargs)
File “/home/erpuser/frappe-bench/apps/frappe/frappe/model/document.py”, line 262, in _save
self.run_before_save_methods()
File “/home/erpuser/frappe-bench/apps/frappe/frappe/model/document.py”, line 753, in run_before_save_methods
self.run_method(“validate”)
File “/home/erpuser/frappe-bench/apps/frappe/frappe/model/document.py”, line 654, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “/home/erpuser/frappe-bench/apps/frappe/frappe/model/document.py”, line 882, in composer
return composed(self, method, *args, **kwargs)
File “/home/erpuser/frappe-bench/apps/frappe/frappe/model/document.py”, line 865, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “/home/erpuser/frappe-bench/apps/frappe/frappe/model/document.py”, line 648, in
fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
File “/home/erpuser/frappe-bench/apps/frappe/frappe/core/doctype/user/user.py”, line 70, in validate
if (self.name not in [“Administrator”, “Guest”]) and (not self.frappe_userid):
AttributeError: ‘User’ object has no attribute 'frappe_userid’

Pushed a fix in hotfix

2 Likes

perfect ! it works very well

thanks a lot for the impressive support you give the community

what was the solution to this problem
“attributeerror-user-object-has-no-attribute-frappe-userid”

whats the solution ?..i also face similarly issue:
“”“AttributeError: ‘module’ object has no attribute ‘fetch_appraisal_template’”""