Error when opening any document with addresses

Hi,

I keep getting the following error:

Traceback (most recent call last):

  • File “apps/frappe/frappe/app.py”, line 69, in application*
  • response = frappe.api.handle()*
  • File “apps/frappe/frappe/api.py”, line 55, in handle*
  • return frappe.handler.handle()*
  • File “apps/frappe/frappe/handler.py”, line 38, in handle*
  • data = execute_cmd(cmd)*
  • File “apps/frappe/frappe/handler.py”, line 76, in execute_cmd*
  • return frappe.call(method, *frappe.form_dict)
  • File “apps/frappe/frappe/init.py”, line 1448, in call*
  • return fn(*args, *newargs)
  • File “apps/frappe/frappe/desk/form/load.py”, line 41, in getdoc*
  • run_onload(doc)*
  • File “apps/frappe/frappe/desk/form/load.py”, line 330, in run_onload*
  • doc.run_method(“onload”)*
  • File “apps/frappe/frappe/model/document.py”, line 941, in run_method*
  • out = Document.hook(fn)(self, *args, *kwargs)
  • File “apps/frappe/frappe/model/document.py”, line 1260, in composer*
  • return composed(self, method, *args, *kwargs)
  • File “apps/frappe/frappe/model/document.py”, line 1242, in runner*
  • add_to_return_value(self, fn(self, *args, *kwargs))
  • File “apps/frappe/frappe/model/document.py”, line 938, in fn*
  • return method_object(*args, *kwargs)
  • File “apps/erpnext/erpnext/selling/doctype/customer/customer.py”, line 35, in onload*
  • load_address_and_contact(self)*
  • File “apps/frappe/frappe/contacts/address_and_contact.py”, line 22, in load_address_and_contact*
  • address_list = frappe.get_list(“Address”, filters=filters, fields=[""], order_by=“creation asc”)
  • File “apps/frappe/frappe/init.py”, line 1704, in get_list*
  • return frappe.model.db_query.DatabaseQuery(doctype).execute(*args, *kwargs)
  • File “apps/frappe/frappe/model/db_query.py”, line 159, in execute*
  • result = self.build_and_run()*
  • File “apps/frappe/frappe/model/db_query.py”, line 176, in build_and_run*
  • args = self.prepare_args()*
  • File “apps/frappe/frappe/model/db_query.py”, line 212, in prepare_args*
  • self.build_conditions()*
  • File “apps/frappe/frappe/model/db_query.py”, line 468, in build_conditions*
  • match_conditions = self.build_match_conditions()*
  • File “apps/frappe/frappe/model/db_query.py”, line 711, in build_match_conditions*
  • doctype_conditions = self.get_permission_query_conditions()*
  • File “apps/frappe/frappe/model/db_query.py”, line 801, in get_permission_query_conditions*
  • c = frappe.call(frappe.get_attr(method), self.user)*
  • File “apps/frappe/frappe/init.py”, line 1448, in call*
  • return fn(*args, *newargs)
  • File “apps/frappe/frappe/contacts/address_and_contact.py”, line 104, in get_permission_query_conditions_for_address*
  • return get_permission_query_conditions(“Address”)*
  • File “apps/frappe/frappe/contacts/address_and_contact.py”, line 108, in get_permission_query_conditions*
  • links = get_permitted_and_not_permitted_links(doctype)*
  • File “apps/frappe/frappe/contacts/address_and_contact.py”, line 143, in get_permitted_and_not_permitted_links*
  • allowed_doctypes = frappe.permissions.get_doctypes_with_read()*
  • File “apps/frappe/frappe/permissions.py”, line 366, in get_doctypes_with_read*
  • set([p.parent if type(p.parent) == str else p.parent.encode(“UTF8”) for p in get_valid_perms()])*
  • File “apps/frappe/frappe/permissions.py”, line 366, in *
  • set([p.parent if type(p.parent) == str else p.parent.encode(“UTF8”) for p in get_valid_perms()])*
    AttributeError: ‘NoneType’ object has no attribute ‘encode’

Can anyone help with this?

try bench migrate command

Hi @Bhushan,

Thanks for taking the time to respond.

try bench migrate command

Tried your suggestion but the error remains.

This issue has been raised as follows:

‘NoneType’ object has no attribute ‘encode’ · Issue #31151 · frappe/erpnext (github.com)

Any other ideas?

How do we get this issue prioritised as this is stopping the workflow at my company?

Thanks

Hi @adityahase,

Apologies for the direct reference - not sure who to reach out to.

Are you able to help with this?

Thanks

Sameer

UPDATE

This error prevent my user account with full role and user permissions to access an individual customer master. However, another user account with limited role and user permissions is able to access the same.

Not sure where to begin unraveling this one?