{"action":"created","comment":{"url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/pulls/comments/22979837","id":22979837,"diff_hunk":"@@ -0,0 +1,106 @@\n+# -*- coding: utf-8 -*-\n+##############################################################################\n+#\n+#    XADES \n+#    Copyright (C) 2014 Cristian Salamea All Rights Reserved\n+#    cristian.salamea@gmail.com\n+#    $Id$\n+#\n+#    This program is free software: you can redistribute it and/or modify\n+#    it under the terms of the GNU General Public License as published by\n+#    the Free Software Foundation, either version 3 of the License, or\n+#    (at your option) any later version.\n+#\n+#    This program is distributed in the hope that it will be useful,\n+#    but WITHOUT ANY WARRANTY; without even the implied warranty of\n+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+#    GNU General Public License for more details.\n+#\n+#    You should have received a copy of the GNU General Public License\n+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n+#\n+##############################################################################\n+\n+import os\n+import base64\n+import StringIO\n+import hashlib\n+import datetime\n+import subprocess\n+try:\n+    from OpenSSL import crypto\n+except ImportError:\n+    raise ImportError('Instalar la libreria para soporte OpenSSL: pip install PyOpenSSL')\n+\n+from pytz import timezone\n+\n+\n+class CheckDigit(object):\n+\n+    # Definicion modulo 11\n+    _MODULO_11 = {\n+        'BASE': 11,\n+        'FACTOR': 2,\n+        'RETORNO11': 0,\n+        'RETORNO10': 1,\n+        'PESO': 2,\n+        'MAX_WEIGHT': 7\n+    }\n+\n+    @classmethod\n+    def _eval_mod11(self, modulo):\n+        if modulo == self._MODULO_11['BASE']:\n+            return self._MODULO_11['RETORNO11']\n+        elif modulo == self._MODULO_11['BASE'] - 1:\n+            return self._MODULO_11['RETORNO10']\n+        else:\n+            return modulo\n+\n+    @classmethod\n+    def compute_mod11(self, dato):\n+        \"\"\"\n+        Calculo mod 11\n+        return int\n+        \"\"\"\n+        total = 0\n+        weight = self._MODULO_11['PESO']\n+        \n+        for item in reversed(dato):\n+            total += int(item) * weight\n+            weight += 1\n+            if weight > self._MODULO_11['MAX_WEIGHT']:\n+                weight = self._MODULO_11['PESO']\n+        mod = 11 - total % self._MODULO_11['BASE']\n+\n+        mod = self._eval_mod11(mod)\n+        return mod\n+\n+\n+class Xades(object):\n+\n+    def apply_digital_signature(self, factura):\n+        \"\"\"\n+        Metodo que aplica la firma digital al XML\n+        \"\"\"\n+        OPT_PATH = '/opt/facturas/'","path":"l10n_ec_einvoice/xades/xades.py","position":85,"original_position":85,"commit_id":"45211857f3bd6562d0cfa4a254383baea318f96f","original_commit_id":"45211857f3bd6562d0cfa4a254383baea318f96f","user":{"login":"codeadict","id":168440,"avatar_url":"https://avatars.githubusercontent.com/u/168440?v=3","gravatar_id":"","url":"https://api.github.com/users/codeadict","html_url":"https://github.com/codeadict","followers_url":"https://api.github.com/users/codeadict/followers","following_url":"https://api.github.com/users/codeadict/following{/other_user}","gists_url":"https://api.github.com/users/codeadict/gists{/gist_id}","starred_url":"https://api.github.com/users/codeadict/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codeadict/subscriptions","organizations_url":"https://api.github.com/users/codeadict/orgs","repos_url":"https://api.github.com/users/codeadict/repos","events_url":"https://api.github.com/users/codeadict/events{/privacy}","received_events_url":"https://api.github.com/users/codeadict/received_events","type":"User","site_admin":false},"body":"por que **/opt/facturas/** no mejor tener un campo de configuración donde se defina el directorio aunque x default sea este, tal vez pensar en integración con Google Drive y Dropbox a futuro para guardar los XML´s","created_at":"2015-01-14T23:23:52Z","updated_at":"2015-01-14T23:23:52Z","html_url":"https://github.com/odoo-ecuador/odoo-ecuador/pull/48#discussion_r22979837","pull_request_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/pulls/48","_links":{"self":{"href":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/pulls/comments/22979837"},"html":{"href":"https://github.com/odoo-ecuador/odoo-ecuador/pull/48#discussion_r22979837"},"pull_request":{"href":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/pulls/48"}}},"pull_request":{"url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/pulls/48","id":27153665,"html_url":"https://github.com/odoo-ecuador/odoo-ecuador/pull/48","diff_url":"https://github.com/odoo-ecuador/odoo-ecuador/pull/48.diff","patch_url":"https://github.com/odoo-ecuador/odoo-ecuador/pull/48.patch","issue_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/issues/48","number":48,"state":"open","locked":false,"title":"WIP: soporte para documentos electronicos","user":{"login":"ovnicraft","id":31282,"avatar_url":"https://avatars.githubusercontent.com/u/31282?v=3","gravatar_id":"","url":"https://api.github.com/users/ovnicraft","html_url":"https://github.com/ovnicraft","followers_url":"https://api.github.com/users/ovnicraft/followers","following_url":"https://api.github.com/users/ovnicraft/following{/other_user}","gists_url":"https://api.github.com/users/ovnicraft/gists{/gist_id}","starred_url":"https://api.github.com/users/ovnicraft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ovnicraft/subscriptions","organizations_url":"https://api.github.com/users/ovnicraft/orgs","repos_url":"https://api.github.com/users/ovnicraft/repos","events_url":"https://api.github.com/users/ovnicraft/events{/privacy}","received_events_url":"https://api.github.com/users/ovnicraft/received_events","type":"User","site_admin":false},"body":"Implementado documento factura electronica","created_at":"2015-01-10T19:53:27Z","updated_at":"2015-01-14T23:23:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"87457ddbf66a5a7ff3a4bdc4c7f9ec5dda324504","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/pulls/48/commits","review_comments_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/pulls/48/comments","review_comment_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/pulls/comments/{number}","comments_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/issues/48/comments","statuses_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/statuses/45211857f3bd6562d0cfa4a254383baea318f96f","head":{"label":"ovnicraft:fix-einvoice","ref":"fix-einvoice","sha":"45211857f3bd6562d0cfa4a254383baea318f96f","user":{"login":"ovnicraft","id":31282,"avatar_url":"https://avatars.githubusercontent.com/u/31282?v=3","gravatar_id":"","url":"https://api.github.com/users/ovnicraft","html_url":"https://github.com/ovnicraft","followers_url":"https://api.github.com/users/ovnicraft/followers","following_url":"https://api.github.com/users/ovnicraft/following{/other_user}","gists_url":"https://api.github.com/users/ovnicraft/gists{/gist_id}","starred_url":"https://api.github.com/users/ovnicraft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ovnicraft/subscriptions","organizations_url":"https://api.github.com/users/ovnicraft/orgs","repos_url":"https://api.github.com/users/ovnicraft/repos","events_url":"https://api.github.com/users/ovnicraft/events{/privacy}","received_events_url":"https://api.github.com/users/ovnicraft/received_events","type":"User","site_admin":false},"repo":{"id":12739921,"name":"openerp-ecuador","full_name":"ovnicraft/openerp-ecuador","owner":{"login":"ovnicraft","id":31282,"avatar_url":"https://avatars.githubusercontent.com/u/31282?v=3","gravatar_id":"","url":"https://api.github.com/users/ovnicraft","html_url":"https://github.com/ovnicraft","followers_url":"https://api.github.com/users/ovnicraft/followers","following_url":"https://api.github.com/users/ovnicraft/following{/other_user}","gists_url":"https://api.github.com/users/ovnicraft/gists{/gist_id}","starred_url":"https://api.github.com/users/ovnicraft/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ovnicraft/subscriptions","organizations_url":"https://api.github.com/users/ovnicraft/orgs","repos_url":"https://api.github.com/users/ovnicraft/repos","events_url":"https://api.github.com/users/ovnicraft/events{/privacy}","received_events_url":"https://api.github.com/users/ovnicraft/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ovnicraft/openerp-ecuador","description":"Localización Ecuatoriana para OpenERP","fork":true,"url":"https://api.github.com/repos/ovnicraft/openerp-ecuador","forks_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/forks","keys_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/teams","hooks_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/hooks","issue_events_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/issues/events{/number}","events_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/events","assignees_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/assignees{/user}","branches_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/branches{/branch}","tags_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/tags","blobs_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/git/refs{/sha}","trees_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/statuses/{sha}","languages_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/languages","stargazers_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/stargazers","contributors_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/contributors","subscribers_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/subscribers","subscription_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/subscription","commits_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/commits{/sha}","git_commits_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/git/commits{/sha}","comments_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/comments{/number}","issue_comment_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/issues/comments/{number}","contents_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/contents/{+path}","compare_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/merges","archive_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/downloads","issues_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/issues{/number}","pulls_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/pulls{/number}","milestones_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/milestones{/number}","notifications_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/labels{/name}","releases_url":"https://api.github.com/repos/ovnicraft/openerp-ecuador/releases{/id}","created_at":"2013-09-10T20:33:18Z","updated_at":"2014-06-18T16:48:05Z","pushed_at":"2015-01-14T23:10:56Z","git_url":"git://github.com/ovnicraft/openerp-ecuador.git","ssh_url":"git@github.com:ovnicraft/openerp-ecuador.git","clone_url":"https://github.com/ovnicraft/openerp-ecuador.git","svn_url":"https://github.com/ovnicraft/openerp-ecuador","homepage":"","size":4004,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":0,"forks":2,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"odoo-ecuador:7.0","ref":"7.0","sha":"207805cd69b988070ab247b4fce8963ad6efcd1e","user":{"login":"odoo-ecuador","id":5407569,"avatar_url":"https://avatars.githubusercontent.com/u/5407569?v=3","gravatar_id":"","url":"https://api.github.com/users/odoo-ecuador","html_url":"https://github.com/odoo-ecuador","followers_url":"https://api.github.com/users/odoo-ecuador/followers","following_url":"https://api.github.com/users/odoo-ecuador/following{/other_user}","gists_url":"https://api.github.com/users/odoo-ecuador/gists{/gist_id}","starred_url":"https://api.github.com/users/odoo-ecuador/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odoo-ecuador/subscriptions","organizations_url":"https://api.github.com/users/odoo-ecuador/orgs","repos_url":"https://api.github.com/users/odoo-ecuador/repos","events_url":"https://api.github.com/users/odoo-ecuador/events{/privacy}","received_events_url":"https://api.github.com/users/odoo-ecuador/received_events","type":"Organization","site_admin":false},"repo":{"id":8119687,"name":"odoo-ecuador","full_name":"odoo-ecuador/odoo-ecuador","owner":{"login":"odoo-ecuador","id":5407569,"avatar_url":"https://avatars.githubusercontent.com/u/5407569?v=3","gravatar_id":"","url":"https://api.github.com/users/odoo-ecuador","html_url":"https://github.com/odoo-ecuador","followers_url":"https://api.github.com/users/odoo-ecuador/followers","following_url":"https://api.github.com/users/odoo-ecuador/following{/other_user}","gists_url":"https://api.github.com/users/odoo-ecuador/gists{/gist_id}","starred_url":"https://api.github.com/users/odoo-ecuador/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odoo-ecuador/subscriptions","organizations_url":"https://api.github.com/users/odoo-ecuador/orgs","repos_url":"https://api.github.com/users/odoo-ecuador/repos","events_url":"https://api.github.com/users/odoo-ecuador/events{/privacy}","received_events_url":"https://api.github.com/users/odoo-ecuador/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/odoo-ecuador/odoo-ecuador","description":"Localización Ecuatoriana para Odoo (OpenERP)","fork":false,"url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador","forks_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/forks","keys_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/keys{/key_id}","collaborators_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/teams","hooks_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/hooks","issue_events_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/issues/events{/number}","events_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/events","assignees_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/assignees{/user}","branches_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/branches{/branch}","tags_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/tags","blobs_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/git/refs{/sha}","trees_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/git/trees{/sha}","statuses_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/statuses/{sha}","languages_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/languages","stargazers_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/stargazers","contributors_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/contributors","subscribers_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/subscribers","subscription_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/subscription","commits_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/commits{/sha}","git_commits_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/git/commits{/sha}","comments_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/comments{/number}","issue_comment_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/issues/comments/{number}","contents_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/contents/{+path}","compare_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/compare/{base}...{head}","merges_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/merges","archive_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/downloads","issues_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/issues{/number}","pulls_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/pulls{/number}","milestones_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/milestones{/number}","notifications_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/labels{/name}","releases_url":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/releases{/id}","created_at":"2013-02-10T06:09:01Z","updated_at":"2015-01-13T07:00:06Z","pushed_at":"2015-01-14T17:30:03Z","git_url":"git://github.com/odoo-ecuador/odoo-ecuador.git","ssh_url":"git@github.com:odoo-ecuador/odoo-ecuador.git","clone_url":"https://github.com/odoo-ecuador/odoo-ecuador.git","svn_url":"https://github.com/odoo-ecuador/odoo-ecuador","homepage":"","size":5692,"stargazers_count":8,"watchers_count":8,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":13,"mirror_url":null,"open_issues_count":18,"forks":13,"open_issues":18,"watchers":8,"default_branch":"7.0"}},"_links":{"self":{"href":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/pulls/48"},"html":{"href":"https://github.com/odoo-ecuador/odoo-ecuador/pull/48"},"issue":{"href":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/issues/48"},"comments":{"href":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/issues/48/comments"},"review_comments":{"href":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/pulls/48/comments"},"review_comment":{"href":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/pulls/48/commits"},"statuses":{"href":"https://api.github.com/repos/odoo-ecuador/odoo-ecuador/statuses/45211857f3bd6562d0cfa4a254383baea318f96f"}}}}