{"action":"created","comment":{"url":"https://api.github.com/repos/OCA/l10n-italy/pulls/comments/75302016","id":75302016,"diff_hunk":"@@ -0,0 +1,380 @@\n+# -*- encoding: utf-8 -*-\n+##############################################################################\n+#\n+#    SEPA Direct Debit module for Odoo\n+#    Copyright (C) 2013-2015 Akretion (http://www.akretion.com)\n+#    @author: Alexis de Lattre <alexis.delattre@akretion.com>\n+#\n+#    This program is free software: you can redistribute it and/or modify\n+#    it under the terms of the GNU Affero General Public License as\n+#    published by the Free Software Foundation, either version 3 of the\n+#    License, or (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 Affero General Public License for more details.\n+#\n+#    You should have received a copy of the GNU Affero General Public License\n+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n+#\n+##############################################################################\n+\n+\n+from openerp import models, fields, api, _\n+from openerp.exceptions import Warning\n+from openerp import workflow\n+from lxml import etree\n+import logging\n+import base64\n+\n+logger = logging.getLogger(__name__)\n+\n+\n+class BankingExportSepaCbiEsteroWizard(models.TransientModel):\n+    _name = 'banking.export.sepa.cbi.estero.wizard'\n+    _inherit = ['banking.export.pain']\n+    _description = 'Export SEPA CBI Estero File'\n+\n+    state = fields.Selection([\n+        ('create', 'Create'),\n+        ('finish', 'Finish'),\n+        ], string='State', readonly=True, default='create')\n+    batch_booking = fields.Boolean(\n+        string='Batch Booking',\n+        help=\"If true, the bank statement will display only one credit \"\n+        \"line for all the direct debits of the SEPA file ; if false, \"\n+        \"the bank statement will display one credit line per direct \"\n+        \"debit of the SEPA file.\")\n+    charge_bearer = fields.Selection([\n+        ('SHAR', 'Shared'),\n+        ('CRED', 'Borne by Creditor'),\n+        ('DEBT', 'Borne by Debtor'),\n+        ], string='Charge Bearer', required=True, default='DEBT',\n+        help=\"Following service level : transaction charges are to be \"\n+        \"applied following the rules agreed in the service level \"\n+        \"and/or scheme (SEPA Core messages must use this). Shared : \"\n+        \"transaction charges on the creditor side are to be borne \"\n+        \"by the creditor, transaction charges on the debtor side are \"\n+        \"to be borne by the debtor. Borne by creditor : all \"\n+        \"transaction charges are to be borne by the creditor. Borne \"\n+        \"by debtor : all transaction charges are to be borne by the debtor.\")\n+    nb_transactions = fields.Integer(\n+        string='Number of Transactions', readonly=True)\n+    total_amount = fields.Float(string='Total Amount', readonly=True)\n+    file = fields.Binary(string=\"File\", readonly=True)\n+    filename = fields.Char(string=\"Filename\", readonly=True)\n+    payment_order_ids = fields.Many2many(\n+        'payment.order', 'wiz_sepa_cbi_estero_payorders_rel', 'wizard_id',\n+        'payment_order_id', string='Payment Orders', readonly=True)\n+\n+    @api.model\n+    def create(self, vals):\n+        payment_order_ids = self._context.get('active_ids', [])\n+        vals.update({\n+            'payment_order_ids': [[6, 0, payment_order_ids]],\n+        })\n+        return super(BankingExportSepaCbiEsteroWizard, self).create(vals)\n+\n+    @api.model\n+    def generate_party_agent(self, parent_node, party_type, party_type_label,\n+            order, party_name, iban, bic, eval_ctx, gen_args, context=None):\n+        \n+        # CBI logic modified for add ABI of debitor\n+        # ABI and BIC code\n+        if party_type == 'Dbtr':\n+            company_bank = gen_args['sepa_export'].payment_order_ids[0].mode.\\\n+                                                                    bank_id\n+            partner_debitor = gen_args['sepa_export'].payment_order_ids[0]\\\n+                .mode.bank_id.partner_id\n+            abi_code = False\n+            if 'bank_abi' in company_bank:\n+                abi_code = company_bank.bank_abi\n+            # ... try from iban\n+            if not abi_code and company_bank.state == 'iban':\n+                iban = company_bank.acc_number.replace(\" \",\"\")\n+                abi_code = iban[5:10]\n+            if not abi_code:\n+                raise Warning(_(\"Error Bank Code ABI\"))\n+            bic_code = False\n+            if company_bank.bank_bic:\n+                bic_code = company_bank.bank_bic \n+            if not bic_code:\n+                raise Warning(_(\"Error Bank Code BIC\"))\n+            party_agent = etree.SubElement(parent_node, '%sAgt' % party_type)\n+            party_agent_institution = etree.SubElement(\n+                party_agent, 'FinInstnId')\n+            # BIC \n+            party_agent_institution_BIC = etree.SubElement(\n+                party_agent_institution, 'BIC')\n+            party_agent_institution_BIC.text = bic_code\n+            # ABI\n+            party_agent_institution_sys = etree.SubElement(\n+                party_agent_institution, 'ClrSysMmbId')\n+            party_agent_institution_sys_abi = etree.SubElement(\n+                    party_agent_institution_sys, 'MmbId')\n+            party_agent_institution_sys_abi.text = abi_code\n+            # Complete Debitor data\n+            debitor_node = parent_node.xpath('//Dbtr')[0]\n+            debitor_address_node = etree.SubElement(debitor_node, 'PstlAdr')\n+            debitor_country_node = etree.SubElement(debitor_address_node, \n+                                                    'Ctry')\n+            debitor_country_node.text = iban[:2]\n+            debitor_address_line_node = etree.SubElement(debitor_address_node, \n+                                                         'AdrLine')\n+            if partner_debitor:\n+                address = '%s %s %s' % (\n+                    partner_debitor.street or '',\n+                    partner_debitor.city or '',\n+                    partner_debitor.country_id and \n+                    partner_debitor.country_id.name or '',)\n+            debitor_address_line_node.text = address\n+       \n+        return True\n+\n+    @api.model\n+    def generate_creditor_scheme_identification(\n+            self, parent_node, identification, identification_label,\n+            eval_ctx, scheme_name_proprietary, gen_args):\n+        #\n+        # CBI logic modified for not try to add other info\n+        #\n+        '''","path":"l10n_it_sepa_bonifici/wizard/export_sepa_cbi_estero.py","position":144,"original_position":142,"commit_id":"2ea0c257a84cd7e6d4231c16b44ccb768b74fed9","original_commit_id":"b0f93061a09d9189986fbd13dba21b239aebeb67","user":{"login":"alessandrocamilli","id":7657512,"avatar_url":"https://avatars.githubusercontent.com/u/7657512?v=3","gravatar_id":"","url":"https://api.github.com/users/alessandrocamilli","html_url":"https://github.com/alessandrocamilli","followers_url":"https://api.github.com/users/alessandrocamilli/followers","following_url":"https://api.github.com/users/alessandrocamilli/following{/other_user}","gists_url":"https://api.github.com/users/alessandrocamilli/gists{/gist_id}","starred_url":"https://api.github.com/users/alessandrocamilli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alessandrocamilli/subscriptions","organizations_url":"https://api.github.com/users/alessandrocamilli/orgs","repos_url":"https://api.github.com/users/alessandrocamilli/repos","events_url":"https://api.github.com/users/alessandrocamilli/events{/privacy}","received_events_url":"https://api.github.com/users/alessandrocamilli/received_events","type":"User","site_admin":false},"body":"Done https://github.com/alessandrocamilli/l10n-italy/commit/a8524ae80adbfa6ebb5e3af3f3a8f0bc880ee4c7","created_at":"2016-08-18T12:55:11Z","updated_at":"2016-08-18T12:55:11Z","html_url":"https://github.com/OCA/l10n-italy/pull/218#discussion_r75302016","pull_request_url":"https://api.github.com/repos/OCA/l10n-italy/pulls/218","_links":{"self":{"href":"https://api.github.com/repos/OCA/l10n-italy/pulls/comments/75302016"},"html":{"href":"https://github.com/OCA/l10n-italy/pull/218#discussion_r75302016"},"pull_request":{"href":"https://api.github.com/repos/OCA/l10n-italy/pulls/218"}}},"pull_request":{"url":"https://api.github.com/repos/OCA/l10n-italy/pulls/218","id":68247425,"html_url":"https://github.com/OCA/l10n-italy/pull/218","diff_url":"https://github.com/OCA/l10n-italy/pull/218.diff","patch_url":"https://github.com/OCA/l10n-italy/pull/218.patch","issue_url":"https://api.github.com/repos/OCA/l10n-italy/issues/218","number":218,"state":"open","locked":false,"title":"Add l10n_it_sepa_bonifici","user":{"login":"alessandrocamilli","id":7657512,"avatar_url":"https://avatars.githubusercontent.com/u/7657512?v=3","gravatar_id":"","url":"https://api.github.com/users/alessandrocamilli","html_url":"https://github.com/alessandrocamilli","followers_url":"https://api.github.com/users/alessandrocamilli/followers","following_url":"https://api.github.com/users/alessandrocamilli/following{/other_user}","gists_url":"https://api.github.com/users/alessandrocamilli/gists{/gist_id}","starred_url":"https://api.github.com/users/alessandrocamilli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alessandrocamilli/subscriptions","organizations_url":"https://api.github.com/users/alessandrocamilli/orgs","repos_url":"https://api.github.com/users/alessandrocamilli/repos","events_url":"https://api.github.com/users/alessandrocamilli/events{/privacy}","received_events_url":"https://api.github.com/users/alessandrocamilli/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-04-28T16:07:40Z","updated_at":"2016-08-18T12:55:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9554c9dbe6393d190db96308d6b4cc34e7e4e179","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/OCA/l10n-italy/pulls/218/commits","review_comments_url":"https://api.github.com/repos/OCA/l10n-italy/pulls/218/comments","review_comment_url":"https://api.github.com/repos/OCA/l10n-italy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OCA/l10n-italy/issues/218/comments","statuses_url":"https://api.github.com/repos/OCA/l10n-italy/statuses/2ea0c257a84cd7e6d4231c16b44ccb768b74fed9","head":{"label":"alessandrocamilli:sepa","ref":"sepa","sha":"2ea0c257a84cd7e6d4231c16b44ccb768b74fed9","user":{"login":"alessandrocamilli","id":7657512,"avatar_url":"https://avatars.githubusercontent.com/u/7657512?v=3","gravatar_id":"","url":"https://api.github.com/users/alessandrocamilli","html_url":"https://github.com/alessandrocamilli","followers_url":"https://api.github.com/users/alessandrocamilli/followers","following_url":"https://api.github.com/users/alessandrocamilli/following{/other_user}","gists_url":"https://api.github.com/users/alessandrocamilli/gists{/gist_id}","starred_url":"https://api.github.com/users/alessandrocamilli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alessandrocamilli/subscriptions","organizations_url":"https://api.github.com/users/alessandrocamilli/orgs","repos_url":"https://api.github.com/users/alessandrocamilli/repos","events_url":"https://api.github.com/users/alessandrocamilli/events{/privacy}","received_events_url":"https://api.github.com/users/alessandrocamilli/received_events","type":"User","site_admin":false},"repo":{"id":51992092,"name":"l10n-italy","full_name":"alessandrocamilli/l10n-italy","owner":{"login":"alessandrocamilli","id":7657512,"avatar_url":"https://avatars.githubusercontent.com/u/7657512?v=3","gravatar_id":"","url":"https://api.github.com/users/alessandrocamilli","html_url":"https://github.com/alessandrocamilli","followers_url":"https://api.github.com/users/alessandrocamilli/followers","following_url":"https://api.github.com/users/alessandrocamilli/following{/other_user}","gists_url":"https://api.github.com/users/alessandrocamilli/gists{/gist_id}","starred_url":"https://api.github.com/users/alessandrocamilli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alessandrocamilli/subscriptions","organizations_url":"https://api.github.com/users/alessandrocamilli/orgs","repos_url":"https://api.github.com/users/alessandrocamilli/repos","events_url":"https://api.github.com/users/alessandrocamilli/events{/privacy}","received_events_url":"https://api.github.com/users/alessandrocamilli/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alessandrocamilli/l10n-italy","description":"","fork":true,"url":"https://api.github.com/repos/alessandrocamilli/l10n-italy","forks_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/forks","keys_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/teams","hooks_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/hooks","issue_events_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/issues/events{/number}","events_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/events","assignees_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/assignees{/user}","branches_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/branches{/branch}","tags_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/tags","blobs_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/git/refs{/sha}","trees_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/statuses/{sha}","languages_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/languages","stargazers_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/stargazers","contributors_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/contributors","subscribers_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/subscribers","subscription_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/subscription","commits_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/commits{/sha}","git_commits_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/git/commits{/sha}","comments_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/comments{/number}","issue_comment_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/issues/comments{/number}","contents_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/contents/{+path}","compare_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/merges","archive_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/downloads","issues_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/issues{/number}","pulls_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/pulls{/number}","milestones_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/milestones{/number}","notifications_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/labels{/name}","releases_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/releases{/id}","deployments_url":"https://api.github.com/repos/alessandrocamilli/l10n-italy/deployments","created_at":"2016-02-18T08:27:21Z","updated_at":"2016-02-18T08:27:22Z","pushed_at":"2016-08-18T10:14:23Z","git_url":"git://github.com/alessandrocamilli/l10n-italy.git","ssh_url":"git@github.com:alessandrocamilli/l10n-italy.git","clone_url":"https://github.com/alessandrocamilli/l10n-italy.git","svn_url":"https://github.com/alessandrocamilli/l10n-italy","homepage":null,"size":6405,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"9.0"}},"base":{"label":"OCA:8.0","ref":"8.0","sha":"cb94cdc91ec95f8ebfc6074136d25c5ad0dbeaee","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":20648763,"name":"l10n-italy","full_name":"OCA/l10n-italy","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/l10n-italy","description":"","fork":false,"url":"https://api.github.com/repos/OCA/l10n-italy","forks_url":"https://api.github.com/repos/OCA/l10n-italy/forks","keys_url":"https://api.github.com/repos/OCA/l10n-italy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OCA/l10n-italy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OCA/l10n-italy/teams","hooks_url":"https://api.github.com/repos/OCA/l10n-italy/hooks","issue_events_url":"https://api.github.com/repos/OCA/l10n-italy/issues/events{/number}","events_url":"https://api.github.com/repos/OCA/l10n-italy/events","assignees_url":"https://api.github.com/repos/OCA/l10n-italy/assignees{/user}","branches_url":"https://api.github.com/repos/OCA/l10n-italy/branches{/branch}","tags_url":"https://api.github.com/repos/OCA/l10n-italy/tags","blobs_url":"https://api.github.com/repos/OCA/l10n-italy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OCA/l10n-italy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OCA/l10n-italy/git/refs{/sha}","trees_url":"https://api.github.com/repos/OCA/l10n-italy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OCA/l10n-italy/statuses/{sha}","languages_url":"https://api.github.com/repos/OCA/l10n-italy/languages","stargazers_url":"https://api.github.com/repos/OCA/l10n-italy/stargazers","contributors_url":"https://api.github.com/repos/OCA/l10n-italy/contributors","subscribers_url":"https://api.github.com/repos/OCA/l10n-italy/subscribers","subscription_url":"https://api.github.com/repos/OCA/l10n-italy/subscription","commits_url":"https://api.github.com/repos/OCA/l10n-italy/commits{/sha}","git_commits_url":"https://api.github.com/repos/OCA/l10n-italy/git/commits{/sha}","comments_url":"https://api.github.com/repos/OCA/l10n-italy/comments{/number}","issue_comment_url":"https://api.github.com/repos/OCA/l10n-italy/issues/comments{/number}","contents_url":"https://api.github.com/repos/OCA/l10n-italy/contents/{+path}","compare_url":"https://api.github.com/repos/OCA/l10n-italy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OCA/l10n-italy/merges","archive_url":"https://api.github.com/repos/OCA/l10n-italy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OCA/l10n-italy/downloads","issues_url":"https://api.github.com/repos/OCA/l10n-italy/issues{/number}","pulls_url":"https://api.github.com/repos/OCA/l10n-italy/pulls{/number}","milestones_url":"https://api.github.com/repos/OCA/l10n-italy/milestones{/number}","notifications_url":"https://api.github.com/repos/OCA/l10n-italy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OCA/l10n-italy/labels{/name}","releases_url":"https://api.github.com/repos/OCA/l10n-italy/releases{/id}","deployments_url":"https://api.github.com/repos/OCA/l10n-italy/deployments","created_at":"2014-06-09T14:08:49Z","updated_at":"2016-05-31T09:33:54Z","pushed_at":"2016-08-18T10:14:23Z","git_url":"git://github.com/OCA/l10n-italy.git","ssh_url":"git@github.com:OCA/l10n-italy.git","clone_url":"https://github.com/OCA/l10n-italy.git","svn_url":"https://github.com/OCA/l10n-italy","homepage":null,"size":8040,"stargazers_count":32,"watchers_count":32,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":67,"mirror_url":null,"open_issues_count":49,"forks":67,"open_issues":49,"watchers":32,"default_branch":"9.0"}},"_links":{"self":{"href":"https://api.github.com/repos/OCA/l10n-italy/pulls/218"},"html":{"href":"https://github.com/OCA/l10n-italy/pull/218"},"issue":{"href":"https://api.github.com/repos/OCA/l10n-italy/issues/218"},"comments":{"href":"https://api.github.com/repos/OCA/l10n-italy/issues/218/comments"},"review_comments":{"href":"https://api.github.com/repos/OCA/l10n-italy/pulls/218/comments"},"review_comment":{"href":"https://api.github.com/repos/OCA/l10n-italy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OCA/l10n-italy/pulls/218/commits"},"statuses":{"href":"https://api.github.com/repos/OCA/l10n-italy/statuses/2ea0c257a84cd7e6d4231c16b44ccb768b74fed9"}}}}
{"actor":{"display_login":"alessandrocamilli"}}