{"action":"created","comment":{"url":"https://api.github.com/repos/Comunitea/CMNT_004_15/pulls/comments/152517932","pull_request_review_id":78390883,"id":152517932,"diff_hunk":"@@ -32,11 +35,35 @@ class StockMove(models.Model):\n \n     @api.multi\n     def write(self, vals):\n-        res = super(StockMove, self).write(vals)\n-        if vals.get('state', False) and vals[\"state\"] != \"draft\":\n-            for move in self:\n-                session = ConnectorSession(self.env.cr, self.env.uid,\n+        \"\"\"\n+        Incluir la comprobacion de todas las lineas del albaran despues de esta funcion.\n+        Si un albaran tiene alguna linea esperando disponibilidad, su estado sera parcialmente disponible.\n+        Si un albaran tiene todas las lineas listas, ninguna esperando disponibilidad y ninguna o \\\n+        varias lineas canceladas, su estado tiene que ser listo para transeferir. \n+        SI un albaran tiene todas sus lineas canceladas su estado pasa a cancelado. \n+        Si un albaran tiene todas sus lineas esperando disponibilidad y ninguna\\\n+        o alguna linea cancelada, su estado sera esperando disponibilidad  \n+        \"\"\"\n+        old_state = False\n+        new_state = False\n+        res = False\n+        for move in self:\n+            old_state = self[0].picking_id.state\n+            res = super(StockMove, self).write(vals)","path":"project-addons/flask_middleware_connector/models/stock.py","position":35,"original_position":35,"commit_id":"9d103fa654ae647f7b5c06ad12fd956408f6b49e","original_commit_id":"9d103fa654ae647f7b5c06ad12fd956408f6b49e","user":{"login":"omar7r","id":637695,"avatar_url":"https://avatars2.githubusercontent.com/u/637695?v=4","gravatar_id":"","url":"https://api.github.com/users/omar7r","html_url":"https://github.com/omar7r","followers_url":"https://api.github.com/users/omar7r/followers","following_url":"https://api.github.com/users/omar7r/following{/other_user}","gists_url":"https://api.github.com/users/omar7r/gists{/gist_id}","starred_url":"https://api.github.com/users/omar7r/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/omar7r/subscriptions","organizations_url":"https://api.github.com/users/omar7r/orgs","repos_url":"https://api.github.com/users/omar7r/repos","events_url":"https://api.github.com/users/omar7r/events{/privacy}","received_events_url":"https://api.github.com/users/omar7r/received_events","type":"User","site_admin":false},"body":"No, fuera sólo sacas el new_state, el otro lo obtienes de cada movimiento, ya que pueden ser de distintos albaranes y tener estados distintos, lo que puedes hacer es tener un \"set\" de albaranes visitados, y en cada iteracción añades los pickings no cancelados de la venta, el propio set evitarña tener duplicados. Luego, debajo del for, puedes recorrerte este set de albaranes para llamara  fire en cada uno.","created_at":"2017-11-22T10:07:43Z","updated_at":"2017-11-22T10:07:43Z","html_url":"https://github.com/Comunitea/CMNT_004_15/pull/58#discussion_r152517932","pull_request_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/pulls/58","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/Comunitea/CMNT_004_15/pulls/comments/152517932"},"html":{"href":"https://github.com/Comunitea/CMNT_004_15/pull/58#discussion_r152517932"},"pull_request":{"href":"https://api.github.com/repos/Comunitea/CMNT_004_15/pulls/58"}},"in_reply_to_id":152384819},"pull_request":{"url":"https://api.github.com/repos/Comunitea/CMNT_004_15/pulls/58","id":153662506,"html_url":"https://github.com/Comunitea/CMNT_004_15/pull/58","diff_url":"https://github.com/Comunitea/CMNT_004_15/pull/58.diff","patch_url":"https://github.com/Comunitea/CMNT_004_15/pull/58.patch","issue_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/issues/58","number":58,"state":"open","locked":false,"title":"Cambios Realizados","user":{"login":"jgmanzanas","id":22660449,"avatar_url":"https://avatars3.githubusercontent.com/u/22660449?v=4","gravatar_id":"","url":"https://api.github.com/users/jgmanzanas","html_url":"https://github.com/jgmanzanas","followers_url":"https://api.github.com/users/jgmanzanas/followers","following_url":"https://api.github.com/users/jgmanzanas/following{/other_user}","gists_url":"https://api.github.com/users/jgmanzanas/gists{/gist_id}","starred_url":"https://api.github.com/users/jgmanzanas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgmanzanas/subscriptions","organizations_url":"https://api.github.com/users/jgmanzanas/orgs","repos_url":"https://api.github.com/users/jgmanzanas/repos","events_url":"https://api.github.com/users/jgmanzanas/events{/privacy}","received_events_url":"https://api.github.com/users/jgmanzanas/received_events","type":"User","site_admin":false},"body":"- [IMP] 'stock_custom': Incluido un campo marca related al campo marca del producto para mostrar en la vista de valoracion de inventario.\r\n- [FIX] 'sale_margin_percentage': Modificada la funcion _product_margin que se encarga de hacer el calculo del margen en la lineas de producto del pedido. Ahora cuando el precio de venta (incluido descuento y cantidad de producto) es menor que el precio de compra (incluida cantidad) se utiliza el precio de compra en el calculo del porcentaje del margen\r\n- [IMP] 'vt_flask_middleware': Incluido el modelo de picking y pickingproducts en flask para la exportacion de albaranes.\r\n- [IMP] 'flask_middleware_connector': Incluidos métodos de envió de albaranes y productos de albaranes a flask\r\n- [IMP] 'flask_middleware_connector': Incluidos los nuevos archivos en el __init__\r\n- [IMP] 'vt_flask_middleware_connector': Incluido albaranes y productos de albaranes como modelos en flask\r\n- [IMP] 'stock_custom': Llamada a la función de creación de producto de albarán, esto se realiza en este archivo ya que el stock move tiene un picking asociado cuando llega a este punto.\r\n- [IMP] 'product_stock_unsafety': Incluido campo calculado 'cantidad mínima de compra' para que se haga una estimación de cuantos productos se deberían de comprar con el stock que nos queda, las ventas en 60 días y el ciclo de pedido del producto","created_at":"2017-11-20T15:43:37Z","updated_at":"2017-11-22T10:07:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"531922bf2e6822846e8a181bedc5efa30c69a7a7","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/pulls/58/commits","review_comments_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/pulls/58/comments","review_comment_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/issues/58/comments","statuses_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/statuses/9d103fa654ae647f7b5c06ad12fd956408f6b49e","head":{"label":"jgmanzanas:jgmanzanas","ref":"jgmanzanas","sha":"9d103fa654ae647f7b5c06ad12fd956408f6b49e","user":{"login":"jgmanzanas","id":22660449,"avatar_url":"https://avatars3.githubusercontent.com/u/22660449?v=4","gravatar_id":"","url":"https://api.github.com/users/jgmanzanas","html_url":"https://github.com/jgmanzanas","followers_url":"https://api.github.com/users/jgmanzanas/followers","following_url":"https://api.github.com/users/jgmanzanas/following{/other_user}","gists_url":"https://api.github.com/users/jgmanzanas/gists{/gist_id}","starred_url":"https://api.github.com/users/jgmanzanas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgmanzanas/subscriptions","organizations_url":"https://api.github.com/users/jgmanzanas/orgs","repos_url":"https://api.github.com/users/jgmanzanas/repos","events_url":"https://api.github.com/users/jgmanzanas/events{/privacy}","received_events_url":"https://api.github.com/users/jgmanzanas/received_events","type":"User","site_admin":false},"repo":{"id":72113082,"name":"CMNT_004_15","full_name":"jgmanzanas/CMNT_004_15","owner":{"login":"jgmanzanas","id":22660449,"avatar_url":"https://avatars3.githubusercontent.com/u/22660449?v=4","gravatar_id":"","url":"https://api.github.com/users/jgmanzanas","html_url":"https://github.com/jgmanzanas","followers_url":"https://api.github.com/users/jgmanzanas/followers","following_url":"https://api.github.com/users/jgmanzanas/following{/other_user}","gists_url":"https://api.github.com/users/jgmanzanas/gists{/gist_id}","starred_url":"https://api.github.com/users/jgmanzanas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgmanzanas/subscriptions","organizations_url":"https://api.github.com/users/jgmanzanas/orgs","repos_url":"https://api.github.com/users/jgmanzanas/repos","events_url":"https://api.github.com/users/jgmanzanas/events{/privacy}","received_events_url":"https://api.github.com/users/jgmanzanas/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jgmanzanas/CMNT_004_15","description":null,"fork":true,"url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15","forks_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/forks","keys_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/teams","hooks_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/hooks","issue_events_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/issues/events{/number}","events_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/events","assignees_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/assignees{/user}","branches_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/branches{/branch}","tags_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/tags","blobs_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/git/refs{/sha}","trees_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/statuses/{sha}","languages_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/languages","stargazers_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/stargazers","contributors_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/contributors","subscribers_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/subscribers","subscription_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/subscription","commits_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/commits{/sha}","git_commits_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/git/commits{/sha}","comments_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/comments{/number}","issue_comment_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/issues/comments{/number}","contents_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/contents/{+path}","compare_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/merges","archive_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/downloads","issues_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/issues{/number}","pulls_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/pulls{/number}","milestones_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/milestones{/number}","notifications_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/labels{/name}","releases_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/releases{/id}","deployments_url":"https://api.github.com/repos/jgmanzanas/CMNT_004_15/deployments","created_at":"2016-10-27T13:52:57Z","updated_at":"2017-09-20T17:14:17Z","pushed_at":"2017-11-21T17:43:41Z","git_url":"git://github.com/jgmanzanas/CMNT_004_15.git","ssh_url":"git@github.com:jgmanzanas/CMNT_004_15.git","clone_url":"https://github.com/jgmanzanas/CMNT_004_15.git","svn_url":"https://github.com/jgmanzanas/CMNT_004_15","homepage":null,"size":21310,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":2,"default_branch":"master"}},"base":{"label":"Comunitea:master","ref":"master","sha":"52fe5b0e27e1e9c13054465c2f91d393106c8b03","user":{"login":"Comunitea","id":11162919,"avatar_url":"https://avatars1.githubusercontent.com/u/11162919?v=4","gravatar_id":"","url":"https://api.github.com/users/Comunitea","html_url":"https://github.com/Comunitea","followers_url":"https://api.github.com/users/Comunitea/followers","following_url":"https://api.github.com/users/Comunitea/following{/other_user}","gists_url":"https://api.github.com/users/Comunitea/gists{/gist_id}","starred_url":"https://api.github.com/users/Comunitea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Comunitea/subscriptions","organizations_url":"https://api.github.com/users/Comunitea/orgs","repos_url":"https://api.github.com/users/Comunitea/repos","events_url":"https://api.github.com/users/Comunitea/events{/privacy}","received_events_url":"https://api.github.com/users/Comunitea/received_events","type":"Organization","site_admin":false},"repo":{"id":36653955,"name":"CMNT_004_15","full_name":"Comunitea/CMNT_004_15","owner":{"login":"Comunitea","id":11162919,"avatar_url":"https://avatars1.githubusercontent.com/u/11162919?v=4","gravatar_id":"","url":"https://api.github.com/users/Comunitea","html_url":"https://github.com/Comunitea","followers_url":"https://api.github.com/users/Comunitea/followers","following_url":"https://api.github.com/users/Comunitea/following{/other_user}","gists_url":"https://api.github.com/users/Comunitea/gists{/gist_id}","starred_url":"https://api.github.com/users/Comunitea/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Comunitea/subscriptions","organizations_url":"https://api.github.com/users/Comunitea/orgs","repos_url":"https://api.github.com/users/Comunitea/repos","events_url":"https://api.github.com/users/Comunitea/events{/privacy}","received_events_url":"https://api.github.com/users/Comunitea/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Comunitea/CMNT_004_15","description":null,"fork":true,"url":"https://api.github.com/repos/Comunitea/CMNT_004_15","forks_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/forks","keys_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/teams","hooks_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/hooks","issue_events_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/issues/events{/number}","events_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/events","assignees_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/assignees{/user}","branches_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/branches{/branch}","tags_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/tags","blobs_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/git/refs{/sha}","trees_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/statuses/{sha}","languages_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/languages","stargazers_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/stargazers","contributors_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/contributors","subscribers_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/subscribers","subscription_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/subscription","commits_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/commits{/sha}","git_commits_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/git/commits{/sha}","comments_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/comments{/number}","issue_comment_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/issues/comments{/number}","contents_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/contents/{+path}","compare_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/merges","archive_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/downloads","issues_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/issues{/number}","pulls_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/pulls{/number}","milestones_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/milestones{/number}","notifications_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/labels{/name}","releases_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/releases{/id}","deployments_url":"https://api.github.com/repos/Comunitea/CMNT_004_15/deployments","created_at":"2015-06-01T10:32:07Z","updated_at":"2016-10-24T14:00:48Z","pushed_at":"2017-11-21T17:43:42Z","git_url":"git://github.com/Comunitea/CMNT_004_15.git","ssh_url":"git@github.com:Comunitea/CMNT_004_15.git","clone_url":"https://github.com/Comunitea/CMNT_004_15.git","svn_url":"https://github.com/Comunitea/CMNT_004_15","homepage":null,"size":21270,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Comunitea/CMNT_004_15/pulls/58"},"html":{"href":"https://github.com/Comunitea/CMNT_004_15/pull/58"},"issue":{"href":"https://api.github.com/repos/Comunitea/CMNT_004_15/issues/58"},"comments":{"href":"https://api.github.com/repos/Comunitea/CMNT_004_15/issues/58/comments"},"review_comments":{"href":"https://api.github.com/repos/Comunitea/CMNT_004_15/pulls/58/comments"},"review_comment":{"href":"https://api.github.com/repos/Comunitea/CMNT_004_15/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Comunitea/CMNT_004_15/pulls/58/commits"},"statuses":{"href":"https://api.github.com/repos/Comunitea/CMNT_004_15/statuses/9d103fa654ae647f7b5c06ad12fd956408f6b49e"}},"author_association":"NONE"}}
{"actor":{"display_login":"omar7r"}}