{"action":"created","issue":{"url":"https://api.github.com/repos/frappe/erpnext/issues/5866","repository_url":"https://api.github.com/repos/frappe/erpnext","labels_url":"https://api.github.com/repos/frappe/erpnext/issues/5866/labels{/name}","comments_url":"https://api.github.com/repos/frappe/erpnext/issues/5866/comments","events_url":"https://api.github.com/repos/frappe/erpnext/issues/5866/events","html_url":"https://github.com/frappe/erpnext/issues/5866","id":167442327,"number":5866,"title":"Import Custom Script to New Site with TypeError coercing to Unicode","user":{"login":"KennethWKZ","id":17061293,"avatar_url":"https://avatars.githubusercontent.com/u/17061293?v=3","gravatar_id":"","url":"https://api.github.com/users/KennethWKZ","html_url":"https://github.com/KennethWKZ","followers_url":"https://api.github.com/users/KennethWKZ/followers","following_url":"https://api.github.com/users/KennethWKZ/following{/other_user}","gists_url":"https://api.github.com/users/KennethWKZ/gists{/gist_id}","starred_url":"https://api.github.com/users/KennethWKZ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KennethWKZ/subscriptions","organizations_url":"https://api.github.com/users/KennethWKZ/orgs","repos_url":"https://api.github.com/users/KennethWKZ/repos","events_url":"https://api.github.com/users/KennethWKZ/events{/privacy}","received_events_url":"https://api.github.com/users/KennethWKZ/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-07-25T19:10:32Z","updated_at":"2016-07-26T16:05:49Z","closed_at":"2016-07-26T02:30:23Z","body":"Once update to latest version, found that when we import custom script from old to new site, it will got coercing to unicode error.\r\n\r\nBut I was found that if we create an empty Client Script with DocType name and save. Then start import, it will success. I also tried on latest master branch and develop 7.0.3 branch. All got same issue.\r\n\r\n`{u'__islocal': True, u'modified_by': u'Administrator', u'name': u'User-Client', u'parent': None, u'script': u'cur_frm.add_fetch(\"company\",\"abbr\",\"companyabbr\");', u'creation': '2016-07-26 00:37:16.784305', u'modified': '2016-07-26 00:37:16.784305', u'doctype': u'Custom Script', u'idx': 0, u'parenttype': None, u'owner': u'Administrator', u'docstatus': 0, u'dt': u'User', u'script_type': None, u'parentfield': None}\r\ndesk.min.js:138 `\r\n\r\n`Traceback (most recent call last):\r\n  File \"/home/frappe/benches/sunseap-prod/apps/frappe/frappe/core/page/data_import_tool/importer.py\", line 257, in upload\r\n    doc.insert()\r\n  File \"/home/frappe/benches/sunseap-prod/apps/frappe/frappe/model/document.py\", line 207, in insert\r\n    self.set_new_name()\r\n  File \"/home/frappe/benches/sunseap-prod/apps/frappe/frappe/model/document.py\", line 325, in set_new_name\r\n    set_new_name(self)\r\n  File \"/home/frappe/benches/sunseap-prod/apps/frappe/frappe/model/naming.py\", line 38, in set_new_name\r\n    doc.run_method(\"autoname\")\r\n  File \"/home/frappe/benches/sunseap-prod/apps/frappe/frappe/model/document.py\", line 638, in run_method\r\n    return Document.hook(fn)(self, *args, **kwargs)\r\n  File \"/home/frappe/benches/sunseap-prod/apps/frappe/frappe/model/document.py\", line 816, in composer\r\n    return composed(self, method, *args, **kwargs)\r\n  File \"/home/frappe/benches/sunseap-prod/apps/frappe/frappe/model/document.py\", line 799, in runner\r\n    add_to_return_value(self, fn(self, *args, **kwargs))\r\n  File \"/home/frappe/benches/sunseap-prod/apps/frappe/frappe/model/document.py\", line 632, in <lambda>\r\n    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)\r\n  File \"/home/frappe/benches/sunseap-prod/apps/frappe/frappe/custom/doctype/custom_script/custom_script.py\", line 12, in autoname\r\n    self.name = self.dt + \"-\" + self.script_type\r\nTypeError: coercing to Unicode: need string or buffer, NoneType found`\r\n"},"comment":{"url":"https://api.github.com/repos/frappe/erpnext/issues/comments/235317415","html_url":"https://github.com/frappe/erpnext/issues/5866#issuecomment-235317415","issue_url":"https://api.github.com/repos/frappe/erpnext/issues/5866","id":235317415,"user":{"login":"rmehta","id":140076,"avatar_url":"https://avatars.githubusercontent.com/u/140076?v=3","gravatar_id":"","url":"https://api.github.com/users/rmehta","html_url":"https://github.com/rmehta","followers_url":"https://api.github.com/users/rmehta/followers","following_url":"https://api.github.com/users/rmehta/following{/other_user}","gists_url":"https://api.github.com/users/rmehta/gists{/gist_id}","starred_url":"https://api.github.com/users/rmehta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmehta/subscriptions","organizations_url":"https://api.github.com/users/rmehta/orgs","repos_url":"https://api.github.com/users/rmehta/repos","events_url":"https://api.github.com/users/rmehta/events{/privacy}","received_events_url":"https://api.github.com/users/rmehta/received_events","type":"User","site_admin":false},"created_at":"2016-07-26T16:05:48Z","updated_at":"2016-07-26T16:05:48Z","body":"Not necessarily. Maybe there is a reason that field is not filled by default. Send a patch if you think better."}}
{"actor":{"display_login":"rmehta"}}