Skip to content

Commit

Permalink
Módulo de emissão de nota fiscal de serviços para o Rio de janeiro
Browse files Browse the repository at this point in the history
  • Loading branch information
danimaribeiro committed Mar 27, 2018
1 parent af12809 commit 08654e3
Show file tree
Hide file tree
Showing 14 changed files with 761 additions and 6 deletions.
3 changes: 2 additions & 1 deletion br_data_account/data/br_account.fiscal.document.csv
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@
"fiscal_document_007","007","NFS-e - Provedor SAATRI","True","True"
"fiscal_document_008","008","NFS-e - Provedor SIMPLISS","True","True"
"fiscal_document_009","009","NFS-e - Provedor SUSESU","True","True"
"fiscal_document_010","010","NFS-e Imperial - Petrópolis","True","True"
"fiscal_document_010","010","NFS-e - Nota Imperial Petrópolis","True","True"
"fiscal_document_012","012","NFS-e - Florianópolis","True","True"
"fiscal_document_013","013","NFS-e - Nota Carioca","True","True"
6 changes: 2 additions & 4 deletions br_nfe/models/invoice_eletronic.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,20 +805,18 @@ def action_send_eletronic_invoice(self):
self.mensagem_retorno = retorno.protNFe.infProt.xMotivo
if self.codigo_retorno == '100':
self.write({
'state': 'done', 'nfe_exception': False,
'state': 'done',
'protocolo_nfe': retorno.protNFe.infProt.nProt,
'data_autorizacao': retorno.protNFe.infProt.dhRecbto})
# Duplicidade de NF-e significa que a nota já está emitida
# TODO Buscar o protocolo de autorização, por hora só finalizar
if self.codigo_retorno == '204':
self.write({'state': 'done', 'codigo_retorno': '100',
'nfe_exception': False,
'mensagem_retorno': 'Autorizado o uso da NF-e'})

# Denegada e nota já está denegada
if self.codigo_retorno in ('302', '205'):
self.write({'state': 'denied',
'nfe_exception': True})
self.write({'state': 'denied'})

self.env['invoice.eletronic.event'].create({
'code': self.codigo_retorno,
Expand Down
5 changes: 5 additions & 0 deletions br_nfse_carioca/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
# © 2016 Danimar Ribeiro, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import models
27 changes: 27 additions & 0 deletions br_nfse_carioca/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
# © 2016 Danimar Ribeiro, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{ # pylint: disable=C8101,C8103
'name': 'Integração Nota Carioca',
'description': """Efetua a integração com a prefeitura do Rio de Janeiro
- Mantido por Trustcode""",
'summary': """Efetua a integração com a prefeitura do Rio de Janeiro
- Mantido por Trustcode""",
'version': '11.0.1.0.0',
'category': "Accounting & Finance",
'author': 'Trustcode',
'license': 'AGPL-3',
'website': 'http://www.trustcode.com.br',
'contributors': [
'Danimar Ribeiro <danimaribeiro@gmail.com>'
],
'depends': [
'br_nfse',
],
'data': [
'views/br_account_service.xml',
'reports/danfpse.xml',
],
'application': True,
}
7 changes: 7 additions & 0 deletions br_nfse_carioca/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
# © 2017 Danimar Ribeiro, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import account_invoice
from . import invoice_eletronic
from . import br_account_service
23 changes: 23 additions & 0 deletions br_nfse_carioca/models/account_invoice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# © 2017 Danimar Ribeiro, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).


from odoo import models


class AccountInvoice(models.Model):
_inherit = 'account.invoice'

def _return_pdf_invoice(self, doc):
if self.service_document_id.code == '012': # Floripa
return 'br_nfse_florianopolis.report_br_nfse_danfpse'
# TODO Implementar ou não?
# PS: ITS DONE MADAFAKA
return super(AccountInvoice, self)._return_pdf_invoice(doc)

def _prepare_edoc_item_vals(self, line):
res = super(AccountInvoice, self)._prepare_edoc_item_vals(line)
res['codigo_tributacao_municipio'] = \
line.service_type_id.codigo_tributacao_municipio
return res
12 changes: 12 additions & 0 deletions br_nfse_carioca/models/br_account_service.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# © 2018 Danimar Ribeiro <danimaribeiro@gmail.com>, Trustcode
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class BrAccountServiceType(models.Model):
_inherit = 'br_account.service.type'

codigo_tributacao_municipio = fields.Char(
string=u"Cód. Tribut. Munic.", size=20,
help="Código de Tributação no Munípio")

0 comments on commit 08654e3

Please sign in to comment.