{"action":"created","comment":{"url":"https://api.github.com/repos/unipartdigital/udes-open/pulls/comments/236087068","pull_request_review_id":178094361,"id":236087068,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzNjA4NzA2OA==","diff_hunk":"@@ -55,6 +87,159 @@ def _compute_priority(self):\n             if new_priority != batch.priority:\n                 batch.priority = new_priority\n \n+    @api.multi\n+    @api.constrains('user_id')\n+    def _compute_state(self):\n+        \"\"\" Compute the state of a batch post confirm\n+            waiting     : At least some picks are not ready\n+            ready       : All picks are in ready state (assigned)\n+            in_progress : All picks are ready and a user has been assigned\n+            done        : All picks are complete (in state done or cancel)\n+\n+            the other two states are draft and cancel are manual\n+            to transitions from or to the respective state.\n+        \"\"\"\n+        for batch in self:\n+\n+            if batch.state in ['draft', 'done', 'cancel']:\n+                # Can not do anything with them don't bother trying\n+                continue\n+\n+            ready_picks, other_picks = \\\n+                self._calculate_pick_groups(batch.picking_ids)\n+\n+            if not batch.picking_ids or not (ready_picks or other_picks):\n+                # This accounts for all pickings being complete, canceled or\n+                # all pickings get removed for some reason.\n+                # The last two can happen in any state\n+                batch.state = 'done'\n+\n+            # Attempt transitions based on state","path":"addons/udes_stock/models/stock_picking_batch.py","position":70,"original_position":70,"commit_id":"73c205789b80a7b7c1d12821ec300b604250dc26","original_commit_id":"73c205789b80a7b7c1d12821ec300b604250dc26","user":{"login":"parisiale","id":7150922,"node_id":"MDQ6VXNlcjcxNTA5MjI=","avatar_url":"https://avatars1.githubusercontent.com/u/7150922?v=4","gravatar_id":"","url":"https://api.github.com/users/parisiale","html_url":"https://github.com/parisiale","followers_url":"https://api.github.com/users/parisiale/followers","following_url":"https://api.github.com/users/parisiale/following{/other_user}","gists_url":"https://api.github.com/users/parisiale/gists{/gist_id}","starred_url":"https://api.github.com/users/parisiale/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/parisiale/subscriptions","organizations_url":"https://api.github.com/users/parisiale/orgs","repos_url":"https://api.github.com/users/parisiale/repos","events_url":"https://api.github.com/users/parisiale/events{/privacy}","received_events_url":"https://api.github.com/users/parisiale/received_events","type":"User","site_admin":false},"body":"I see the point of this comment, but it just ruins the `if` / `elif` indentation. Please remove the empty lines; you can't tell whether they go together at a glance.","created_at":"2018-11-25T19:44:37Z","updated_at":"2018-11-25T19:44:37Z","html_url":"https://github.com/unipartdigital/udes-open/pull/98#discussion_r236087068","pull_request_url":"https://api.github.com/repos/unipartdigital/udes-open/pulls/98","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/unipartdigital/udes-open/pulls/comments/236087068"},"html":{"href":"https://github.com/unipartdigital/udes-open/pull/98#discussion_r236087068"},"pull_request":{"href":"https://api.github.com/repos/unipartdigital/udes-open/pulls/98"}}},"pull_request":{"url":"https://api.github.com/repos/unipartdigital/udes-open/pulls/98","id":232687346,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMyNjg3MzQ2","html_url":"https://github.com/unipartdigital/udes-open/pull/98","diff_url":"https://github.com/unipartdigital/udes-open/pull/98.diff","patch_url":"https://github.com/unipartdigital/udes-open/pull/98.patch","issue_url":"https://api.github.com/repos/unipartdigital/udes-open/issues/98","number":98,"state":"open","locked":false,"title":"WIP: [ADD] udes_stock: Add more granular states to batch using pick state …","user":{"login":"nocturnalastro","id":8648919,"node_id":"MDQ6VXNlcjg2NDg5MTk=","avatar_url":"https://avatars3.githubusercontent.com/u/8648919?v=4","gravatar_id":"","url":"https://api.github.com/users/nocturnalastro","html_url":"https://github.com/nocturnalastro","followers_url":"https://api.github.com/users/nocturnalastro/followers","following_url":"https://api.github.com/users/nocturnalastro/following{/other_user}","gists_url":"https://api.github.com/users/nocturnalastro/gists{/gist_id}","starred_url":"https://api.github.com/users/nocturnalastro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nocturnalastro/subscriptions","organizations_url":"https://api.github.com/users/nocturnalastro/orgs","repos_url":"https://api.github.com/users/nocturnalastro/repos","events_url":"https://api.github.com/users/nocturnalastro/events{/privacy}","received_events_url":"https://api.github.com/users/nocturnalastro/received_events","type":"User","site_admin":false},"body":"…and user\r\n\r\nUser-story: 2163\r\nSigned-off-by: Michele Costa <michele.costa@unipart.io>","created_at":"2018-11-21T14:39:57Z","updated_at":"2018-11-25T19:44:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a8661694e26cb7a9400a21160a3abbc07b7afc96","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/unipartdigital/udes-open/pulls/98/commits","review_comments_url":"https://api.github.com/repos/unipartdigital/udes-open/pulls/98/comments","review_comment_url":"https://api.github.com/repos/unipartdigital/udes-open/pulls/comments{/number}","comments_url":"https://api.github.com/repos/unipartdigital/udes-open/issues/98/comments","statuses_url":"https://api.github.com/repos/unipartdigital/udes-open/statuses/73c205789b80a7b7c1d12821ec300b604250dc26","head":{"label":"unipartdigital:story/2163_micky","ref":"story/2163_micky","sha":"73c205789b80a7b7c1d12821ec300b604250dc26","user":{"login":"unipartdigital","id":34507666,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0NTA3NjY2","avatar_url":"https://avatars0.githubusercontent.com/u/34507666?v=4","gravatar_id":"","url":"https://api.github.com/users/unipartdigital","html_url":"https://github.com/unipartdigital","followers_url":"https://api.github.com/users/unipartdigital/followers","following_url":"https://api.github.com/users/unipartdigital/following{/other_user}","gists_url":"https://api.github.com/users/unipartdigital/gists{/gist_id}","starred_url":"https://api.github.com/users/unipartdigital/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unipartdigital/subscriptions","organizations_url":"https://api.github.com/users/unipartdigital/orgs","repos_url":"https://api.github.com/users/unipartdigital/repos","events_url":"https://api.github.com/users/unipartdigital/events{/privacy}","received_events_url":"https://api.github.com/users/unipartdigital/received_events","type":"Organization","site_admin":false},"repo":{"id":138622881,"node_id":"MDEwOlJlcG9zaXRvcnkxMzg2MjI4ODE=","name":"udes-open","full_name":"unipartdigital/udes-open","private":false,"owner":{"login":"unipartdigital","id":34507666,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0NTA3NjY2","avatar_url":"https://avatars0.githubusercontent.com/u/34507666?v=4","gravatar_id":"","url":"https://api.github.com/users/unipartdigital","html_url":"https://github.com/unipartdigital","followers_url":"https://api.github.com/users/unipartdigital/followers","following_url":"https://api.github.com/users/unipartdigital/following{/other_user}","gists_url":"https://api.github.com/users/unipartdigital/gists{/gist_id}","starred_url":"https://api.github.com/users/unipartdigital/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unipartdigital/subscriptions","organizations_url":"https://api.github.com/users/unipartdigital/orgs","repos_url":"https://api.github.com/users/unipartdigital/repos","events_url":"https://api.github.com/users/unipartdigital/events{/privacy}","received_events_url":"https://api.github.com/users/unipartdigital/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/unipartdigital/udes-open","description":"UDES open source components","fork":false,"url":"https://api.github.com/repos/unipartdigital/udes-open","forks_url":"https://api.github.com/repos/unipartdigital/udes-open/forks","keys_url":"https://api.github.com/repos/unipartdigital/udes-open/keys{/key_id}","collaborators_url":"https://api.github.com/repos/unipartdigital/udes-open/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/unipartdigital/udes-open/teams","hooks_url":"https://api.github.com/repos/unipartdigital/udes-open/hooks","issue_events_url":"https://api.github.com/repos/unipartdigital/udes-open/issues/events{/number}","events_url":"https://api.github.com/repos/unipartdigital/udes-open/events","assignees_url":"https://api.github.com/repos/unipartdigital/udes-open/assignees{/user}","branches_url":"https://api.github.com/repos/unipartdigital/udes-open/branches{/branch}","tags_url":"https://api.github.com/repos/unipartdigital/udes-open/tags","blobs_url":"https://api.github.com/repos/unipartdigital/udes-open/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/unipartdigital/udes-open/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/unipartdigital/udes-open/git/refs{/sha}","trees_url":"https://api.github.com/repos/unipartdigital/udes-open/git/trees{/sha}","statuses_url":"https://api.github.com/repos/unipartdigital/udes-open/statuses/{sha}","languages_url":"https://api.github.com/repos/unipartdigital/udes-open/languages","stargazers_url":"https://api.github.com/repos/unipartdigital/udes-open/stargazers","contributors_url":"https://api.github.com/repos/unipartdigital/udes-open/contributors","subscribers_url":"https://api.github.com/repos/unipartdigital/udes-open/subscribers","subscription_url":"https://api.github.com/repos/unipartdigital/udes-open/subscription","commits_url":"https://api.github.com/repos/unipartdigital/udes-open/commits{/sha}","git_commits_url":"https://api.github.com/repos/unipartdigital/udes-open/git/commits{/sha}","comments_url":"https://api.github.com/repos/unipartdigital/udes-open/comments{/number}","issue_comment_url":"https://api.github.com/repos/unipartdigital/udes-open/issues/comments{/number}","contents_url":"https://api.github.com/repos/unipartdigital/udes-open/contents/{+path}","compare_url":"https://api.github.com/repos/unipartdigital/udes-open/compare/{base}...{head}","merges_url":"https://api.github.com/repos/unipartdigital/udes-open/merges","archive_url":"https://api.github.com/repos/unipartdigital/udes-open/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/unipartdigital/udes-open/downloads","issues_url":"https://api.github.com/repos/unipartdigital/udes-open/issues{/number}","pulls_url":"https://api.github.com/repos/unipartdigital/udes-open/pulls{/number}","milestones_url":"https://api.github.com/repos/unipartdigital/udes-open/milestones{/number}","notifications_url":"https://api.github.com/repos/unipartdigital/udes-open/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/unipartdigital/udes-open/labels{/name}","releases_url":"https://api.github.com/repos/unipartdigital/udes-open/releases{/id}","deployments_url":"https://api.github.com/repos/unipartdigital/udes-open/deployments","created_at":"2018-06-25T16:40:40Z","updated_at":"2018-11-23T16:40:31Z","pushed_at":"2018-11-25T12:51:13Z","git_url":"git://github.com/unipartdigital/udes-open.git","ssh_url":"git@github.com:unipartdigital/udes-open.git","clone_url":"https://github.com/unipartdigital/udes-open.git","svn_url":"https://github.com/unipartdigital/udes-open","homepage":null,"size":974,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":9,"license":null,"forks":1,"open_issues":9,"watchers":2,"default_branch":"master"}},"base":{"label":"unipartdigital:master","ref":"master","sha":"15720a7a43a756b56c4337d30c177af13581054d","user":{"login":"unipartdigital","id":34507666,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0NTA3NjY2","avatar_url":"https://avatars0.githubusercontent.com/u/34507666?v=4","gravatar_id":"","url":"https://api.github.com/users/unipartdigital","html_url":"https://github.com/unipartdigital","followers_url":"https://api.github.com/users/unipartdigital/followers","following_url":"https://api.github.com/users/unipartdigital/following{/other_user}","gists_url":"https://api.github.com/users/unipartdigital/gists{/gist_id}","starred_url":"https://api.github.com/users/unipartdigital/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unipartdigital/subscriptions","organizations_url":"https://api.github.com/users/unipartdigital/orgs","repos_url":"https://api.github.com/users/unipartdigital/repos","events_url":"https://api.github.com/users/unipartdigital/events{/privacy}","received_events_url":"https://api.github.com/users/unipartdigital/received_events","type":"Organization","site_admin":false},"repo":{"id":138622881,"node_id":"MDEwOlJlcG9zaXRvcnkxMzg2MjI4ODE=","name":"udes-open","full_name":"unipartdigital/udes-open","private":false,"owner":{"login":"unipartdigital","id":34507666,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM0NTA3NjY2","avatar_url":"https://avatars0.githubusercontent.com/u/34507666?v=4","gravatar_id":"","url":"https://api.github.com/users/unipartdigital","html_url":"https://github.com/unipartdigital","followers_url":"https://api.github.com/users/unipartdigital/followers","following_url":"https://api.github.com/users/unipartdigital/following{/other_user}","gists_url":"https://api.github.com/users/unipartdigital/gists{/gist_id}","starred_url":"https://api.github.com/users/unipartdigital/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/unipartdigital/subscriptions","organizations_url":"https://api.github.com/users/unipartdigital/orgs","repos_url":"https://api.github.com/users/unipartdigital/repos","events_url":"https://api.github.com/users/unipartdigital/events{/privacy}","received_events_url":"https://api.github.com/users/unipartdigital/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/unipartdigital/udes-open","description":"UDES open source components","fork":false,"url":"https://api.github.com/repos/unipartdigital/udes-open","forks_url":"https://api.github.com/repos/unipartdigital/udes-open/forks","keys_url":"https://api.github.com/repos/unipartdigital/udes-open/keys{/key_id}","collaborators_url":"https://api.github.com/repos/unipartdigital/udes-open/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/unipartdigital/udes-open/teams","hooks_url":"https://api.github.com/repos/unipartdigital/udes-open/hooks","issue_events_url":"https://api.github.com/repos/unipartdigital/udes-open/issues/events{/number}","events_url":"https://api.github.com/repos/unipartdigital/udes-open/events","assignees_url":"https://api.github.com/repos/unipartdigital/udes-open/assignees{/user}","branches_url":"https://api.github.com/repos/unipartdigital/udes-open/branches{/branch}","tags_url":"https://api.github.com/repos/unipartdigital/udes-open/tags","blobs_url":"https://api.github.com/repos/unipartdigital/udes-open/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/unipartdigital/udes-open/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/unipartdigital/udes-open/git/refs{/sha}","trees_url":"https://api.github.com/repos/unipartdigital/udes-open/git/trees{/sha}","statuses_url":"https://api.github.com/repos/unipartdigital/udes-open/statuses/{sha}","languages_url":"https://api.github.com/repos/unipartdigital/udes-open/languages","stargazers_url":"https://api.github.com/repos/unipartdigital/udes-open/stargazers","contributors_url":"https://api.github.com/repos/unipartdigital/udes-open/contributors","subscribers_url":"https://api.github.com/repos/unipartdigital/udes-open/subscribers","subscription_url":"https://api.github.com/repos/unipartdigital/udes-open/subscription","commits_url":"https://api.github.com/repos/unipartdigital/udes-open/commits{/sha}","git_commits_url":"https://api.github.com/repos/unipartdigital/udes-open/git/commits{/sha}","comments_url":"https://api.github.com/repos/unipartdigital/udes-open/comments{/number}","issue_comment_url":"https://api.github.com/repos/unipartdigital/udes-open/issues/comments{/number}","contents_url":"https://api.github.com/repos/unipartdigital/udes-open/contents/{+path}","compare_url":"https://api.github.com/repos/unipartdigital/udes-open/compare/{base}...{head}","merges_url":"https://api.github.com/repos/unipartdigital/udes-open/merges","archive_url":"https://api.github.com/repos/unipartdigital/udes-open/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/unipartdigital/udes-open/downloads","issues_url":"https://api.github.com/repos/unipartdigital/udes-open/issues{/number}","pulls_url":"https://api.github.com/repos/unipartdigital/udes-open/pulls{/number}","milestones_url":"https://api.github.com/repos/unipartdigital/udes-open/milestones{/number}","notifications_url":"https://api.github.com/repos/unipartdigital/udes-open/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/unipartdigital/udes-open/labels{/name}","releases_url":"https://api.github.com/repos/unipartdigital/udes-open/releases{/id}","deployments_url":"https://api.github.com/repos/unipartdigital/udes-open/deployments","created_at":"2018-06-25T16:40:40Z","updated_at":"2018-11-23T16:40:31Z","pushed_at":"2018-11-25T12:51:13Z","git_url":"git://github.com/unipartdigital/udes-open.git","ssh_url":"git@github.com:unipartdigital/udes-open.git","clone_url":"https://github.com/unipartdigital/udes-open.git","svn_url":"https://github.com/unipartdigital/udes-open","homepage":null,"size":974,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":9,"license":null,"forks":1,"open_issues":9,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/unipartdigital/udes-open/pulls/98"},"html":{"href":"https://github.com/unipartdigital/udes-open/pull/98"},"issue":{"href":"https://api.github.com/repos/unipartdigital/udes-open/issues/98"},"comments":{"href":"https://api.github.com/repos/unipartdigital/udes-open/issues/98/comments"},"review_comments":{"href":"https://api.github.com/repos/unipartdigital/udes-open/pulls/98/comments"},"review_comment":{"href":"https://api.github.com/repos/unipartdigital/udes-open/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/unipartdigital/udes-open/pulls/98/commits"},"statuses":{"href":"https://api.github.com/repos/unipartdigital/udes-open/statuses/73c205789b80a7b7c1d12821ec300b604250dc26"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"parisiale"}}