{"action":"created","comment":{"url":"https://api.github.com/repos/OCA/carrier-delivery/pulls/comments/23082237","id":23082237,"diff_hunk":"@@ -0,0 +1,337 @@\n+# -*- coding: utf-8 -*-\n+##############################################################################\n+#\n+#  license AGPL version 3 or later\n+#  see license in __openerp__.py or http://www.gnu.org/licenses/agpl-3.0.txt\n+#  Copyright (C) 2014 Akretion (http://www.akretion.com).\n+#  @author David BEAL <david.beal@akretion.com>\n+#\n+##############################################################################\n+\n+from openerp.osv import orm  # fields\n+from openerp.tools.translate import _\n+from .report.label import Gls, InvalidDataForMako\n+from .report.exception_helper import (InvalidAccountNumber)\n+from .report.label_helper import (\n+    InvalidValueNotInList,\n+    InvalidMissingField,\n+    InvalidType,)\n+from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT\n+from datetime import datetime\n+import pycountry\n+from operator import attrgetter\n+\n+\n+EXCEPT_TITLE = \"GLS Library Exception\"\n+LABEL_TYPE = 'zpl2'\n+PACK_NUMBER = 0\n+\n+\n+def raise_exception(orm, message):\n+    raise orm.except_orm(EXCEPT_TITLE, map_except_message(message))\n+\n+\n+def map_except_message(message):\n+    \"\"\" Allows to map vocabulary from external library\n+        to Odoo vocabulary in Exception message\n+    \"\"\"\n+    model_mapping = {\n+        'shipper_country': 'partner_id.country_id.code',\n+    }\n+    for key, val in model_mapping.items():\n+        message = message.replace(key, val)\n+    return message\n+\n+\n+class StockPicking(orm.Model):\n+    _inherit = \"stock.picking\"\n+\n+    def action_done(self, cr, uid, ids, context=None):\n+        \"\"\"\n+        :return: see original method\n+        \"\"\"\n+        if context is None:\n+            context = {}\n+        for picking in self.browse(cr, uid, ids, context=context):\n+            if picking.carrier_type == 'gls':\n+                self.generate_labels(","path":"delivery_carrier_label_gls/stock.py","position":57,"original_position":57,"commit_id":"6ffc40a41a10713d8065886612fa061ebcf34703","original_commit_id":"64e71477017cb5bc77151903065b7b8dd4651655","user":{"login":"yvaucher","id":4158438,"avatar_url":"https://avatars.githubusercontent.com/u/4158438?v=3","gravatar_id":"","url":"https://api.github.com/users/yvaucher","html_url":"https://github.com/yvaucher","followers_url":"https://api.github.com/users/yvaucher/followers","following_url":"https://api.github.com/users/yvaucher/following{/other_user}","gists_url":"https://api.github.com/users/yvaucher/gists{/gist_id}","starred_url":"https://api.github.com/users/yvaucher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yvaucher/subscriptions","organizations_url":"https://api.github.com/users/yvaucher/orgs","repos_url":"https://api.github.com/users/yvaucher/repos","events_url":"https://api.github.com/users/yvaucher/events{/privacy}","received_events_url":"https://api.github.com/users/yvaucher/received_events","type":"User","site_admin":false},"body":"I think it would be better to have an option to print on done. This could be interesting in base module as I don't think it is carrier specific.","created_at":"2015-01-16T14:22:39Z","updated_at":"2015-01-16T14:22:39Z","html_url":"https://github.com/OCA/carrier-delivery/pull/35#discussion_r23082237","pull_request_url":"https://api.github.com/repos/OCA/carrier-delivery/pulls/35","_links":{"self":{"href":"https://api.github.com/repos/OCA/carrier-delivery/pulls/comments/23082237"},"html":{"href":"https://github.com/OCA/carrier-delivery/pull/35#discussion_r23082237"},"pull_request":{"href":"https://api.github.com/repos/OCA/carrier-delivery/pulls/35"}}},"pull_request":{"url":"https://api.github.com/repos/OCA/carrier-delivery/pulls/35","id":23499264,"html_url":"https://github.com/OCA/carrier-delivery/pull/35","diff_url":"https://github.com/OCA/carrier-delivery/pull/35.diff","patch_url":"https://github.com/OCA/carrier-delivery/pull/35.patch","issue_url":"https://api.github.com/repos/OCA/carrier-delivery/issues/35","number":35,"state":"open","locked":false,"title":"add a french carrier GLS group ","user":{"login":"bealdav","id":1853434,"avatar_url":"https://avatars.githubusercontent.com/u/1853434?v=3","gravatar_id":"","url":"https://api.github.com/users/bealdav","html_url":"https://github.com/bealdav","followers_url":"https://api.github.com/users/bealdav/followers","following_url":"https://api.github.com/users/bealdav/following{/other_user}","gists_url":"https://api.github.com/users/bealdav/gists{/gist_id}","starred_url":"https://api.github.com/users/bealdav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bealdav/subscriptions","organizations_url":"https://api.github.com/users/bealdav/orgs","repos_url":"https://api.github.com/users/bealdav/repos","events_url":"https://api.github.com/users/bealdav/events{/privacy}","received_events_url":"https://api.github.com/users/bealdav/received_events","type":"User","site_admin":false},"body":"for label printing with webservice","created_at":"2014-10-28T23:38:54Z","updated_at":"2015-01-16T14:22:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d3f170882895d0bb5dda047e793b432626b7934c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OCA/carrier-delivery/pulls/35/commits","review_comments_url":"https://api.github.com/repos/OCA/carrier-delivery/pulls/35/comments","review_comment_url":"https://api.github.com/repos/OCA/carrier-delivery/pulls/comments/{number}","comments_url":"https://api.github.com/repos/OCA/carrier-delivery/issues/35/comments","statuses_url":"https://api.github.com/repos/OCA/carrier-delivery/statuses/6ffc40a41a10713d8065886612fa061ebcf34703","head":{"label":"akretion:7-gls","ref":"7-gls","sha":"6ffc40a41a10713d8065886612fa061ebcf34703","user":{"login":"akretion","id":1853423,"avatar_url":"https://avatars.githubusercontent.com/u/1853423?v=3","gravatar_id":"","url":"https://api.github.com/users/akretion","html_url":"https://github.com/akretion","followers_url":"https://api.github.com/users/akretion/followers","following_url":"https://api.github.com/users/akretion/following{/other_user}","gists_url":"https://api.github.com/users/akretion/gists{/gist_id}","starred_url":"https://api.github.com/users/akretion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akretion/subscriptions","organizations_url":"https://api.github.com/users/akretion/orgs","repos_url":"https://api.github.com/users/akretion/repos","events_url":"https://api.github.com/users/akretion/events{/privacy}","received_events_url":"https://api.github.com/users/akretion/received_events","type":"Organization","site_admin":false},"repo":{"id":21564876,"name":"carrier-delivery","full_name":"akretion/carrier-delivery","owner":{"login":"akretion","id":1853423,"avatar_url":"https://avatars.githubusercontent.com/u/1853423?v=3","gravatar_id":"","url":"https://api.github.com/users/akretion","html_url":"https://github.com/akretion","followers_url":"https://api.github.com/users/akretion/followers","following_url":"https://api.github.com/users/akretion/following{/other_user}","gists_url":"https://api.github.com/users/akretion/gists{/gist_id}","starred_url":"https://api.github.com/users/akretion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akretion/subscriptions","organizations_url":"https://api.github.com/users/akretion/orgs","repos_url":"https://api.github.com/users/akretion/repos","events_url":"https://api.github.com/users/akretion/events{/privacy}","received_events_url":"https://api.github.com/users/akretion/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/akretion/carrier-delivery","description":"","fork":true,"url":"https://api.github.com/repos/akretion/carrier-delivery","forks_url":"https://api.github.com/repos/akretion/carrier-delivery/forks","keys_url":"https://api.github.com/repos/akretion/carrier-delivery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/akretion/carrier-delivery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/akretion/carrier-delivery/teams","hooks_url":"https://api.github.com/repos/akretion/carrier-delivery/hooks","issue_events_url":"https://api.github.com/repos/akretion/carrier-delivery/issues/events{/number}","events_url":"https://api.github.com/repos/akretion/carrier-delivery/events","assignees_url":"https://api.github.com/repos/akretion/carrier-delivery/assignees{/user}","branches_url":"https://api.github.com/repos/akretion/carrier-delivery/branches{/branch}","tags_url":"https://api.github.com/repos/akretion/carrier-delivery/tags","blobs_url":"https://api.github.com/repos/akretion/carrier-delivery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/akretion/carrier-delivery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/akretion/carrier-delivery/git/refs{/sha}","trees_url":"https://api.github.com/repos/akretion/carrier-delivery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/akretion/carrier-delivery/statuses/{sha}","languages_url":"https://api.github.com/repos/akretion/carrier-delivery/languages","stargazers_url":"https://api.github.com/repos/akretion/carrier-delivery/stargazers","contributors_url":"https://api.github.com/repos/akretion/carrier-delivery/contributors","subscribers_url":"https://api.github.com/repos/akretion/carrier-delivery/subscribers","subscription_url":"https://api.github.com/repos/akretion/carrier-delivery/subscription","commits_url":"https://api.github.com/repos/akretion/carrier-delivery/commits{/sha}","git_commits_url":"https://api.github.com/repos/akretion/carrier-delivery/git/commits{/sha}","comments_url":"https://api.github.com/repos/akretion/carrier-delivery/comments{/number}","issue_comment_url":"https://api.github.com/repos/akretion/carrier-delivery/issues/comments/{number}","contents_url":"https://api.github.com/repos/akretion/carrier-delivery/contents/{+path}","compare_url":"https://api.github.com/repos/akretion/carrier-delivery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/akretion/carrier-delivery/merges","archive_url":"https://api.github.com/repos/akretion/carrier-delivery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/akretion/carrier-delivery/downloads","issues_url":"https://api.github.com/repos/akretion/carrier-delivery/issues{/number}","pulls_url":"https://api.github.com/repos/akretion/carrier-delivery/pulls{/number}","milestones_url":"https://api.github.com/repos/akretion/carrier-delivery/milestones{/number}","notifications_url":"https://api.github.com/repos/akretion/carrier-delivery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/akretion/carrier-delivery/labels{/name}","releases_url":"https://api.github.com/repos/akretion/carrier-delivery/releases{/id}","created_at":"2014-07-07T09:23:52Z","updated_at":"2014-07-01T07:35:59Z","pushed_at":"2015-01-16T14:15:06Z","git_url":"git://github.com/akretion/carrier-delivery.git","ssh_url":"git@github.com:akretion/carrier-delivery.git","clone_url":"https://github.com/akretion/carrier-delivery.git","svn_url":"https://github.com/akretion/carrier-delivery","homepage":null,"size":4135,"stargazers_count":0,"watchers_count":0,"language":null,"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":"master"}},"base":{"label":"OCA:7.0","ref":"7.0","sha":"432686d3665cced112d13c2dcd2e70129a5af2eb","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":20890916,"name":"carrier-delivery","full_name":"OCA/carrier-delivery","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/carrier-delivery","description":"Carriers And Deliveries Management","fork":false,"url":"https://api.github.com/repos/OCA/carrier-delivery","forks_url":"https://api.github.com/repos/OCA/carrier-delivery/forks","keys_url":"https://api.github.com/repos/OCA/carrier-delivery/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OCA/carrier-delivery/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OCA/carrier-delivery/teams","hooks_url":"https://api.github.com/repos/OCA/carrier-delivery/hooks","issue_events_url":"https://api.github.com/repos/OCA/carrier-delivery/issues/events{/number}","events_url":"https://api.github.com/repos/OCA/carrier-delivery/events","assignees_url":"https://api.github.com/repos/OCA/carrier-delivery/assignees{/user}","branches_url":"https://api.github.com/repos/OCA/carrier-delivery/branches{/branch}","tags_url":"https://api.github.com/repos/OCA/carrier-delivery/tags","blobs_url":"https://api.github.com/repos/OCA/carrier-delivery/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OCA/carrier-delivery/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OCA/carrier-delivery/git/refs{/sha}","trees_url":"https://api.github.com/repos/OCA/carrier-delivery/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OCA/carrier-delivery/statuses/{sha}","languages_url":"https://api.github.com/repos/OCA/carrier-delivery/languages","stargazers_url":"https://api.github.com/repos/OCA/carrier-delivery/stargazers","contributors_url":"https://api.github.com/repos/OCA/carrier-delivery/contributors","subscribers_url":"https://api.github.com/repos/OCA/carrier-delivery/subscribers","subscription_url":"https://api.github.com/repos/OCA/carrier-delivery/subscription","commits_url":"https://api.github.com/repos/OCA/carrier-delivery/commits{/sha}","git_commits_url":"https://api.github.com/repos/OCA/carrier-delivery/git/commits{/sha}","comments_url":"https://api.github.com/repos/OCA/carrier-delivery/comments{/number}","issue_comment_url":"https://api.github.com/repos/OCA/carrier-delivery/issues/comments/{number}","contents_url":"https://api.github.com/repos/OCA/carrier-delivery/contents/{+path}","compare_url":"https://api.github.com/repos/OCA/carrier-delivery/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OCA/carrier-delivery/merges","archive_url":"https://api.github.com/repos/OCA/carrier-delivery/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OCA/carrier-delivery/downloads","issues_url":"https://api.github.com/repos/OCA/carrier-delivery/issues{/number}","pulls_url":"https://api.github.com/repos/OCA/carrier-delivery/pulls{/number}","milestones_url":"https://api.github.com/repos/OCA/carrier-delivery/milestones{/number}","notifications_url":"https://api.github.com/repos/OCA/carrier-delivery/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OCA/carrier-delivery/labels{/name}","releases_url":"https://api.github.com/repos/OCA/carrier-delivery/releases{/id}","created_at":"2014-06-16T15:56:19Z","updated_at":"2014-12-21T03:31:12Z","pushed_at":"2015-01-05T09:49:30Z","git_url":"git://github.com/OCA/carrier-delivery.git","ssh_url":"git@github.com:OCA/carrier-delivery.git","clone_url":"https://github.com/OCA/carrier-delivery.git","svn_url":"https://github.com/OCA/carrier-delivery","homepage":"http://www.odoo-community.org/project/18","size":4851,"stargazers_count":6,"watchers_count":6,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":9,"forks":17,"open_issues":9,"watchers":6,"default_branch":"8.0"}},"_links":{"self":{"href":"https://api.github.com/repos/OCA/carrier-delivery/pulls/35"},"html":{"href":"https://github.com/OCA/carrier-delivery/pull/35"},"issue":{"href":"https://api.github.com/repos/OCA/carrier-delivery/issues/35"},"comments":{"href":"https://api.github.com/repos/OCA/carrier-delivery/issues/35/comments"},"review_comments":{"href":"https://api.github.com/repos/OCA/carrier-delivery/pulls/35/comments"},"review_comment":{"href":"https://api.github.com/repos/OCA/carrier-delivery/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/OCA/carrier-delivery/pulls/35/commits"},"statuses":{"href":"https://api.github.com/repos/OCA/carrier-delivery/statuses/6ffc40a41a10713d8065886612fa061ebcf34703"}}}}