Skip to content

Commit

Permalink
Merge 737557a into 80f748c
Browse files Browse the repository at this point in the history
  • Loading branch information
mileo committed May 17, 2019
2 parents 80f748c + 737557a commit b277404
Show file tree
Hide file tree
Showing 63 changed files with 5,504 additions and 13 deletions.
31 changes: 18 additions & 13 deletions l10n_br_account_product/sped/nfe/document.py
Expand Up @@ -251,7 +251,12 @@ def _emmiter(self, invoice, company):
company.zip or '')
self.nfe.infNFe.emit.enderEmit.cPais.valor = (
company.country_id.bc_code[1:])
self.nfe.infNFe.emit.enderEmit.xPais.valor = company.country_id.name

if company.country_id.name.lower() == 'brazil':
self.nfe.infNFe.emit.enderEmit.xPais.valor = 'Brasil'
else:
self.nfe.infNFe.emit.enderEmit.xPais.valor = company.country_id.name

self.nfe.infNFe.emit.enderEmit.fone.valor = punctuation_rm(
str(company.phone or '').replace(' ', ''))
self.nfe.infNFe.emit.IE.valor = punctuation_rm(
Expand Down Expand Up @@ -310,18 +315,18 @@ def _receiver(self, invoice, company, nfe_environment):
invoice.partner_id.legal_name[:60] or '')
).encode('ASCII', 'ignore'))

if invoice.partner_id.is_company:
self.nfe.infNFe.dest.IE.valor = punctuation_rm(
invoice.partner_id.inscr_est)

if invoice.partner_id.country_id.id == \
invoice.company_id.country_id.id:
if invoice.partner_id.is_company:
self.nfe.infNFe.dest.IE.valor = punctuation_rm(
invoice.partner_id.inscr_est)

if invoice.partner_id.country_id.id == \
invoice.company_id.country_id.id:
if invoice.partner_id.is_company:
self.nfe.infNFe.dest.CNPJ.valor = punctuation_rm(
invoice.partner_id.cnpj_cpf)
else:
self.nfe.infNFe.dest.CPF.valor = punctuation_rm(
invoice.partner_id.cnpj_cpf)
self.nfe.infNFe.dest.CNPJ.valor = punctuation_rm(
invoice.partner_id.cnpj_cpf)
else:
self.nfe.infNFe.dest.CPF.valor = punctuation_rm(
invoice.partner_id.cnpj_cpf)

