{"action":"created","comment":{"url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/pulls/comments/69132994","id":69132994,"diff_hunk":"@@ -37,7 +38,76 @@ class PaymentOrder(models.Model):\n     sufixo_arquivo = fields.Integer(u'Sufixo do arquivo')\n     serie_sufixo_arquivo = fields.Many2one(\n         'l10n_br_cnab_file_sufix.sequence', u'Série do Sufixo do arquivo')\n+    \n+    # we will validate here user inputs required to export\n+    # a wrong input shouldn't raise error but should show helpful\n+    # warning message\n+    @api.multi\n+    def validate_order(self):\n+        if not len(self.line_ids):\n+            raise Warning(\"Please select lines to export\")\n+        # code must belong to one of allowed code\n+        if self.mode_type.code not in ['240', '400', '500']:\n+            raise Warning(\"Payment Type Code must be 240, 400 or 500, found %s\" % self.mode_type.code)\n+        # legal name max length is accepted 30 chars\n+        if len(self.company_id.legal_name) > 30:\n+            raise Warning(\"Company's Rezão Social should not be longer than 30 chars\")\n+        if not self.mode.boleto_protesto:\n+            raise Warning(u\"Códigos de Protesto in payment mode not defined\")\n+        if not self.mode.boleto_protesto_prazo:\n+            raise Warning(u\"Prazo protesto in payment mode not defined\")\n+        else:\n+            try:\n+                int(self.mode.boleto_protesto_prazo)\n+            except:\n+                raise Warning(\"Prazo protesto in payment mode must be integer\")\n+        if not self.mode.bank_id.bra_number_dig:\n+            raise Warning(\"Dígito Agência not defined\")\n+        else:\n+            try:\n+                int(self.mode.bank_id.bra_number_dig)\n+            except:\n+                raise Warning(\"Dígito Agência must be integer\")\n \n+            \n+        # move lines must have transaction refernce\n+        for line in self.line_ids:\n+            if not line.partner_id:\n+                raise Warning(\"Partner not defined for %s\" %line.name)\n+            if not line.partner_id.legal_name:\n+                raise Warning(\"Rezão Social not defined for %s\" %line.partner_id.name)\n+            if len(line.partner_id.legal_name) > 30:\n+                raise Warning(\"Partner's Rezão Social should not be longer than 30 chars\")\n+            if not line.partner_id.state_id:\n+                raise Warning(\"Partner's state not defined\")\n+            if not line.partner_id.state_id.code:\n+                raise Warning(\"Partner's state code not defined\")\n+            # max 15 chars\n+            if not line.partner_id.district:\n+                raise Warning(\"Partner's bairro not defined\")\n+            else:\n+                if len(line.partner_id.district) > 15:\n+                    raise Warning(\"Partner's bairro %s can't be more than 15 digits\" %line.partner_id.district)\n+            if not line.partner_id.zip:\n+                raise Warning(\"Partner's CEP not defined\")\n+            if not line.partner_id.l10n_br_city_id:\n+                raise Warning(\"Partner's city not defined\")\n+            if not line.partner_id.street:\n+                raise Warning(\"Partner's street not defined\")\n+            if not line.move_line_id.transaction_ref:\n+                raise Warning(\"No transaction reference set for move %s\" % line.move_line_id.name)\n+            if len(line.move_line_id.transaction_ref) > 8:\n+                raise Warning(\"Transaction reference for move line can not be longer than 8 digits found %s\" %line.move_line_id.transaction_ref)\n+            try:\n+                int(line.move_line_id.transaction_ref)\n+            except:\n+                raise Warning(\"Transaction reference for move line must be integer\")\n+            if not line.move_line_id.invoice.number:\n+                raise Warning(\"Null value in 'numero_documento' number not defined for invoice %s\" % line.move_line_id.invoice.number)\n+            if len(line.move_line_id.invoice.number) > 10:","path":"l10n_br_account_banking_payment_cnab/model/payment_order.py","position":78,"original_position":78,"commit_id":"2bdf3c5d1a98a61c763915cd1744cbc42686e6f9","original_commit_id":"2bdf3c5d1a98a61c763915cd1744cbc42686e6f9","user":{"login":"carlosmaguda","id":15128943,"avatar_url":"https://avatars.githubusercontent.com/u/15128943?v=3","gravatar_id":"","url":"https://api.github.com/users/carlosmaguda","html_url":"https://github.com/carlosmaguda","followers_url":"https://api.github.com/users/carlosmaguda/followers","following_url":"https://api.github.com/users/carlosmaguda/following{/other_user}","gists_url":"https://api.github.com/users/carlosmaguda/gists{/gist_id}","starred_url":"https://api.github.com/users/carlosmaguda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlosmaguda/subscriptions","organizations_url":"https://api.github.com/users/carlosmaguda/orgs","repos_url":"https://api.github.com/users/carlosmaguda/repos","events_url":"https://api.github.com/users/carlosmaguda/events{/privacy}","received_events_url":"https://api.github.com/users/carlosmaguda/received_events","type":"User","site_admin":false},"body":"Sure, let me think of something and commit here.","created_at":"2016-06-30T13:38:37Z","updated_at":"2016-06-30T13:38:37Z","html_url":"https://github.com/odoo-brazil/odoo-brazil-banking/pull/37#discussion_r69132994","pull_request_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/pulls/37","_links":{"self":{"href":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/pulls/comments/69132994"},"html":{"href":"https://github.com/odoo-brazil/odoo-brazil-banking/pull/37#discussion_r69132994"},"pull_request":{"href":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/pulls/37"}}},"pull_request":{"url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/pulls/37","id":74600944,"html_url":"https://github.com/odoo-brazil/odoo-brazil-banking/pull/37","diff_url":"https://github.com/odoo-brazil/odoo-brazil-banking/pull/37.diff","patch_url":"https://github.com/odoo-brazil/odoo-brazil-banking/pull/37.patch","issue_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/issues/37","number":37,"state":"open","locked":false,"title":"Fix/itau boleto and cnab export","user":{"login":"carlosmaguda","id":15128943,"avatar_url":"https://avatars.githubusercontent.com/u/15128943?v=3","gravatar_id":"","url":"https://api.github.com/users/carlosmaguda","html_url":"https://github.com/carlosmaguda","followers_url":"https://api.github.com/users/carlosmaguda/followers","following_url":"https://api.github.com/users/carlosmaguda/following{/other_user}","gists_url":"https://api.github.com/users/carlosmaguda/gists{/gist_id}","starred_url":"https://api.github.com/users/carlosmaguda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carlosmaguda/subscriptions","organizations_url":"https://api.github.com/users/carlosmaguda/orgs","repos_url":"https://api.github.com/users/carlosmaguda/repos","events_url":"https://api.github.com/users/carlosmaguda/events{/privacy}","received_events_url":"https://api.github.com/users/carlosmaguda/received_events","type":"User","site_admin":false},"body":"Corrigimos a emissão do boleto, adicionando validações para as suas configurações, bem como campos de multa, juros e protestos.\r\n\r\nTambém fomos posição a posição no arquivo .REM do cnab240 para que ficasse de acordo com o validador do banco.\r\n\r\nAbraços!","created_at":"2016-06-21T12:18:22Z","updated_at":"2016-06-30T13:38:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8526c2cd6e6cc6f782b4a2a15e5cef8c3a3f490c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/pulls/37/commits","review_comments_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/pulls/37/comments","review_comment_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/pulls/comments{/number}","comments_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/issues/37/comments","statuses_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/statuses/2bdf3c5d1a98a61c763915cd1744cbc42686e6f9","head":{"label":"yk2kus:fix/itau_header","ref":"fix/itau_header","sha":"2bdf3c5d1a98a61c763915cd1744cbc42686e6f9","user":{"login":"yk2kus","id":6999933,"avatar_url":"https://avatars.githubusercontent.com/u/6999933?v=3","gravatar_id":"","url":"https://api.github.com/users/yk2kus","html_url":"https://github.com/yk2kus","followers_url":"https://api.github.com/users/yk2kus/followers","following_url":"https://api.github.com/users/yk2kus/following{/other_user}","gists_url":"https://api.github.com/users/yk2kus/gists{/gist_id}","starred_url":"https://api.github.com/users/yk2kus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yk2kus/subscriptions","organizations_url":"https://api.github.com/users/yk2kus/orgs","repos_url":"https://api.github.com/users/yk2kus/repos","events_url":"https://api.github.com/users/yk2kus/events{/privacy}","received_events_url":"https://api.github.com/users/yk2kus/received_events","type":"User","site_admin":false},"repo":{"id":53502771,"name":"odoo-brazil-banking","full_name":"yk2kus/odoo-brazil-banking","owner":{"login":"yk2kus","id":6999933,"avatar_url":"https://avatars.githubusercontent.com/u/6999933?v=3","gravatar_id":"","url":"https://api.github.com/users/yk2kus","html_url":"https://github.com/yk2kus","followers_url":"https://api.github.com/users/yk2kus/followers","following_url":"https://api.github.com/users/yk2kus/following{/other_user}","gists_url":"https://api.github.com/users/yk2kus/gists{/gist_id}","starred_url":"https://api.github.com/users/yk2kus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yk2kus/subscriptions","organizations_url":"https://api.github.com/users/yk2kus/orgs","repos_url":"https://api.github.com/users/yk2kus/repos","events_url":"https://api.github.com/users/yk2kus/events{/privacy}","received_events_url":"https://api.github.com/users/yk2kus/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/yk2kus/odoo-brazil-banking","description":"","fork":true,"url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking","forks_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/forks","keys_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/teams","hooks_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/hooks","issue_events_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/issues/events{/number}","events_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/events","assignees_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/assignees{/user}","branches_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/branches{/branch}","tags_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/tags","blobs_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/git/refs{/sha}","trees_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/statuses/{sha}","languages_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/languages","stargazers_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/stargazers","contributors_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/contributors","subscribers_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/subscribers","subscription_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/subscription","commits_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/commits{/sha}","git_commits_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/git/commits{/sha}","comments_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/comments{/number}","issue_comment_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/issues/comments{/number}","contents_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/contents/{+path}","compare_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/merges","archive_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/downloads","issues_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/issues{/number}","pulls_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/pulls{/number}","milestones_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/milestones{/number}","notifications_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/labels{/name}","releases_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/releases{/id}","deployments_url":"https://api.github.com/repos/yk2kus/odoo-brazil-banking/deployments","created_at":"2016-03-09T14:11:29Z","updated_at":"2016-03-09T14:11:30Z","pushed_at":"2016-06-24T17:50:47Z","git_url":"git://github.com/yk2kus/odoo-brazil-banking.git","ssh_url":"git@github.com:yk2kus/odoo-brazil-banking.git","clone_url":"https://github.com/yk2kus/odoo-brazil-banking.git","svn_url":"https://github.com/yk2kus/odoo-brazil-banking","homepage":null,"size":338,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"8.0"}},"base":{"label":"odoo-brazil:8.0","ref":"8.0","sha":"e3ae88704012f5a1aca7dbd230f349c51a1f43c5","user":{"login":"odoo-brazil","id":2179366,"avatar_url":"https://avatars.githubusercontent.com/u/2179366?v=3","gravatar_id":"","url":"https://api.github.com/users/odoo-brazil","html_url":"https://github.com/odoo-brazil","followers_url":"https://api.github.com/users/odoo-brazil/followers","following_url":"https://api.github.com/users/odoo-brazil/following{/other_user}","gists_url":"https://api.github.com/users/odoo-brazil/gists{/gist_id}","starred_url":"https://api.github.com/users/odoo-brazil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odoo-brazil/subscriptions","organizations_url":"https://api.github.com/users/odoo-brazil/orgs","repos_url":"https://api.github.com/users/odoo-brazil/repos","events_url":"https://api.github.com/users/odoo-brazil/events{/privacy}","received_events_url":"https://api.github.com/users/odoo-brazil/received_events","type":"Organization","site_admin":false},"repo":{"id":37999899,"name":"odoo-brazil-banking","full_name":"odoo-brazil/odoo-brazil-banking","owner":{"login":"odoo-brazil","id":2179366,"avatar_url":"https://avatars.githubusercontent.com/u/2179366?v=3","gravatar_id":"","url":"https://api.github.com/users/odoo-brazil","html_url":"https://github.com/odoo-brazil","followers_url":"https://api.github.com/users/odoo-brazil/followers","following_url":"https://api.github.com/users/odoo-brazil/following{/other_user}","gists_url":"https://api.github.com/users/odoo-brazil/gists{/gist_id}","starred_url":"https://api.github.com/users/odoo-brazil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odoo-brazil/subscriptions","organizations_url":"https://api.github.com/users/odoo-brazil/orgs","repos_url":"https://api.github.com/users/odoo-brazil/repos","events_url":"https://api.github.com/users/odoo-brazil/events{/privacy}","received_events_url":"https://api.github.com/users/odoo-brazil/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/odoo-brazil/odoo-brazil-banking","description":"Framework Bancário Brasileiro Odoo","fork":false,"url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking","forks_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/forks","keys_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/keys{/key_id}","collaborators_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/teams","hooks_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/hooks","issue_events_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/issues/events{/number}","events_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/events","assignees_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/assignees{/user}","branches_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/branches{/branch}","tags_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/tags","blobs_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/git/refs{/sha}","trees_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/git/trees{/sha}","statuses_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/statuses/{sha}","languages_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/languages","stargazers_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/stargazers","contributors_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/contributors","subscribers_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/subscribers","subscription_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/subscription","commits_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/commits{/sha}","git_commits_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/git/commits{/sha}","comments_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/comments{/number}","issue_comment_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/issues/comments{/number}","contents_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/contents/{+path}","compare_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/compare/{base}...{head}","merges_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/merges","archive_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/downloads","issues_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/issues{/number}","pulls_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/pulls{/number}","milestones_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/milestones{/number}","notifications_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/labels{/name}","releases_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/releases{/id}","deployments_url":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/deployments","created_at":"2015-06-24T17:30:02Z","updated_at":"2016-06-15T22:37:39Z","pushed_at":"2016-06-27T21:55:15Z","git_url":"git://github.com/odoo-brazil/odoo-brazil-banking.git","ssh_url":"git@github.com:odoo-brazil/odoo-brazil-banking.git","clone_url":"https://github.com/odoo-brazil/odoo-brazil-banking.git","svn_url":"https://github.com/odoo-brazil/odoo-brazil-banking","homepage":"","size":351,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":11,"forks":17,"open_issues":11,"watchers":3,"default_branch":"8.0"}},"_links":{"self":{"href":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/pulls/37"},"html":{"href":"https://github.com/odoo-brazil/odoo-brazil-banking/pull/37"},"issue":{"href":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/issues/37"},"comments":{"href":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/issues/37/comments"},"review_comments":{"href":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/pulls/37/comments"},"review_comment":{"href":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/pulls/37/commits"},"statuses":{"href":"https://api.github.com/repos/odoo-brazil/odoo-brazil-banking/statuses/2bdf3c5d1a98a61c763915cd1744cbc42686e6f9"}}}}
{"actor":{"display_login":"carlosmaguda"}}