Skip to content

Commit

Permalink
Merge 012a88d into e6b48f1
Browse files Browse the repository at this point in the history
  • Loading branch information
leorochael committed Apr 26, 2016
2 parents e6b48f1 + 012a88d commit 354bc4a
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
16 changes: 16 additions & 0 deletions l10n_br_account_product/models/account_invoice.py
Expand Up @@ -23,6 +23,7 @@
from openerp import models, fields, api, _
from openerp.addons import decimal_precision as dp
from openerp.exceptions import RedirectWarning
from openerp.exceptions import ValidationError

from openerp.addons.l10n_br_account.models.account_invoice import (
OPERATION_TYPE,
Expand Down Expand Up @@ -756,6 +757,21 @@ def _compute_price(self):
freight_value = fields.Float(
'Frete', digits=dp.get_precision('Account'), default=0.00)
fiscal_comment = fields.Text(u'Observação Fiscal')
xped = fields.Char(
string=u"Código do Pedido (xPed)",
size=15,
)
nitemped = fields.Char(
string=u"Item do Pedido (nItemPed)",
size=6,
)

@api.onchange("nitemped")
def _check_nitemped(self):
if self.nitemped and not self.nitemped.isdigit():
raise ValidationError(
_(u"nItemPed must be a number with up to six digits")
)

def _amount_tax_icms(self, tax=None):
result = {
Expand Down
3 changes: 3 additions & 0 deletions l10n_br_account_product/sped/nfe/document.py
Expand Up @@ -132,6 +132,7 @@ def _nfe_identification(self, invoice, company, nfe_environment):
self.nfe.infNFe.ide.finNFe.valor = invoice.nfe_purpose
self.nfe.infNFe.ide.procEmi.valor = 0
self.nfe.infNFe.ide.verProc.valor = 'OpenERP Brasil v8'
self.nfe.infNFe.compra.xPed.valor = invoice.name or ''

if invoice.cfop_ids[0].type in ("input"):
self.nfe.infNFe.ide.tpNF.valor = 0
Expand Down Expand Up @@ -356,6 +357,8 @@ def _details(self, invoice, invoice_line, index):
self.det.prod.vDesc.valor = str("%.2f" % invoice_line.discount_value)
self.det.prod.vOutro.valor = str(
"%.2f" % invoice_line.other_costs_value)
self.det.prod.xPed.valor = invoice_line.xped or ''
self.det.prod.nItemPed.valor = invoice_line.nitemped or ''
self.det.infAdProd.valor = invoice_line.fiscal_comment or ''

#
Expand Down
10 changes: 9 additions & 1 deletion l10n_br_account_product/views/account_invoice_view.xml
Expand Up @@ -449,7 +449,15 @@
</notebook>
</page>
<page string="Informações Adicionais">
<group>
<group string="Informação de interesse do emissor para controle do B2B">
<group>
<field name="xped"/>
</group>
<group>
<field name="nitemped"/>
</group>
</group>
<group string="Observações Fiscais">
<field name="fiscal_comment" nolabel="1"/>
</group>
</page>
Expand Down

0 comments on commit 354bc4a

Please sign in to comment.