{"action":"created","comment":{"url":"https://api.github.com/repos/OCA/partner-contact/pulls/comments/43640344","id":43640344,"diff_hunk":"@@ -0,0 +1,81 @@\n+# -*- coding: utf-8 -*-\n+# © 2015 Grupo ESOC Ingeniería de Servicios, S.L. - Jairo Llopis.\n+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).\n+\n+\"\"\"Test default values for models.\"\"\"\n+\n+from openerp.tests.common import TransactionCase\n+from .base import MailInstalled\n+\n+\n+class PersonCase(TransactionCase):\n+    \"\"\"Test ``res.partner`` when it is a person.\"\"\"\n+    context = {\"default_is_company\": False}\n+    model = \"res.partner\"\n+\n+    def setUp(self):\n+        super(PersonCase, self).setUp()\n+        self.good_values = {\n+            \"firstname\": u\"Núñez\",\n+            \"lastname\": u\"Fernán\",\n+        }\n+        self.good_values[\"name\"] = \"%s %s\" % (self.good_values[\"lastname\"],\n+                                              self.good_values[\"firstname\"])\n+        if \"default_is_company\" in self.context:\n+            self.good_values[\"is_company\"] = self.context[\"default_is_company\"]\n+        self.values = self.good_values.copy()\n+\n+    def tearDown(self):\n+        self.record = (self.env[self.model]\n+                       .with_context(self.context)\n+                       .create(self.values))\n+\n+        for key, value in self.good_values.iteritems():\n+            self.assertEqual(\n+                self.record[key],\n+                value,\n+                \"Checking key %s\" % key)\n+\n+        super(PersonCase, self).tearDown()\n+\n+    def test_no_name(self):\n+        \"\"\"Name is calculated.\"\"\"\n+        del self.values[\"name\"]\n+\n+    def test_wrong_name_value(self):\n+        \"\"\"Wrong name value is ignored, name is calculated.\"\"\"\n+        self.values[\"name\"] = u\"BÄD\"\n+\n+    def test_wrong_name_context(self):\n+        \"\"\"Wrong name context is ignored, name is calculated.\"\"\"\n+        del self.values[\"name\"]\n+        self.context[\"default_name\"] = u\"BÄD\"\n+\n+    def test_wrong_name_value_and_context(self):\n+        \"\"\"Wrong name value and context is ignored, name is calculated.\"\"\"\n+        self.values[\"name\"] = u\"BÄD1\"\n+        self.context[\"default_name\"] = u\"BÄD2\"\n+\n+\n+class CompanyCase(PersonCase):\n+    \"\"\"Test ``res.partner`` when it is a company.\"\"\"\n+    context = {\"default_is_company\": True}\n+\n+    def setUp(self):\n+        return super(CompanyCase, self).setUp()\n+        self.values.update(lastname=self.values[\"name\"], firstname=False)","path":"partner_firstname/tests/test_create.py","position":66,"original_position":66,"commit_id":"d9655a5efb8e5604d1ab3d3c1fef8549933ef7e3","original_commit_id":"d9655a5efb8e5604d1ab3d3c1fef8549933ef7e3","user":{"login":"moylop260","id":6644187,"avatar_url":"https://avatars.githubusercontent.com/u/6644187?v=3","gravatar_id":"","url":"https://api.github.com/users/moylop260","html_url":"https://github.com/moylop260","followers_url":"https://api.github.com/users/moylop260/followers","following_url":"https://api.github.com/users/moylop260/following{/other_user}","gists_url":"https://api.github.com/users/moylop260/gists{/gist_id}","starred_url":"https://api.github.com/users/moylop260/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/moylop260/subscriptions","organizations_url":"https://api.github.com/users/moylop260/orgs","repos_url":"https://api.github.com/users/moylop260/repos","events_url":"https://api.github.com/users/moylop260/events{/privacy}","received_events_url":"https://api.github.com/users/moylop260/received_events","type":"User","site_admin":false},"body":"sentence after return","created_at":"2015-11-02T15:35:00Z","updated_at":"2015-11-02T15:35:00Z","html_url":"https://github.com/OCA/partner-contact/pull/198#discussion_r43640344","pull_request_url":"https://api.github.com/repos/OCA/partner-contact/pulls/198","_links":{"self":{"href":"https://api.github.com/repos/OCA/partner-contact/pulls/comments/43640344"},"html":{"href":"https://github.com/OCA/partner-contact/pull/198#discussion_r43640344"},"pull_request":{"href":"https://api.github.com/repos/OCA/partner-contact/pulls/198"}}},"pull_request":{"url":"https://api.github.com/repos/OCA/partner-contact/pulls/198","id":49416600,"html_url":"https://github.com/OCA/partner-contact/pull/198","diff_url":"https://github.com/OCA/partner-contact/pull/198.diff","patch_url":"https://github.com/OCA/partner-contact/pull/198.patch","issue_url":"https://api.github.com/repos/OCA/partner-contact/issues/198","number":198,"state":"open","locked":false,"title":"Allow creation of partners from *Create and Edit*.","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":"This fixes #78 and adds new tests for it.","created_at":"2015-11-02T10:40:26Z","updated_at":"2015-11-02T15:35:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"96ac171490db6adf4638c770bb813472626f0e53","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OCA/partner-contact/pulls/198/commits","review_comments_url":"https://api.github.com/repos/OCA/partner-contact/pulls/198/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/198/comments","statuses_url":"https://api.github.com/repos/OCA/partner-contact/statuses/d9655a5efb8e5604d1ab3d3c1fef8549933ef7e3","head":{"label":"grupoesoc:fix-78","ref":"fix-78","sha":"d9655a5efb8e5604d1ab3d3c1fef8549933ef7e3","user":{"login":"grupoesoc","id":8087470,"avatar_url":"https://avatars.githubusercontent.com/u/8087470?v=3","gravatar_id":"","url":"https://api.github.com/users/grupoesoc","html_url":"https://github.com/grupoesoc","followers_url":"https://api.github.com/users/grupoesoc/followers","following_url":"https://api.github.com/users/grupoesoc/following{/other_user}","gists_url":"https://api.github.com/users/grupoesoc/gists{/gist_id}","starred_url":"https://api.github.com/users/grupoesoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grupoesoc/subscriptions","organizations_url":"https://api.github.com/users/grupoesoc/orgs","repos_url":"https://api.github.com/users/grupoesoc/repos","events_url":"https://api.github.com/users/grupoesoc/events{/privacy}","received_events_url":"https://api.github.com/users/grupoesoc/received_events","type":"Organization","site_admin":false},"repo":{"id":27778881,"name":"partner-contact","full_name":"grupoesoc/partner-contact","owner":{"login":"grupoesoc","id":8087470,"avatar_url":"https://avatars.githubusercontent.com/u/8087470?v=3","gravatar_id":"","url":"https://api.github.com/users/grupoesoc","html_url":"https://github.com/grupoesoc","followers_url":"https://api.github.com/users/grupoesoc/followers","following_url":"https://api.github.com/users/grupoesoc/following{/other_user}","gists_url":"https://api.github.com/users/grupoesoc/gists{/gist_id}","starred_url":"https://api.github.com/users/grupoesoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grupoesoc/subscriptions","organizations_url":"https://api.github.com/users/grupoesoc/orgs","repos_url":"https://api.github.com/users/grupoesoc/repos","events_url":"https://api.github.com/users/grupoesoc/events{/privacy}","received_events_url":"https://api.github.com/users/grupoesoc/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/grupoesoc/partner-contact","description":"","fork":true,"url":"https://api.github.com/repos/grupoesoc/partner-contact","forks_url":"https://api.github.com/repos/grupoesoc/partner-contact/forks","keys_url":"https://api.github.com/repos/grupoesoc/partner-contact/keys{/key_id}","collaborators_url":"https://api.github.com/repos/grupoesoc/partner-contact/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/grupoesoc/partner-contact/teams","hooks_url":"https://api.github.com/repos/grupoesoc/partner-contact/hooks","issue_events_url":"https://api.github.com/repos/grupoesoc/partner-contact/issues/events{/number}","events_url":"https://api.github.com/repos/grupoesoc/partner-contact/events","assignees_url":"https://api.github.com/repos/grupoesoc/partner-contact/assignees{/user}","branches_url":"https://api.github.com/repos/grupoesoc/partner-contact/branches{/branch}","tags_url":"https://api.github.com/repos/grupoesoc/partner-contact/tags","blobs_url":"https://api.github.com/repos/grupoesoc/partner-contact/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/grupoesoc/partner-contact/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/grupoesoc/partner-contact/git/refs{/sha}","trees_url":"https://api.github.com/repos/grupoesoc/partner-contact/git/trees{/sha}","statuses_url":"https://api.github.com/repos/grupoesoc/partner-contact/statuses/{sha}","languages_url":"https://api.github.com/repos/grupoesoc/partner-contact/languages","stargazers_url":"https://api.github.com/repos/grupoesoc/partner-contact/stargazers","contributors_url":"https://api.github.com/repos/grupoesoc/partner-contact/contributors","subscribers_url":"https://api.github.com/repos/grupoesoc/partner-contact/subscribers","subscription_url":"https://api.github.com/repos/grupoesoc/partner-contact/subscription","commits_url":"https://api.github.com/repos/grupoesoc/partner-contact/commits{/sha}","git_commits_url":"https://api.github.com/repos/grupoesoc/partner-contact/git/commits{/sha}","comments_url":"https://api.github.com/repos/grupoesoc/partner-contact/comments{/number}","issue_comment_url":"https://api.github.com/repos/grupoesoc/partner-contact/issues/comments{/number}","contents_url":"https://api.github.com/repos/grupoesoc/partner-contact/contents/{+path}","compare_url":"https://api.github.com/repos/grupoesoc/partner-contact/compare/{base}...{head}","merges_url":"https://api.github.com/repos/grupoesoc/partner-contact/merges","archive_url":"https://api.github.com/repos/grupoesoc/partner-contact/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/grupoesoc/partner-contact/downloads","issues_url":"https://api.github.com/repos/grupoesoc/partner-contact/issues{/number}","pulls_url":"https://api.github.com/repos/grupoesoc/partner-contact/pulls{/number}","milestones_url":"https://api.github.com/repos/grupoesoc/partner-contact/milestones{/number}","notifications_url":"https://api.github.com/repos/grupoesoc/partner-contact/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/grupoesoc/partner-contact/labels{/name}","releases_url":"https://api.github.com/repos/grupoesoc/partner-contact/releases{/id}","created_at":"2014-12-09T17:47:34Z","updated_at":"2015-03-30T08:16:34Z","pushed_at":"2015-11-02T10:46:27Z","git_url":"git://github.com/grupoesoc/partner-contact.git","ssh_url":"git@github.com:grupoesoc/partner-contact.git","clone_url":"https://github.com/grupoesoc/partner-contact.git","svn_url":"https://github.com/grupoesoc/partner-contact","homepage":null,"size":1572,"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-custom"}},"base":{"label":"OCA:8.0","ref":"8.0","sha":"a266a74b410fdfbe0265299ca57b9d22cc0dc11a","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-10-14T20:12:10Z","pushed_at":"2015-11-02T10:46:27Z","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":3914,"stargazers_count":31,"watchers_count":31,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":110,"mirror_url":null,"open_issues_count":41,"forks":110,"open_issues":41,"watchers":31,"default_branch":"9.0"}},"_links":{"self":{"href":"https://api.github.com/repos/OCA/partner-contact/pulls/198"},"html":{"href":"https://github.com/OCA/partner-contact/pull/198"},"issue":{"href":"https://api.github.com/repos/OCA/partner-contact/issues/198"},"comments":{"href":"https://api.github.com/repos/OCA/partner-contact/issues/198/comments"},"review_comments":{"href":"https://api.github.com/repos/OCA/partner-contact/pulls/198/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/198/commits"},"statuses":{"href":"https://api.github.com/repos/OCA/partner-contact/statuses/d9655a5efb8e5604d1ab3d3c1fef8549933ef7e3"}}}}