self.nfe.infNFe.dest.indIEDest.valor = \
invoice.partner_id.partner_fiscal_type_id.ind_ie_dest
Expand Down Expand Up @@ -359,7 +364,7 @@ def _details(self, invoice, invoice_line, index):
self.det.prod.cEAN.valor =\
invoice_line.product_id.barcode or 'SEM GTIN'
self.det.prod.cEANTrib.valor =\
invoice_line.product_id.barcode or ''
invoice_line.product_id.barcode or 'SEM GTIN'
self.det.prod.xProd.valor = (normalize(
'NFKD', unicode(
invoice_line.product_id.name[:120] or '')
Expand Down
74 changes: 74 additions & 0 deletions nfe/README.rst
@@ -0,0 +1,74 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

======================
Nota Fiscal Eletrônica
======================

Esse módulo implementa as interações de documentos eletrônicos com o SEFAZ.

Com ele é possível transmitir e consultar NF-e, fazer cartas de correção, inutilizar faixas de numeração,
importar documentos eletrônicos a partir de arquivos TXT e XML, consultar MD-e, manifestar ciência ou desconhecimento da
MD-e e importar a NF-e diretamente da MD-e.

Installation
============

This module depends on :
* l10n_br_account_product
* barcodes

This modules is part of the odoo-brazil/odoo-brazil-eletronic-documents suite.

Configuration
=============


Usage
=====

This module provides a menu to import invoices in TXT and XML format

For further information, please visit:

* https://www.odoo.com/forum/help-1

Known issues / Roadmap
======================

* no known issues

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/odoo-brazil/odoo-brazil-eletronic-documents/issues>`_. In case of trouble, please
check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
`here <https://github.com/odoo-brazil/odoo-brazil-eletronic-documents/issues/new?body=module
:%nfe_mde%0Aversion:%208
.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.


Credits
=======

Contributors
------------

* Danimar Ribeiro <danimar.ribeiro@trustcode.com.br>
* Luis Felipe Mileo <mileo@kmee.com.br>


Maintainer
----------

.. image:: https://brasil.odoo.com/logo.png
:alt: Odoo Brazil
:target: http://brazil.odoo.com

This module is maintained by the Odoo Brazil.

the Odoo Brazil Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

To contribute to this module, please visit http://brazil.odoo.com
25 changes: 25 additions & 0 deletions nfe/__init__.py
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2013 Renato Lima - Akretion
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###############################################################################

from . import sped
from . import models
from . import wizard
from . import report
from . import service
from . import tests
76 changes: 76 additions & 0 deletions nfe/__manifest__.py
@@ -0,0 +1,76 @@
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2013 Renato Lima - Akretion
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###############################################################################

{
'name': 'NFE',
'version': '8.0.1.0.0',
'category': 'Generic Modules',
'author': 'Akretion, Danimar Ribeiro, KMEE',
'license': 'AGPL-3',
'website': 'http://www.openerpbrasil.org',
'description': """
Implementa a exportação de notas fiscais através de
arquivos XML
Este módulo é complementar para enviar para a receita a nfe,
inutilização e cancelamento de notas.
Dependencias: pysped, geraldo, pyxmlsec
Instalando pyxmlsec
sudo pip install pyxmlsec
Dependencias ->
sudo apt-get install libxmlsec1-dev
sudo apt-get install libxml2-dev
Instalando geraldo
sudo pip install geraldo
""",
'external_dependencies': {
'python': [
'pysped'
],
},
'depends': [
'l10n_br_account_product',
'barcodes',
],
'data': [
'data/nfe_attach_email.xml',
'security/ir.model.access.csv',
'wizard/nfe_xml_periodic_export.xml',
'wizard/nfe_invoice_cce_view.xml',
'wizard/nfe_invoice_cancel_view.xml',
'wizard/l10n_br_account_invoice_import.xml',
'data/nfe_schedule.xml',
# 'account_invoice_workflow.xml',
'views/l10n_br_account_view.xml',
'views/account_invoice_view.xml',
'views/res_partner_view.xml',
'views/res_company_view.xml',
'views/nfe_mde_view.xml',
'views/account_fiscal_position_view.xml',
'views/nfe_import_view.xml',
'report/report_print_button_view.xml',
'report/report_danfe.xml',
'wizard/wizard_nfe_import_xml_view.xml',
],
'css': [
'static/src/css/nfe_import.css'
],
'demo': [],
'test': [],
'installable': True,
}
55 changes: 55 additions & 0 deletions nfe/account_invoice_workflow.xml
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>

<record id="l10n_br_account.act_sefaz_export" model="workflow.activity">
<field name="wkf_id" ref="account.wkf"/>
<field name="name">sefaz_export</field>
<field name="action">nfe_export()</field>
<field name="kind">function</field>
</record>

<record id="act_sefaz_transmit" model="workflow.activity">
<field name="wkf_id" ref="account.wkf"/>
<field name="name">sefaz_transmit</field>
<field name="action">action_invoice_send_nfe()</field>
<field name="kind">function</field>
</record>

<record id="l10n_br_account.act_sefaz_exception" model="workflow.activity">
<field name="wkf_id" ref="account.wkf"/>
<field name="name">sefaz_exception</field>
<field name="kind">dummy</field>
<field name="action"></field>
</record>

<record id="tras_sefaz_transmit_exception" model="workflow.transition">
<field name="act_from" ref="act_sefaz_transmit"/>
<field name="act_to" ref="l10n_br_account.act_sefaz_exception"/>
<field name="condition">(state=='sefaz_exception')</field>
<field name="signal" eval="False"/>
</record>

<record id="tras_sefaz_transmit_authorized" model="workflow.transition">
<field name="act_from" ref="act_sefaz_transmit"/>
<field name="act_to" ref="account.act_open"/>
<field name="condition">(state=='open')</field>
<field name="signal" eval="False"/>
</record>

<record id="tras_sefaz_export_to_exception" model="workflow.transition">
<field name="act_from" ref="l10n_br_account.act_sefaz_exception"/>
<field name="act_to" ref="l10n_br_account.act_sefaz_export"/>
<field name="condition">True</field>
<field name="signal">invoice_resend</field>
</record>

<record id="tras_sefaz_export_transmit" model="workflow.transition">
<field name="act_from" ref="l10n_br_account.act_sefaz_export"/>
<field name="act_to" ref="act_sefaz_transmit"/>
<field name="condition">True</field>
<field name="signal">invoice_trysend</field>
</record>

</data>
</openerp>
96 changes: 96 additions & 0 deletions nfe/data/nfe_attach_email.xml
@@ -0,0 +1,96 @@
<openerp>
<data noupdate="1">
<record id="email_template_nfe" model="mail.template">
<field name="name">NF-E - Send by Email</field>
<field name="email_from">${(object.user_id.email or object.company_id.email or 'noreply@localhost')|safe}</field>
<field name="subject">${object.company_id.name} NF ${object.document_serie_id.code}/${object.number or 'n/a'}</field>
<field name="email_recipients">${object.contact_id and object.contact_id.id or object.partner_id.id}</field>
<field name="model_id" ref="account.model_account_invoice"/>
<field name="attachment_ids"/>
<field name="auto_delete" eval="True"/>
<field name="lang">${object.partner_id.lang}</field>
<field name="body_html">
<![CDATA[ <div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #EEE; ">
<div style="font-family: 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif; font-size: 12px; color: rgb(34, 34, 34); background-color: #EEE; ">
<p>Olá ${object.partner_id.name},</p>
<p>Este e-mail refere-se a Nota Fiscal Eletrônica Nacional</p>
<p style="border-left: 1px solid #00008e; margin-left: 30px;">
&nbsp;&nbsp;<strong>REFERÊNCIAS</strong><br />
&nbsp;&nbsp;Razão Social: <strong>${object.partner_id.legal_name}</strong><br />
&nbsp;&nbsp;CNPJ: <strong>${object.partner_id.cnpj_cpf}</strong><br />
&nbsp;&nbsp;Chave de acesso: <strong>${object.nfe_access_key}</strong><br />
% if object.nfe_protocol_number:
&nbsp;&nbsp;Protocolo: <strong>${object.nfe_protocol_number or " "}</strong><br />
% endif
&nbsp;&nbsp;Número: <strong>${object.internal_number}</strong><br />
&nbsp;&nbsp;Série: <strong>${object.document_serie_id.code}</strong><br />
&nbsp;&nbsp;Data da Fatura: ${object.date_invoice}<br />
&nbsp;&nbsp;Valor Total: <strong>${object.currency_id.symbol} ${object.amount_total} </strong><br />
% if object.origin:
&nbsp;&nbsp;Referência
% endif
% if object.name:
&nbsp;do Cliente
% endif
% if object.name:
&nbsp;- ${object.name}
% endif
% if object.origin:
&nbsp;- ${object.origin} <br />
% endif
% if object.user_id.email:
&nbsp;&nbsp;Contato: <a href="mailto:${object.user_id.email or ''}?subject=Invoice%20${object.number}">${object.user_id.name}</a>
% endif
</p>
<p>Para verificar a autorização da SEFAZ referente à nota acima mencionada, acesse o site http://www.nfe.fazenda.gov.br/portal</p>
<br/>
<br/>
<div style="width: 375px; margin: 0px; padding: 0px; background-color: #00008E; border-top-left-radius: 5px 5px; border-top-right-radius: 5px 5px; background-repeat: repeat no-repeat;">
<h3 style="margin: 0px; padding: 2px 14px; font-size: 12px; color: #DDD;">
<strong style="text-transform:uppercase;">${object.company_id.name}</strong></h3>
</div>
<div style="width: 347px; margin: 0px; padding: 5px 14px; line-height: 16px; background-color: #EEE;">
<span style="color: #222; margin-bottom: 5px; display: block; ">
% if object.company_id.legal_name:
Razão Social: ${object.company_id.legal_name}<br/>
CNPJ: ${object.company_id.cnpj_cpf}<br/>
% endif
% if object.company_id.street:
Endereço: ${object.company_id.street} &nbsp; ${object.company_id.number or ' '}, ${object.company_id.district}<br/>
% endif
% if object.company_id.street2:
${object.company_id.street2}<br/>
% endif
% if object.company_id.city or object.company_id.zip:
CEP: ${object.company_id.zip} ${object.company_id.l10n_br_city_id.name}<br/>
% endif
% if object.company_id.country_id:
UF: ${object.company_id.state_id.code and ('%s, ' % object.company_id.state_id.name) or ''} ${object.company_id.country_id.name or ''}<br/>
% endif
</span>
% if object.company_id.phone:
<div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">
Tel:&nbsp; ${object.company_id.phone}
</div>
% endif
% if object.company_id.website:
<div>
Web :&nbsp;<a href="${object.company_id.website}">${object.company_id.website}</a>
</div>
%endif
<hr>
<br>
</div>
% if object.company_id.nfe_email:
<p><i>${object.company_id.nfe_email}</i></p>
%endif
</div> ]]>
</field>
</record>
</data>
</openerp>

0 comments on commit b277404

Please sign in to comment.