Skip to content

Commit

Permalink
[MERGE] Data de Entrada/Saída nos documentos fiscais
Browse files Browse the repository at this point in the history
  • Loading branch information
renatonlima committed Oct 21, 2014
2 parents 8a7c780 + 28a59c8 commit 16e83f7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
13 changes: 13 additions & 0 deletions l10n_br_account_product/account_invoice.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ def _get_invoice_tax(self, cr, uid, ids, context=None):
return list(result.keys())

_columns = {
'date_in_out': fields.date(
u'Data de Entrada/Saida', readonly=True,
states={'draft': [('readonly', False)]},
select=True, help="Deixe em branco para usar a data atual"),
'partner_shipping_id': fields.many2one(
'res.partner', 'Delivery Address',
readonly=True, required=True,
Expand Down Expand Up @@ -495,6 +499,15 @@ def nfe_check(self, cr, uid, ids, context=None):
result = txt.validate(cr, uid, ids, context)
return result

def action_move_create(self, cr, uid, ids, *args):
result = super(AccountInvoice, self).action_move_create(
cr, uid, ids, *args)
for invoice in self.browse(cr, uid, ids):
if not invoice.date_in_out:
date_in_out = invoice.date_invoice or time.strftime('%Y-%m-%d')
self.write(cr, uid, [invoice.id], {'date_in_out': date_in_out})
return result


class AccountInvoiceLine(orm.Model):
_inherit = 'account.invoice.line'
Expand Down
6 changes: 6 additions & 0 deletions l10n_br_account_product/account_invoice_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
</label>
<field name="comment" position="replace">
</field>
<field name="date_invoice" position="after">
<field name="date_in_out" string="Data Saida"/>
</field>
<notebook position="inside">
<page string="Documentos Relacionados">
<field colspan="4" nolabel="1" name="fiscal_document_related_ids">
Expand Down Expand Up @@ -141,6 +144,9 @@
</label>
<field name="comment" position="replace">
</field>
<field name="date_invoice" position="after">
<field name="date_in_out" string="Data Entrada"/>
</field>
<notebook>
<page string="Documentos Relacionados">
<field colspan="4" nolabel="1" name="fiscal_document_related_ids">
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_account_product/sped/nfe/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _serializer(self, cr, uid, ids, nfe_environment, context=None):
nfe.infNFe.ide.serie.valor = inv.document_serie_id.code or ''
nfe.infNFe.ide.nNF.valor = inv.internal_number or ''
nfe.infNFe.ide.dEmi.valor = inv.date_invoice or ''
nfe.infNFe.ide.dSaiEnt.valor = inv.date_invoice or ''
nfe.infNFe.ide.dSaiEnt.valor = inv.date_in_out or ''
nfe.infNFe.ide.cMunFG.valor = ('%s%s') % (company.state_id.ibge_code, company.l10n_br_city_id.ibge_code)
nfe.infNFe.ide.tpImp.valor = 1 # (1 - Retrato; 2 - Paisagem)
nfe.infNFe.ide.tpEmis.valor = 1
Expand Down
2 changes: 1 addition & 1 deletion l10n_br_account_product/sped/nfe/serializer/txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def nfe_export(cr, uid, ids, nfe_environment='1',
'serie': inv.document_serie_id.code,
'nNF': inv.internal_number or '',
'dEmi': inv.date_invoice or '',
'dSaiEnt': inv.date_invoice or '',
'dSaiEnt': inv.date_in_out or '',
'hSaiEnt': '',
'tpNF': '',
'cMunFG': ('%s%s') % (company_addr_default.state_id.ibge_code, company_addr_default.l10n_br_city_id.ibge_code),
Expand Down

0 comments on commit 16e83f7

Please sign in to comment.