{"action":"created","comment":{"url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/comments/82813063","pull_request_review_id":3693856,"id":82813063,"diff_hunk":"@@ -0,0 +1,75 @@\n+# -*- coding: utf-8 -*-\n+# © 2016 Jos De Graeve - Apertoso N.V. <Jos.DeGraeve@apertoso.be>\n+# © 2016 Carlos Dauden - Tecnativa <carlos.dauden@tecnativa.com>\n+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).\n+\n+from openerp import models, fields, api, _\n+\n+\n+class ProductPutawayStrategy(models.Model):\n+    _inherit = 'product.putaway'\n+\n+    @api.model\n+    def _get_putaway_options(self):\n+        ret = super(ProductPutawayStrategy, self)._get_putaway_options()\n+        return ret + [('per_product', 'Fixed per product location')]\n+\n+    product_location_ids = fields.One2many(\n+        comodel_name='stock.product.putaway.strategy',\n+        inverse_name='putaway_id',\n+        string='Fixed per product location',\n+        copy=True)\n+    method = fields.Selection(selection=_get_putaway_options)\n+\n+    @api.model\n+    def putaway_apply(self, putaway_strategy, product):\n+        if putaway_strategy.method == 'per_product':\n+            offset = self.env.context.get('starting_strategy', 0)\n+            strategy = putaway_strategy.product_location_ids.filtered(\n+                lambda x: (x.product_product_id == product or\n+                           (not x.product_product_id and\n+                            x.product_tmpl_id == product.product_tmpl_id))\n+            )[offset:offset+1]","path":"stock_putaway_product/models/product_putaway.py","position":32,"original_position":32,"commit_id":"643252a7a66b814ccba20479a16529f5b7273eb4","original_commit_id":"643252a7a66b814ccba20479a16529f5b7273eb4","user":{"login":"gurneyalex","id":2032807,"avatar_url":"https://avatars.githubusercontent.com/u/2032807?v=3","gravatar_id":"","url":"https://api.github.com/users/gurneyalex","html_url":"https://github.com/gurneyalex","followers_url":"https://api.github.com/users/gurneyalex/followers","following_url":"https://api.github.com/users/gurneyalex/following{/other_user}","gists_url":"https://api.github.com/users/gurneyalex/gists{/gist_id}","starred_url":"https://api.github.com/users/gurneyalex/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gurneyalex/subscriptions","organizations_url":"https://api.github.com/users/gurneyalex/orgs","repos_url":"https://api.github.com/users/gurneyalex/repos","events_url":"https://api.github.com/users/gurneyalex/events{/privacy}","received_events_url":"https://api.github.com/users/gurneyalex/received_events","type":"User","site_admin":false},"body":"using `filtered` here seems very convoluted to me, especially since for some weird reason `offset` comes from the context. \r\n\r\nUsing `[offset:offset+1]` over `[offset]` only makes sense if the offset may be greater than the number of filtered results, in which case `strategy` will be an empty resultset and the method returns `None`. \r\n\r\nCould you add some documentation on the behavior of this method?","created_at":"2016-10-11T15:01:11Z","updated_at":"2016-10-11T15:02:31Z","html_url":"https://github.com/OCA/stock-logistics-warehouse/pull/197#discussion_r82813063","pull_request_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/197","_links":{"self":{"href":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/comments/82813063"},"html":{"href":"https://github.com/OCA/stock-logistics-warehouse/pull/197#discussion_r82813063"},"pull_request":{"href":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/197"}}},"pull_request":{"url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/197","id":87348763,"html_url":"https://github.com/OCA/stock-logistics-warehouse/pull/197","diff_url":"https://github.com/OCA/stock-logistics-warehouse/pull/197.diff","patch_url":"https://github.com/OCA/stock-logistics-warehouse/pull/197.patch","issue_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/issues/197","number":197,"state":"open","locked":false,"title":"9.0 stock_putaway_product: Migration to v9.0","user":{"login":"carlosdauden","id":7701001,"avatar_url":"https://avatars.githubusercontent.com/u/7701001?v=3","gravatar_id":"","url":"https://api.github.com/users/carlosdauden","html_url":"https://github.com/carlosdauden","followers_url":"https://api.github.com/users/carlosdauden/followers","following_url":"https://api.github.com/users/carlosdauden/following{/other_user}","gists_url":"https://api.github.com/users/carlosdauden/gists{/gist_id}","starred_url":"https://api.github.com/users/carlosdauden/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlosdauden/subscriptions","organizations_url":"https://api.github.com/users/carlosdauden/orgs","repos_url":"https://api.github.com/users/carlosdauden/repos","events_url":"https://api.github.com/users/carlosdauden/events{/privacy}","received_events_url":"https://api.github.com/users/carlosdauden/received_events","type":"User","site_admin":false},"body":"This module extends the functionality of the odoo putaway strategy.\r\nIt defines a new type of putaway strategy where users can set a specific\r\nstock location per product.\r\n\r\n@Tecnativa","created_at":"2016-09-29T16:32:35Z","updated_at":"2016-10-11T15:02:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"55fb7af11c4756c9ef904ee856de8f3465f7d015","assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/milestones/4","html_url":"https://github.com/OCA/stock-logistics-warehouse/milestones/9.0","labels_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/milestones/4/labels","id":1354406,"number":4,"title":"9.0","description":null,"creator":{"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},"open_issues":5,"closed_issues":0,"state":"open","created_at":"2015-10-14T00:54:56Z","updated_at":"2016-10-11T14:51:24Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/197/commits","review_comments_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/197/comments","review_comment_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/issues/197/comments","statuses_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/statuses/643252a7a66b814ccba20479a16529f5b7273eb4","head":{"label":"Tecnativa:9.0-stock_putaway_product","ref":"9.0-stock_putaway_product","sha":"643252a7a66b814ccba20479a16529f5b7273eb4","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":69551981,"name":"stock-logistics-warehouse","full_name":"Tecnativa/stock-logistics-warehouse","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/stock-logistics-warehouse","description":"Odoo Warehouse Management Addons","fork":true,"url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse","forks_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/forks","keys_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/teams","hooks_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/hooks","issue_events_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/issues/events{/number}","events_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/events","assignees_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/assignees{/user}","branches_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/branches{/branch}","tags_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/tags","blobs_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/git/refs{/sha}","trees_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/statuses/{sha}","languages_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/languages","stargazers_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/stargazers","contributors_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/contributors","subscribers_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/subscribers","subscription_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/subscription","commits_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/commits{/sha}","git_commits_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/git/commits{/sha}","comments_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/comments{/number}","issue_comment_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/issues/comments{/number}","contents_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/contents/{+path}","compare_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/merges","archive_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/downloads","issues_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/issues{/number}","pulls_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/pulls{/number}","milestones_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/milestones{/number}","notifications_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/labels{/name}","releases_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/releases{/id}","deployments_url":"https://api.github.com/repos/Tecnativa/stock-logistics-warehouse/deployments","created_at":"2016-09-29T09:21:05Z","updated_at":"2016-09-29T09:21:07Z","pushed_at":"2016-10-11T13:14:40Z","git_url":"git://github.com/Tecnativa/stock-logistics-warehouse.git","ssh_url":"git@github.com:Tecnativa/stock-logistics-warehouse.git","clone_url":"https://github.com/Tecnativa/stock-logistics-warehouse.git","svn_url":"https://github.com/Tecnativa/stock-logistics-warehouse","homepage":"","size":2429,"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:9.0","ref":"9.0","sha":"8521623af29a5fa75f02504a7be96b92ccab2eb7","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":20891354,"name":"stock-logistics-warehouse","full_name":"OCA/stock-logistics-warehouse","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/stock-logistics-warehouse","description":"Odoo Warehouse Management Addons","fork":false,"url":"https://api.github.com/repos/OCA/stock-logistics-warehouse","forks_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/forks","keys_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/teams","hooks_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/hooks","issue_events_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/issues/events{/number}","events_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/events","assignees_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/assignees{/user}","branches_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/branches{/branch}","tags_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/tags","blobs_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/git/refs{/sha}","trees_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/statuses/{sha}","languages_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/languages","stargazers_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/stargazers","contributors_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/contributors","subscribers_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/subscribers","subscription_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/subscription","commits_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/commits{/sha}","git_commits_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/git/commits{/sha}","comments_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/comments{/number}","issue_comment_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/issues/comments{/number}","contents_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/contents/{+path}","compare_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/merges","archive_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/downloads","issues_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/issues{/number}","pulls_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls{/number}","milestones_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/milestones{/number}","notifications_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/labels{/name}","releases_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/releases{/id}","deployments_url":"https://api.github.com/repos/OCA/stock-logistics-warehouse/deployments","created_at":"2014-06-16T16:08:03Z","updated_at":"2016-09-07T21:14:34Z","pushed_at":"2016-10-11T14:44:39Z","git_url":"git://github.com/OCA/stock-logistics-warehouse.git","ssh_url":"git@github.com:OCA/stock-logistics-warehouse.git","clone_url":"https://github.com/OCA/stock-logistics-warehouse.git","svn_url":"https://github.com/OCA/stock-logistics-warehouse","homepage":"","size":3693,"stargazers_count":34,"watchers_count":34,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":130,"mirror_url":null,"open_issues_count":60,"forks":130,"open_issues":60,"watchers":34,"default_branch":"10.0"}},"_links":{"self":{"href":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/197"},"html":{"href":"https://github.com/OCA/stock-logistics-warehouse/pull/197"},"issue":{"href":"https://api.github.com/repos/OCA/stock-logistics-warehouse/issues/197"},"comments":{"href":"https://api.github.com/repos/OCA/stock-logistics-warehouse/issues/197/comments"},"review_comments":{"href":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/197/comments"},"review_comment":{"href":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OCA/stock-logistics-warehouse/pulls/197/commits"},"statuses":{"href":"https://api.github.com/repos/OCA/stock-logistics-warehouse/statuses/643252a7a66b814ccba20479a16529f5b7273eb4"}}}}
{"actor":{"display_login":"gurneyalex"}}