{"action":"created","comment":{"url":"https://api.github.com/repos/OCA/website/pulls/comments/64990832","id":64990832,"diff_hunk":"@@ -0,0 +1,36 @@\n+# -*- coding: utf-8 -*-\n+# © 2016 Jairo Llopis <jairo.llopis@tecnativa.com>\n+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).\n+\n+from openerp.addons.mass_mailing.controllers.main import MassMailController\n+from openerp.http import request, route\n+\n+\n+class MassMailingPartner(MassMailController):\n+    @route()\n+    def subscribe(self, list_id, email, **post):\n+        \"\"\"Handle name if provided.\"\"\"\n+        result = super(MassMailingPartner, self).subscribe(\n+            list_id, email, **post)\n+        name = post.get(\"name\")\n+        if name:\n+            Contact = request.env[\"mail.mass_mailing.contact\"].sudo()\n+            Partner = request.env[\"res.partner\"].sudo()\n+            contacts = Contact.search([\n+                (\"email\", \"=ilike\", email),\n+                (\"list_id\", \"=\", int(list_id)),\n+                (\"opt_out\", \"=\", False),\n+            ])\n+            partner = Partner.search(\n+                [(\"email\", \"=ilike\", email), (\"name\", \"=ilike\", name)],\n+                limit=1)\n+            if not partner:\n+                partner = Partner.create({\n+                    \"name\": name,\n+                    \"email\": email,\n+                })\n+            partner.opt_out = True","path":"website_snippet_mass_mailing_partner/controllers/main.py","position":32,"original_position":32,"commit_id":"2034582008c2e9d702b1fd451a4a908976d757a1","original_commit_id":"2034582008c2e9d702b1fd451a4a908976d757a1","user":{"login":"pedrobaeza","id":7165771,"avatar_url":"https://avatars.githubusercontent.com/u/7165771?v=3","gravatar_id":"","url":"https://api.github.com/users/pedrobaeza","html_url":"https://github.com/pedrobaeza","followers_url":"https://api.github.com/users/pedrobaeza/followers","following_url":"https://api.github.com/users/pedrobaeza/following{/other_user}","gists_url":"https://api.github.com/users/pedrobaeza/gists{/gist_id}","starred_url":"https://api.github.com/users/pedrobaeza/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedrobaeza/subscriptions","organizations_url":"https://api.github.com/users/pedrobaeza/orgs","repos_url":"https://api.github.com/users/pedrobaeza/repos","events_url":"https://api.github.com/users/pedrobaeza/events{/privacy}","received_events_url":"https://api.github.com/users/pedrobaeza/received_events","type":"User","site_admin":false},"body":"Are you excluding the partner? The correct value is False I think","created_at":"2016-05-28T16:14:32Z","updated_at":"2016-05-28T16:14:32Z","html_url":"https://github.com/OCA/website/pull/201#discussion_r64990832","pull_request_url":"https://api.github.com/repos/OCA/website/pulls/201","_links":{"self":{"href":"https://api.github.com/repos/OCA/website/pulls/comments/64990832"},"html":{"href":"https://github.com/OCA/website/pull/201#discussion_r64990832"},"pull_request":{"href":"https://api.github.com/repos/OCA/website/pulls/201"}}},"pull_request":{"url":"https://api.github.com/repos/OCA/website/pulls/201","id":71239219,"html_url":"https://github.com/OCA/website/pull/201","diff_url":"https://github.com/OCA/website/pull/201.diff","patch_url":"https://github.com/OCA/website/pull/201.patch","issue_url":"https://api.github.com/repos/OCA/website/issues/201","number":201,"state":"open","locked":false,"title":"[8.0][ADD][website_snippet_mass_mailing_partner] Snippet + name","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":"Let you have the name field in the mass mailing subscription snippet.\r\n\r\nWhen somebody tells his name, a partner is linked (if a match is found) or created.\r\n\r\n@Tecnativa.","created_at":"2016-05-24T15:16:05Z","updated_at":"2016-05-28T16:14:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"022e71658ecc90c17ec06972f24b66349a343874","assignee":null,"milestone":{"url":"https://api.github.com/repos/OCA/website/milestones/1","html_url":"https://github.com/OCA/website/milestones/8.0","labels_url":"https://api.github.com/repos/OCA/website/milestones/1/labels","id":1008112,"number":1,"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":22,"closed_issues":41,"state":"open","created_at":"2015-03-05T19:45:03Z","updated_at":"2016-05-28T14:37:05Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/OCA/website/pulls/201/commits","review_comments_url":"https://api.github.com/repos/OCA/website/pulls/201/comments","review_comment_url":"https://api.github.com/repos/OCA/website/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OCA/website/issues/201/comments","statuses_url":"https://api.github.com/repos/OCA/website/statuses/2034582008c2e9d702b1fd451a4a908976d757a1","head":{"label":"Tecnativa:8.0-website_snippet_mass_mailing_partner","ref":"8.0-website_snippet_mass_mailing_partner","sha":"2034582008c2e9d702b1fd451a4a908976d757a1","user":{"login":"Tecnativa","id":18120193,"avatar_url":"https://avatars.githubusercontent.com/u/18120193?v=3","gravatar_id":"","url":"https://api.github.com/users/Tecnativa","html_url":"https://github.com/Tecnativa","followers_url":"https://api.github.com/users/Tecnativa/followers","following_url":"https://api.github.com/users/Tecnativa/following{/other_user}","gists_url":"https://api.github.com/users/Tecnativa/gists{/gist_id}","starred_url":"https://api.github.com/users/Tecnativa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tecnativa/subscriptions","organizations_url":"https://api.github.com/users/Tecnativa/orgs","repos_url":"https://api.github.com/users/Tecnativa/repos","events_url":"https://api.github.com/users/Tecnativa/events{/privacy}","received_events_url":"https://api.github.com/users/Tecnativa/received_events","type":"Organization","site_admin":false},"repo":{"id":56678590,"name":"website","full_name":"Tecnativa/website","owner":{"login":"Tecnativa","id":18120193,"avatar_url":"https://avatars.githubusercontent.com/u/18120193?v=3","gravatar_id":"","url":"https://api.github.com/users/Tecnativa","html_url":"https://github.com/Tecnativa","followers_url":"https://api.github.com/users/Tecnativa/followers","following_url":"https://api.github.com/users/Tecnativa/following{/other_user}","gists_url":"https://api.github.com/users/Tecnativa/gists{/gist_id}","starred_url":"https://api.github.com/users/Tecnativa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tecnativa/subscriptions","organizations_url":"https://api.github.com/users/Tecnativa/orgs","repos_url":"https://api.github.com/users/Tecnativa/repos","events_url":"https://api.github.com/users/Tecnativa/events{/privacy}","received_events_url":"https://api.github.com/users/Tecnativa/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Tecnativa/website","description":"Odoo website builder addons","fork":true,"url":"https://api.github.com/repos/Tecnativa/website","forks_url":"https://api.github.com/repos/Tecnativa/website/forks","keys_url":"https://api.github.com/repos/Tecnativa/website/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Tecnativa/website/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Tecnativa/website/teams","hooks_url":"https://api.github.com/repos/Tecnativa/website/hooks","issue_events_url":"https://api.github.com/repos/Tecnativa/website/issues/events{/number}","events_url":"https://api.github.com/repos/Tecnativa/website/events","assignees_url":"https://api.github.com/repos/Tecnativa/website/assignees{/user}","branches_url":"https://api.github.com/repos/Tecnativa/website/branches{/branch}","tags_url":"https://api.github.com/repos/Tecnativa/website/tags","blobs_url":"https://api.github.com/repos/Tecnativa/website/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Tecnativa/website/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Tecnativa/website/git/refs{/sha}","trees_url":"https://api.github.com/repos/Tecnativa/website/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Tecnativa/website/statuses/{sha}","languages_url":"https://api.github.com/repos/Tecnativa/website/languages","stargazers_url":"https://api.github.com/repos/Tecnativa/website/stargazers","contributors_url":"https://api.github.com/repos/Tecnativa/website/contributors","subscribers_url":"https://api.github.com/repos/Tecnativa/website/subscribers","subscription_url":"https://api.github.com/repos/Tecnativa/website/subscription","commits_url":"https://api.github.com/repos/Tecnativa/website/commits{/sha}","git_commits_url":"https://api.github.com/repos/Tecnativa/website/git/commits{/sha}","comments_url":"https://api.github.com/repos/Tecnativa/website/comments{/number}","issue_comment_url":"https://api.github.com/repos/Tecnativa/website/issues/comments{/number}","contents_url":"https://api.github.com/repos/Tecnativa/website/contents/{+path}","compare_url":"https://api.github.com/repos/Tecnativa/website/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Tecnativa/website/merges","archive_url":"https://api.github.com/repos/Tecnativa/website/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Tecnativa/website/downloads","issues_url":"https://api.github.com/repos/Tecnativa/website/issues{/number}","pulls_url":"https://api.github.com/repos/Tecnativa/website/pulls{/number}","milestones_url":"https://api.github.com/repos/Tecnativa/website/milestones{/number}","notifications_url":"https://api.github.com/repos/Tecnativa/website/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Tecnativa/website/labels{/name}","releases_url":"https://api.github.com/repos/Tecnativa/website/releases{/id}","deployments_url":"https://api.github.com/repos/Tecnativa/website/deployments","created_at":"2016-04-20T10:40:00Z","updated_at":"2016-04-20T10:40:01Z","pushed_at":"2016-05-27T16:05:59Z","git_url":"git://github.com/Tecnativa/website.git","ssh_url":"git@github.com:Tecnativa/website.git","clone_url":"https://github.com/Tecnativa/website.git","svn_url":"https://github.com/Tecnativa/website","homepage":"","size":6074,"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":"9.0"}},"base":{"label":"OCA:8.0","ref":"8.0","sha":"92a85d5be7330924171a7ce3d69713cf251a903a","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":21942491,"name":"website","full_name":"OCA/website","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/website","description":"Odoo website builder addons","fork":false,"url":"https://api.github.com/repos/OCA/website","forks_url":"https://api.github.com/repos/OCA/website/forks","keys_url":"https://api.github.com/repos/OCA/website/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OCA/website/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OCA/website/teams","hooks_url":"https://api.github.com/repos/OCA/website/hooks","issue_events_url":"https://api.github.com/repos/OCA/website/issues/events{/number}","events_url":"https://api.github.com/repos/OCA/website/events","assignees_url":"https://api.github.com/repos/OCA/website/assignees{/user}","branches_url":"https://api.github.com/repos/OCA/website/branches{/branch}","tags_url":"https://api.github.com/repos/OCA/website/tags","blobs_url":"https://api.github.com/repos/OCA/website/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OCA/website/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OCA/website/git/refs{/sha}","trees_url":"https://api.github.com/repos/OCA/website/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OCA/website/statuses/{sha}","languages_url":"https://api.github.com/repos/OCA/website/languages","stargazers_url":"https://api.github.com/repos/OCA/website/stargazers","contributors_url":"https://api.github.com/repos/OCA/website/contributors","subscribers_url":"https://api.github.com/repos/OCA/website/subscribers","subscription_url":"https://api.github.com/repos/OCA/website/subscription","commits_url":"https://api.github.com/repos/OCA/website/commits{/sha}","git_commits_url":"https://api.github.com/repos/OCA/website/git/commits{/sha}","comments_url":"https://api.github.com/repos/OCA/website/comments{/number}","issue_comment_url":"https://api.github.com/repos/OCA/website/issues/comments{/number}","contents_url":"https://api.github.com/repos/OCA/website/contents/{+path}","compare_url":"https://api.github.com/repos/OCA/website/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OCA/website/merges","archive_url":"https://api.github.com/repos/OCA/website/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OCA/website/downloads","issues_url":"https://api.github.com/repos/OCA/website/issues{/number}","pulls_url":"https://api.github.com/repos/OCA/website/pulls{/number}","milestones_url":"https://api.github.com/repos/OCA/website/milestones{/number}","notifications_url":"https://api.github.com/repos/OCA/website/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OCA/website/labels{/name}","releases_url":"https://api.github.com/repos/OCA/website/releases{/id}","deployments_url":"https://api.github.com/repos/OCA/website/deployments","created_at":"2014-07-17T13:16:54Z","updated_at":"2016-05-18T12:11:23Z","pushed_at":"2016-05-27T15:30:57Z","git_url":"git://github.com/OCA/website.git","ssh_url":"git@github.com:OCA/website.git","clone_url":"https://github.com/OCA/website.git","svn_url":"https://github.com/OCA/website","homepage":"","size":14030,"stargazers_count":44,"watchers_count":44,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":143,"mirror_url":null,"open_issues_count":51,"forks":143,"open_issues":51,"watchers":44,"default_branch":"9.0"}},"_links":{"self":{"href":"https://api.github.com/repos/OCA/website/pulls/201"},"html":{"href":"https://github.com/OCA/website/pull/201"},"issue":{"href":"https://api.github.com/repos/OCA/website/issues/201"},"comments":{"href":"https://api.github.com/repos/OCA/website/issues/201/comments"},"review_comments":{"href":"https://api.github.com/repos/OCA/website/pulls/201/comments"},"review_comment":{"href":"https://api.github.com/repos/OCA/website/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OCA/website/pulls/201/commits"},"statuses":{"href":"https://api.github.com/repos/OCA/website/statuses/2034582008c2e9d702b1fd451a4a908976d757a1"}}}}
{"actor":{"display_login":"pedrobaeza"}}