{"action":"created","comment":{"url":"https://api.github.com/repos/OCA/partner-contact/pulls/comments/48238397","id":48238397,"diff_hunk":"@@ -146,9 +162,23 @@ def _get_inverse_name(self, name, is_company=False):\n             parts = [name or False, False]\n         # Guess name splitting\n         else:\n-            parts = name.strip().split(\" \", 1)\n-            while len(parts) < 2:\n-                parts.append(False)\n+            order = self._get_names_order()\n+            # Remove redundant spaces\n+            name = re.sub(r'([, ]) +', r'\\1', name)\n+            if ',' in name:\n+                # If a comma found, then use 'Lastname, Firstname' pattern\n+                order = 'last_first_comma'\n+            if order == 'last_first_comma':\n+                parts = name.strip().split(\",\", 1)\n+            else:\n+                parts = name.strip().split(\" \", 1)","path":"partner_firstname/models/res_partner.py","position":59,"original_position":59,"commit_id":"7128c44a0c040d017c511dbd4c767bea4f879740","original_commit_id":"7128c44a0c040d017c511dbd4c767bea4f879740","user":{"login":"Yajo","id":973709,"avatar_url":"https://avatars.githubusercontent.com/u/973709?v=3","gravatar_id":"","url":"https://api.github.com/users/Yajo","html_url":"https://github.com/Yajo","followers_url":"https://api.github.com/users/Yajo/followers","following_url":"https://api.github.com/users/Yajo/following{/other_user}","gists_url":"https://api.github.com/users/Yajo/gists{/gist_id}","starred_url":"https://api.github.com/users/Yajo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yajo/subscriptions","organizations_url":"https://api.github.com/users/Yajo/orgs","repos_url":"https://api.github.com/users/Yajo/repos","events_url":"https://api.github.com/users/Yajo/events{/privacy}","received_events_url":"https://api.github.com/users/Yajo/received_events","type":"User","site_admin":false},"body":"`self._get_whitespace_cleaned_name` takes care of strip too.","created_at":"2015-12-22T09:59:45Z","updated_at":"2015-12-22T09:59:45Z","html_url":"https://github.com/OCA/partner-contact/pull/227#discussion_r48238397","pull_request_url":"https://api.github.com/repos/OCA/partner-contact/pulls/227","_links":{"self":{"href":"https://api.github.com/repos/OCA/partner-contact/pulls/comments/48238397"},"html":{"href":"https://github.com/OCA/partner-contact/pull/227#discussion_r48238397"},"pull_request":{"href":"https://api.github.com/repos/OCA/partner-contact/pulls/227"}}},"pull_request":{"url":"https://api.github.com/repos/OCA/partner-contact/pulls/227","id":54243791,"html_url":"https://github.com/OCA/partner-contact/pull/227","diff_url":"https://github.com/OCA/partner-contact/pull/227.diff","patch_url":"https://github.com/OCA/partner-contact/pull/227.patch","issue_url":"https://api.github.com/repos/OCA/partner-contact/issues/227","number":227,"state":"open","locked":false,"title":"[IMP] Partner names order configurable","user":{"login":"antespi","id":1881111,"avatar_url":"https://avatars.githubusercontent.com/u/1881111?v=3","gravatar_id":"","url":"https://api.github.com/users/antespi","html_url":"https://github.com/antespi","followers_url":"https://api.github.com/users/antespi/followers","following_url":"https://api.github.com/users/antespi/following{/other_user}","gists_url":"https://api.github.com/users/antespi/gists{/gist_id}","starred_url":"https://api.github.com/users/antespi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antespi/subscriptions","organizations_url":"https://api.github.com/users/antespi/orgs","repos_url":"https://api.github.com/users/antespi/repos","events_url":"https://api.github.com/users/antespi/events{/privacy}","received_events_url":"https://api.github.com/users/antespi/received_events","type":"User","site_admin":false},"body":"This improvement adds names order configurable at system level. This is a first approach for this feature as discussed here: https://github.com/OCA/partner-contact/issues/210 \r\n\r\nYou can configure some common name patterns for the inverse function\r\nin Settings > Configuration > General settings:\r\n\r\n* Lastname Firstname: For example 'Anderson Robert'\r\n* Lastname, Firstname: For example 'Anderson, Robert'\r\n* Firstname Lastname: For example 'Robert Anderson'\r\n\r\nAfter applying the changes, you can recalculate all partners name clicking\r\n\"Recalculate names\" button. Note: This process could take so much time depending\r\nhow many partners there are in database.\r\n","created_at":"2015-12-21T11:01:01Z","updated_at":"2015-12-22T09:59:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4abdb662f8582fe37c0f45deee83cc24d2fffaf9","assignee":null,"milestone":{"url":"https://api.github.com/repos/OCA/partner-contact/milestones/3","html_url":"https://github.com/OCA/partner-contact/milestones/8.0","labels_url":"https://api.github.com/repos/OCA/partner-contact/milestones/3/labels","id":1011256,"number":3,"title":"8.0","description":"","creator":{"login":"max3903","id":939952,"avatar_url":"https://avatars.githubusercontent.com/u/939952?v=3","gravatar_id":"","url":"https://api.github.com/users/max3903","html_url":"https://github.com/max3903","followers_url":"https://api.github.com/users/max3903/followers","following_url":"https://api.github.com/users/max3903/following{/other_user}","gists_url":"https://api.github.com/users/max3903/gists{/gist_id}","starred_url":"https://api.github.com/users/max3903/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/max3903/subscriptions","organizations_url":"https://api.github.com/users/max3903/orgs","repos_url":"https://api.github.com/users/max3903/repos","events_url":"https://api.github.com/users/max3903/events{/privacy}","received_events_url":"https://api.github.com/users/max3903/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":14,"state":"open","created_at":"2015-03-08T15:04:26Z","updated_at":"2015-12-21T22:37:57Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/OCA/partner-contact/pulls/227/commits","review_comments_url":"https://api.github.com/repos/OCA/partner-contact/pulls/227/comments","review_comment_url":"https://api.github.com/repos/OCA/partner-contact/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OCA/partner-contact/issues/227/comments","statuses_url":"https://api.github.com/repos/OCA/partner-contact/statuses/7128c44a0c040d017c511dbd4c767bea4f879740","head":{"label":"Antiun:imp-names_order","ref":"imp-names_order","sha":"7128c44a0c040d017c511dbd4c767bea4f879740","user":{"login":"Antiun","id":8735718,"avatar_url":"https://avatars.githubusercontent.com/u/8735718?v=3","gravatar_id":"","url":"https://api.github.com/users/Antiun","html_url":"https://github.com/Antiun","followers_url":"https://api.github.com/users/Antiun/followers","following_url":"https://api.github.com/users/Antiun/following{/other_user}","gists_url":"https://api.github.com/users/Antiun/gists{/gist_id}","starred_url":"https://api.github.com/users/Antiun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Antiun/subscriptions","organizations_url":"https://api.github.com/users/Antiun/orgs","repos_url":"https://api.github.com/users/Antiun/repos","events_url":"https://api.github.com/users/Antiun/events{/privacy}","received_events_url":"https://api.github.com/users/Antiun/received_events","type":"Organization","site_admin":false},"repo":{"id":24198991,"name":"partner-contact","full_name":"Antiun/partner-contact","owner":{"login":"Antiun","id":8735718,"avatar_url":"https://avatars.githubusercontent.com/u/8735718?v=3","gravatar_id":"","url":"https://api.github.com/users/Antiun","html_url":"https://github.com/Antiun","followers_url":"https://api.github.com/users/Antiun/followers","following_url":"https://api.github.com/users/Antiun/following{/other_user}","gists_url":"https://api.github.com/users/Antiun/gists{/gist_id}","starred_url":"https://api.github.com/users/Antiun/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Antiun/subscriptions","organizations_url":"https://api.github.com/users/Antiun/orgs","repos_url":"https://api.github.com/users/Antiun/repos","events_url":"https://api.github.com/users/Antiun/events{/privacy}","received_events_url":"https://api.github.com/users/Antiun/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Antiun/partner-contact","description":"","fork":true,"url":"https://api.github.com/repos/Antiun/partner-contact","forks_url":"https://api.github.com/repos/Antiun/partner-contact/forks","keys_url":"https://api.github.com/repos/Antiun/partner-contact/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Antiun/partner-contact/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Antiun/partner-contact/teams","hooks_url":"https://api.github.com/repos/Antiun/partner-contact/hooks","issue_events_url":"https://api.github.com/repos/Antiun/partner-contact/issues/events{/number}","events_url":"https://api.github.com/repos/Antiun/partner-contact/events","assignees_url":"https://api.github.com/repos/Antiun/partner-contact/assignees{/user}","branches_url":"https://api.github.com/repos/Antiun/partner-contact/branches{/branch}","tags_url":"https://api.github.com/repos/Antiun/partner-contact/tags","blobs_url":"https://api.github.com/repos/Antiun/partner-contact/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Antiun/partner-contact/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Antiun/partner-contact/git/refs{/sha}","trees_url":"https://api.github.com/repos/Antiun/partner-contact/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Antiun/partner-contact/statuses/{sha}","languages_url":"https://api.github.com/repos/Antiun/partner-contact/languages","stargazers_url":"https://api.github.com/repos/Antiun/partner-contact/stargazers","contributors_url":"https://api.github.com/repos/Antiun/partner-contact/contributors","subscribers_url":"https://api.github.com/repos/Antiun/partner-contact/subscribers","subscription_url":"https://api.github.com/repos/Antiun/partner-contact/subscription","commits_url":"https://api.github.com/repos/Antiun/partner-contact/commits{/sha}","git_commits_url":"https://api.github.com/repos/Antiun/partner-contact/git/commits{/sha}","comments_url":"https://api.github.com/repos/Antiun/partner-contact/comments{/number}","issue_comment_url":"https://api.github.com/repos/Antiun/partner-contact/issues/comments{/number}","contents_url":"https://api.github.com/repos/Antiun/partner-contact/contents/{+path}","compare_url":"https://api.github.com/repos/Antiun/partner-contact/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Antiun/partner-contact/merges","archive_url":"https://api.github.com/repos/Antiun/partner-contact/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Antiun/partner-contact/downloads","issues_url":"https://api.github.com/repos/Antiun/partner-contact/issues{/number}","pulls_url":"https://api.github.com/repos/Antiun/partner-contact/pulls{/number}","milestones_url":"https://api.github.com/repos/Antiun/partner-contact/milestones{/number}","notifications_url":"https://api.github.com/repos/Antiun/partner-contact/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Antiun/partner-contact/labels{/name}","releases_url":"https://api.github.com/repos/Antiun/partner-contact/releases{/id}","created_at":"2014-09-18T17:58:26Z","updated_at":"2015-05-08T09:41:12Z","pushed_at":"2015-12-21T16:29:30Z","git_url":"git://github.com/Antiun/partner-contact.git","ssh_url":"git@github.com:Antiun/partner-contact.git","clone_url":"https://github.com/Antiun/partner-contact.git","svn_url":"https://github.com/Antiun/partner-contact","homepage":null,"size":1324,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"8.0"}},"base":{"label":"OCA:8.0","ref":"8.0","sha":"21c3235c60e76eaaf49ced1ff9cff456bb6f0796","user":{"login":"OCA","id":7600578,"avatar_url":"https://avatars.githubusercontent.com/u/7600578?v=3","gravatar_id":"","url":"https://api.github.com/users/OCA","html_url":"https://github.com/OCA","followers_url":"https://api.github.com/users/OCA/followers","following_url":"https://api.github.com/users/OCA/following{/other_user}","gists_url":"https://api.github.com/users/OCA/gists{/gist_id}","starred_url":"https://api.github.com/users/OCA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OCA/subscriptions","organizations_url":"https://api.github.com/users/OCA/orgs","repos_url":"https://api.github.com/users/OCA/repos","events_url":"https://api.github.com/users/OCA/events{/privacy}","received_events_url":"https://api.github.com/users/OCA/received_events","type":"Organization","site_admin":false},"repo":{"id":20922147,"name":"partner-contact","full_name":"OCA/partner-contact","owner":{"login":"OCA","id":7600578,"avatar_url":"https://avatars.githubusercontent.com/u/7600578?v=3","gravatar_id":"","url":"https://api.github.com/users/OCA","html_url":"https://github.com/OCA","followers_url":"https://api.github.com/users/OCA/followers","following_url":"https://api.github.com/users/OCA/following{/other_user}","gists_url":"https://api.github.com/users/OCA/gists{/gist_id}","starred_url":"https://api.github.com/users/OCA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OCA/subscriptions","organizations_url":"https://api.github.com/users/OCA/orgs","repos_url":"https://api.github.com/users/OCA/repos","events_url":"https://api.github.com/users/OCA/events{/privacy}","received_events_url":"https://api.github.com/users/OCA/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OCA/partner-contact","description":"Odoo Partner and Contact related addons","fork":false,"url":"https://api.github.com/repos/OCA/partner-contact","forks_url":"https://api.github.com/repos/OCA/partner-contact/forks","keys_url":"https://api.github.com/repos/OCA/partner-contact/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OCA/partner-contact/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OCA/partner-contact/teams","hooks_url":"https://api.github.com/repos/OCA/partner-contact/hooks","issue_events_url":"https://api.github.com/repos/OCA/partner-contact/issues/events{/number}","events_url":"https://api.github.com/repos/OCA/partner-contact/events","assignees_url":"https://api.github.com/repos/OCA/partner-contact/assignees{/user}","branches_url":"https://api.github.com/repos/OCA/partner-contact/branches{/branch}","tags_url":"https://api.github.com/repos/OCA/partner-contact/tags","blobs_url":"https://api.github.com/repos/OCA/partner-contact/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OCA/partner-contact/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OCA/partner-contact/git/refs{/sha}","trees_url":"https://api.github.com/repos/OCA/partner-contact/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OCA/partner-contact/statuses/{sha}","languages_url":"https://api.github.com/repos/OCA/partner-contact/languages","stargazers_url":"https://api.github.com/repos/OCA/partner-contact/stargazers","contributors_url":"https://api.github.com/repos/OCA/partner-contact/contributors","subscribers_url":"https://api.github.com/repos/OCA/partner-contact/subscribers","subscription_url":"https://api.github.com/repos/OCA/partner-contact/subscription","commits_url":"https://api.github.com/repos/OCA/partner-contact/commits{/sha}","git_commits_url":"https://api.github.com/repos/OCA/partner-contact/git/commits{/sha}","comments_url":"https://api.github.com/repos/OCA/partner-contact/comments{/number}","issue_comment_url":"https://api.github.com/repos/OCA/partner-contact/issues/comments{/number}","contents_url":"https://api.github.com/repos/OCA/partner-contact/contents/{+path}","compare_url":"https://api.github.com/repos/OCA/partner-contact/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OCA/partner-contact/merges","archive_url":"https://api.github.com/repos/OCA/partner-contact/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OCA/partner-contact/downloads","issues_url":"https://api.github.com/repos/OCA/partner-contact/issues{/number}","pulls_url":"https://api.github.com/repos/OCA/partner-contact/pulls{/number}","milestones_url":"https://api.github.com/repos/OCA/partner-contact/milestones{/number}","notifications_url":"https://api.github.com/repos/OCA/partner-contact/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OCA/partner-contact/labels{/name}","releases_url":"https://api.github.com/repos/OCA/partner-contact/releases{/id}","created_at":"2014-06-17T12:19:26Z","updated_at":"2015-12-01T07:17:33Z","pushed_at":"2015-12-22T00:41:10Z","git_url":"git://github.com/OCA/partner-contact.git","ssh_url":"git@github.com:OCA/partner-contact.git","clone_url":"https://github.com/OCA/partner-contact.git","svn_url":"https://github.com/OCA/partner-contact","homepage":"","size":3407,"stargazers_count":33,"watchers_count":33,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":126,"mirror_url":null,"open_issues_count":48,"forks":126,"open_issues":48,"watchers":33,"default_branch":"9.0"}},"_links":{"self":{"href":"https://api.github.com/repos/OCA/partner-contact/pulls/227"},"html":{"href":"https://github.com/OCA/partner-contact/pull/227"},"issue":{"href":"https://api.github.com/repos/OCA/partner-contact/issues/227"},"comments":{"href":"https://api.github.com/repos/OCA/partner-contact/issues/227/comments"},"review_comments":{"href":"https://api.github.com/repos/OCA/partner-contact/pulls/227/comments"},"review_comment":{"href":"https://api.github.com/repos/OCA/partner-contact/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OCA/partner-contact/pulls/227/commits"},"statuses":{"href":"https://api.github.com/repos/OCA/partner-contact/statuses/7128c44a0c040d017c511dbd4c767bea4f879740"}}}}