def get_ibpt(self): for fiscal_classification in self: company = (fiscal_classification.env.user.company_id or fiscal_classification.company_id) config = DeOlhoNoImposto(company.ipbt_token, punctuation_rm(company.cnpj_cpf), company.state_id.code) result = get_ibpt_product( config, punctuation_rm(fiscal_classification.code or ''), ) vals = { 'fiscal_classification_id': fiscal_classification.id, 'origin': 'IBPT-WS', 'state_id': company.state_id.id, 'state_taxes': result.estadual, 'federal_taxes_national': result.nacional, 'federal_taxes_import': result.importado, 'company_id': company.id, } tax_estimate = fiscal_classification.env['l10n_br_tax.estimate'] tax_estimate.create(vals) return True
def _nfe_references(self, inv_related): # # Documentos referenciadas # if inv_related.document_type == 'nf': self.nfref.refNF.cUF.valor = (inv_related.state_id and inv_related.state_id.ibge_code or '', ) self.nfref.refNF.AAMM.valor = datetime.strptime( inv_related.date, '%Y-%m-%d').strftime('%y%m') or '' self.nfref.refNF.CNPJ.valor = punctuation_rm(inv_related.cnpj_cpf) self.nfref.refNF.mod.valor = (inv_related.fiscal_document_id and inv_related.fiscal_document_id.code or '') self.nfref.refNF.serie.valor = inv_related.serie or '' self.nfref.refNF.nNF.valor = inv_related.internal_number or '' elif inv_related.document_type == 'nfrural': self.nfref.refNFP.cUF.valor = (inv_related.state_id and inv_related.state_id.ibge_code or '', ) self.nfref.refNFP.AAMM.valor = datetime.strptime( inv_related.date, '%Y-%m-%d').strftime('%y%m') or '' self.nfref.refNFP.IE.valor = punctuation_rm(inv_related.inscr_est) self.nfref.refNFP.mod.valor = (inv_related.fiscal_document_id and inv_related.fiscal_document_id.code or '') self.nfref.refNFP.serie.valor = inv_related.serie or '' self.nfref.refNFP.nNF.valor = inv_related.internal_number or '' if inv_related.cpfcnpj_type == 'cnpj': self.nfref.refNFP.CNPJ.valor = punctuation_rm( inv_related.cnpj_cpf) else: self.nfref.refNFP.CPF.valor = punctuation_rm( inv_related.cnpj_cpf) elif inv_related.document_type == 'nfe': self.nfref.refNFe.valor = inv_related.access_key or '' elif inv_related.document_type == 'cte': self.nfref.refCTe.valor = inv_related.access_key or '' elif inv_related.document_type == 'cf': self.nfref.refECF.mod.valor = (inv_related.fiscal_document_id and inv_related.fiscal_document_id.code or '') self.nfref.refECF.nECF.valor = inv_related.internal_number self.nfref.refECF.nCOO.valor = inv_related.serie
def _set_domain(self, country_id=False, state_id=False, city_id=False, district=False, street=False, zip_code=False): domain = [] if zip_code: new_zip = misc.punctuation_rm(zip_code or '') domain.append(('zip_code', '=', new_zip)) else: if not state_id or not city_id or len(street or '') == 0: raise UserError( _('Necessário informar Estado, município e logradouro')) if country_id: domain.append(('country_id', '=', country_id)) if state_id: domain.append(('state_id', '=', state_id)) if city_id: domain.append(('city_id', '=', city_id)) if district: domain.append(('district', 'ilike', district)) if street: domain.append(('street', 'ilike', street)) return domain
def _consultar_cep(self, zip_code): zip_str = misc.punctuation_rm(zip_code) try: cep = pycep_correios.consultar_cep(zip_str) except Exception as e: raise UserError(_('Erro no PyCEP-Correios : ') + str(e)) values = {} if cep: # Search Brazil id country = self.env['res.country'].search([('code', '=', 'BR')], limit=1) # Search state with state_code and country id state = self.env['res.country.state'].search( [('code', '=', cep['uf']), ('country_id', '=', country.id)], limit=1) # search city with name and state city = self.env['res.city'].search( [('name', '=', cep['cidade']), ('state_id.id', '=', state.id)], limit=1) values = { 'zip_code': zip_str, 'street': cep['end'], 'zip_complement': cep['complemento2'], 'district': cep['bairro'], 'city_id': city.id or False, 'state_id': state.id or False, 'country_id': country.id or False, } return values
def _receiver(self, invoice, company, nfe_environment): super(NFe310, self)._receiver(invoice, company, nfe_environment) if invoice.partner_id.country_id.id != \ invoice.company_id.country_id.id: self.nfe.infNFe.dest.idEstrangeiro.valor = punctuation_rm( invoice.partner_id.cnpj_cpf)
def _check_cpf(self): for record in self: country_code = record.country_id.code or '' if record.cpf and country_code.upper() == 'BR': cpf = misc.punctuation_rm(record.cpf) if not fiscal.validate_cpf(cpf): raise ValidationError(_('CPF inválido!')) return True
def _check_cnpj(self): for record in self: country_code = record.country_id.code or '' if record.cnpj and country_code.upper() == 'BR': cnpj = misc.punctuation_rm(record.cnpj) if not fiscal.validate_cnpj(cnpj): raise ValidationError(_('CNPJ inválido!')) return True
def zip_search(self, obj): zip_str = misc.punctuation_rm(obj.zip) if len(zip_str) == 8: WebServiceClient(self).get_address(zip_str) return super(L10nBrZip, self).zip_search(obj)
def _in_out_adress(self, invoice): # # Endereço de Entrega ou Retirada # if invoice.partner_shipping_id: if invoice.partner_id.id != invoice.partner_shipping_id.id: if self.nfe.infNFe.ide.tpNF.valor == 0: self.nfe.infNFe.retirada.CNPJ.valor = punctuation_rm( invoice.partner_shipping_id.cnpj_cpf) self.nfe.infNFe.retirada.xLgr.valor = ( invoice.partner_shipping_id.street or '') self.nfe.infNFe.retirada.nro.valor = ( invoice.partner_shipping_id.number or '') self.nfe.infNFe.retirada.xCpl.valor = ( invoice.partner_shipping_id.street2 or '') self.nfe.infNFe.retirada.xBairro.valor = ( invoice.partner_shipping_id.district or 'Sem Bairro') self.nfe.infNFe.retirada.cMun.valor = '%s%s' % ( invoice.partner_shipping_id.state_id.ibge_code, invoice.partner_shipping_id.l10n_br_city_id.ibge_code) self.nfe.infNFe.retirada.xMun.valor = ( invoice.partner_shipping_id.l10n_br_city_id.name or '') self.nfe.infNFe.retirada.UF.valor = ( invoice.partner_shipping_id.state_id.code or '') else: self.nfe.infNFe.entrega.CNPJ.valor = punctuation_rm( invoice.partner_shipping_id.cnpj_cpf) self.nfe.infNFe.entrega.xLgr.valor = ( invoice.partner_shipping_id.street or '') self.nfe.infNFe.entrega.nro.valor = ( invoice.partner_shipping_id.number or '') self.nfe.infNFe.entrega.xCpl.valor = ( invoice.partner_shipping_id.street2 or '') self.nfe.infNFe.entrega.xBairro.valor = ( invoice.partner_shipping_id.district or 'Sem Bairro') self.nfe.infNFe.entrega.cMun.valor = '%s%s' % ( invoice.partner_shipping_id.state_id.ibge_code, invoice.partner_shipping_id.l10n_br_city_id.ibge_code) self.nfe.infNFe.entrega.xMun.valor = ( invoice.partner_shipping_id.l10n_br_city_id.name or '') self.nfe.infNFe.entrega.UF.valor = ( invoice.partner_shipping_id.state_id.code or '')
def _carrier_data(self, invoice): """Dados da Transportadora e veiculo""" self.nfe.infNFe.transp.modFrete.valor = ( invoice.incoterm and invoice.incoterm.freight_responsibility or '9') if invoice.carrier_id: if invoice.carrier_id.partner_id.is_company: self.nfe.infNFe.transp.transporta.CNPJ.valor = \ punctuation_rm( invoice.carrier_id.partner_id.cnpj_cpf or '') else: self.nfe.infNFe.transp.transporta.CPF.valor = \ punctuation_rm( invoice.carrier_id.partner_id.cnpj_cpf or '') self.nfe.infNFe.transp.transporta.xNome.valor = ( invoice.carrier_id.partner_id.legal_name[:60] or '') self.nfe.infNFe.transp.transporta.IE.valor = punctuation_rm( invoice.carrier_id.partner_id.inscr_est) self.nfe.infNFe.transp.transporta.xEnder.valor = ( invoice.carrier_id.partner_id.street or '') self.nfe.infNFe.transp.transporta.xMun.valor = ( invoice.carrier_id.partner_id.l10n_br_city_id.name or '') self.nfe.infNFe.transp.transporta.UF.valor = ( invoice.carrier_id.partner_id.state_id.code or '') if invoice.vehicle_id: self.nfe.infNFe.transp.veicTransp.placa.valor = ( invoice.vehicle_id.plate or '') self.nfe.infNFe.transp.veicTransp.UF.valor = ( invoice.vehicle_id.plate.state_id.code or '') self.nfe.infNFe.transp.veicTransp.RNTC.valor = ( invoice.vehicle_id.rntc_code or '')
def _nfe_identification(self, invoice, company, nfe_environment): super(NFe310, self)._nfe_identification(invoice, company, nfe_environment) self.nfe.infNFe.ide.idDest.valor = ( invoice.fiscal_position_id.cfop_id.id_dest or '') self.nfe.infNFe.ide.indFinal.valor = invoice.ind_final or '' self.nfe.infNFe.ide.indPres.valor = invoice.ind_pres or '' self.nfe.infNFe.ide.dhEmi.valor = datetime.strptime( invoice.date_hour_invoice, '%Y-%m-%d %H:%M:%S') self.nfe.infNFe.ide.dhSaiEnt.valor = datetime.strptime( invoice.date_in_out, '%Y-%m-%d %H:%M:%S') self.aut_xml = self._get_AutXML() self.aut_xml.CNPJ.valor = punctuation_rm( invoice.company_id.accountant_cnpj_cpf) self.nfe.infNFe.autXML.append(self.aut_xml)
def _emmiter(self, invoice, company): """Emitente""" self.nfe.infNFe.emit.CNPJ.valor = punctuation_rm( invoice.company_id.partner_id.cnpj_cpf) self.nfe.infNFe.emit.xNome.valor = (normalize( 'NFKD', unicode(invoice.company_id.partner_id.legal_name[:60])).encode( 'ASCII', 'ignore')) self.nfe.infNFe.emit.xFant.valor = invoice.company_id.partner_id.name self.nfe.infNFe.emit.enderEmit.xLgr.valor = (normalize( 'NFKD', unicode(company.street or '')).encode('ASCII', 'ignore')) self.nfe.infNFe.emit.enderEmit.nro.valor = company.number or '' self.nfe.infNFe.emit.enderEmit.xCpl.valor = (normalize( 'NFKD', unicode(company.street2 or '')).encode('ASCII', 'ignore')) self.nfe.infNFe.emit.enderEmit.xBairro.valor = (normalize( 'NFKD', unicode(company.district or 'Sem Bairro')).encode('ASCII', 'ignore')) self.nfe.infNFe.emit.enderEmit.cMun.valor = '%s%s' % ( company.state_id.ibge_code, company.l10n_br_city_id.ibge_code) self.nfe.infNFe.emit.enderEmit.xMun.valor = (normalize( 'NFKD', unicode(company.l10n_br_city_id.name or '')).encode('ASCII', 'ignore')) self.nfe.infNFe.emit.enderEmit.UF.valor = company.state_id.code or '' self.nfe.infNFe.emit.enderEmit.CEP.valor = punctuation_rm(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 self.nfe.infNFe.emit.enderEmit.fone.valor = punctuation_rm( str(company.phone or '').replace(' ', '')) self.nfe.infNFe.emit.IE.valor = punctuation_rm( invoice.company_id.partner_id.inscr_est) for inscr_est_line in\ invoice.company_id.partner_id.other_inscr_est_lines: if inscr_est_line.state_id.id == invoice.partner_id.state_id.id: self.nfe.infNFe.emit.IEST.valor = punctuation_rm( inscr_est_line.inscr_est) else: self.nfe.infNFe.emit.IEST.valor = '' self.nfe.infNFe.emit.IM.valor = punctuation_rm( invoice.company_id.partner_id.inscr_mun or '') self.nfe.infNFe.emit.CRT.valor = invoice.company_id.fiscal_type or '' if invoice.company_id.partner_id.inscr_mun: self.nfe.infNFe.emit.CNAE.valor = punctuation_rm( invoice.company_id.cnae_main_id.code or '')
def _details(self, invoice, invoice_line, index): """Detalhe""" self.det.nItem.valor = index if invoice_line.product_id: self.det.prod.cProd.valor = invoice_line.product_id.code or '' self.det.prod.cEAN.valor =\ invoice_line.product_id.barcode or 'SEM GTIN' self.det.prod.cEANTrib.valor =\ invoice_line.product_id.barcode or '' self.det.prod.xProd.valor = (normalize( 'NFKD', unicode(invoice_line.product_id.name[:120] or '')).encode('ASCII', 'ignore')) else: self.det.prod.cProd.valor = invoice_line.code or '' self.det.prod.xProd.valor = (normalize( 'NFKD', unicode(invoice_line.name[:120] or '')).encode('ASCII', 'ignore')) self.det.prod.NCM.valor = punctuation_rm( invoice_line.fiscal_classification_id.code or '')[:8] self.det.prod.EXTIPI.valor = punctuation_rm( invoice_line.fiscal_classification_id.code or '')[8:] self.det.prod.CEST.valor = punctuation_rm(invoice_line.cest_id.code or '') self.det.prod.nFCI.valor = invoice_line.fci or '' self.det.prod.CFOP.valor = invoice_line.cfop_id.code self.det.prod.uCom.valor = invoice_line.uom_id.name or '' self.det.prod.qCom.valor = str("%.4f" % invoice_line.quantity) self.det.prod.vUnCom.valor = str("%.7f" % invoice_line.price_unit) self.det.prod.vProd.valor = str("%.2f" % invoice_line.price_gross) self.det.prod.uTrib.valor = self.det.prod.uCom.valor self.det.prod.qTrib.valor = self.det.prod.qCom.valor self.det.prod.vUnTrib.valor = self.det.prod.vUnCom.valor self.det.prod.vFrete.valor = str("%.2f" % invoice_line.freight_value) self.det.prod.vSeg.valor = str("%.2f" % invoice_line.insurance_value) 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.partner_order or '' self.det.prod.nItemPed.valor = invoice_line.partner_order_line or '' self.det.infAdProd.valor = invoice_line.fiscal_comment or '' # # Produto entra no total da NF-e # self.det.prod.indTot.valor = 1 if invoice_line.product_type == 'product': # ICMS if invoice_line.icms_cst_id.code > 100: self.det.imposto.ICMS.CSOSN.valor = ( invoice_line.icms_cst_id.code) self.det.imposto.ICMS.pCredSN.valor = str( "%.2f" % invoice_line.icms_percent) self.det.imposto.ICMS.vCredICMSSN.valor = str( "%.2f" % invoice_line.icms_value) self.det.imposto.ICMS.orig.valor = invoice_line.icms_origin or '' self.det.imposto.ICMS.CST.valor = invoice_line.icms_cst_id.code self.det.imposto.ICMS.modBC.valor = invoice_line.icms_base_type self.det.imposto.ICMS.vBC.valor = str("%.2f" % invoice_line.icms_base) self.det.imposto.ICMS.pRedBC.valor = str( "%.2f" % invoice_line.icms_percent_reduction) self.det.imposto.ICMS.pICMS.valor = str("%.2f" % invoice_line.icms_percent) self.det.imposto.ICMS.vICMS.valor = str("%.2f" % invoice_line.icms_value) self.det.imposto.ICMS.motDesICMS.valor = ( invoice_line.icms_relief_id.code or '') # ICMS ST self.det.imposto.ICMS.modBCST.valor = ( invoice_line.icms_st_base_type) self.det.imposto.ICMS.pMVAST.valor = str("%.2f" % invoice_line.icms_st_mva) self.det.imposto.ICMS.pRedBCST.valor = str( "%.2f" % invoice_line.icms_st_percent_reduction) self.det.imposto.ICMS.vBCST.valor = str("%.2f" % invoice_line.icms_st_base) self.det.imposto.ICMS.pICMSST.valor = str( "%.2f" % invoice_line.icms_st_percent) self.det.imposto.ICMS.vICMSST.valor = str( "%.2f" % invoice_line.icms_st_value) # Informação do ICMS Interestadual nas vendas para consumidor final self.det.imposto.ICMSUFDest.vBCUFDest.valor = str( "%.2f" % invoice_line.icms_dest_base) self.det.imposto.ICMSUFDest.pFCPUFDest.valor = str( "%.2f" % invoice_line.icms_fcp_percent) self.det.imposto.ICMSUFDest.pICMSUFDest.valor = str( "%.2f" % invoice_line.icms_dest_percent) self.det.imposto.ICMSUFDest.pICMSInter.valor = str( "%.2f" % invoice_line.icms_origin_percent) self.det.imposto.ICMSUFDest.pICMSInterPart.valor = str( "%.2f" % invoice_line.icms_part_percent) self.det.imposto.ICMSUFDest.vFCPUFDest.valor = str( "%.2f" % invoice_line.icms_fcp_value) self.det.imposto.ICMSUFDest.vICMSUFDest.valor = str( "%.2f" % invoice_line.icms_dest_value) self.det.imposto.ICMSUFDest.vICMSUFRemet.valor = str( "%.2f" % invoice_line.icms_origin_value) # IPI self.det.imposto.IPI.CST.valor = invoice_line.ipi_cst_id.code if invoice_line.ipi_type == 'percent' or '': self.det.imposto.IPI.vBC.valor = str("%.2f" % invoice_line.ipi_base) self.det.imposto.IPI.pIPI.valor = str("%.2f" % invoice_line.ipi_percent) if invoice_line.ipi_type == 'quantity': pesol = 0 if invoice_line.product_id: pesol = invoice_line.product_id.weight_net self.det.imposto.IPI.qUnid.valor = str( "%.2f" % invoice_line.quantity * pesol) self.det.imposto.IPI.vUnid.valor = str( "%.2f" % invoice_line.ipi_percent) self.det.imposto.IPI.vIPI.valor = str("%.2f" % invoice_line.ipi_value) self.det.imposto.IPI.cEnq.valor = str( invoice_line.ipi_guideline_id.code or '999').zfill(3) else: # ISSQN self.det.imposto.ISSQN.vBC.valor = str("%.2f" % invoice_line.issqn_base) self.det.imposto.ISSQN.vAliq.valor = str( "%.2f" % invoice_line.issqn_percent) self.det.imposto.ISSQN.vISSQN.valor = str("%.2f" % invoice_line.issqn_value) self.det.imposto.ISSQN.cMunFG.valor = ( '%s%s') % (invoice.partner_id.state_id.ibge_code, invoice.partner_id.l10n_br_city_id.ibge_code) self.det.imposto.ISSQN.cListServ.valor = punctuation_rm( invoice_line.service_type_id.code or '') self.det.imposto.ISSQN.cSitTrib.valor = invoice_line.issqn_type # PIS self.det.imposto.PIS.CST.valor = invoice_line.pis_cst_id.code self.det.imposto.PIS.vBC.valor = str("%.2f" % invoice_line.pis_base) self.det.imposto.PIS.pPIS.valor = str("%.2f" % invoice_line.pis_percent) self.det.imposto.PIS.vPIS.valor = str("%.2f" % invoice_line.pis_value) # PISST self.det.imposto.PISST.vBC.valor = str("%.2f" % invoice_line.pis_st_base) self.det.imposto.PISST.pPIS.valor = str("%.2f" % invoice_line.pis_st_percent) self.det.imposto.PISST.qBCProd.valor = '' self.det.imposto.PISST.vAliqProd.valor = '' self.det.imposto.PISST.vPIS.valor = str("%.2f" % invoice_line.pis_st_value) # COFINS self.det.imposto.COFINS.CST.valor = invoice_line.cofins_cst_id.code self.det.imposto.COFINS.vBC.valor = str("%.2f" % invoice_line.cofins_base) self.det.imposto.COFINS.pCOFINS.valor = str( "%.2f" % invoice_line.cofins_percent) self.det.imposto.COFINS.vCOFINS.valor = str("%.2f" % invoice_line.cofins_value) # COFINSST self.det.imposto.COFINSST.vBC.valor = str("%.2f" % invoice_line.cofins_st_base) self.det.imposto.COFINSST.pCOFINS.valor = str( "%.2f" % invoice_line.cofins_st_percent) self.det.imposto.COFINSST.qBCProd.valor = '' self.det.imposto.COFINSST.vAliqProd.valor = '' self.det.imposto.COFINSST.vCOFINS.valor = str( "%.2f" % invoice_line.cofins_st_value) # II self.det.imposto.II.vBC.valor = str("%.2f" % invoice_line.ii_base) self.det.imposto.II.vDespAdu.valor = str( "%.2f" % invoice_line.ii_customhouse_charges) self.det.imposto.II.vII.valor = str("%.2f" % invoice_line.ii_value) self.det.imposto.II.vIOF.valor = str("%.2f" % invoice_line.ii_iof) self.det.imposto.vTotTrib.valor = str("%.2f" % invoice_line.total_taxes)
def _receiver(self, invoice, company, nfe_environment): """Destinatário""" partner_bc_code = '' address_invoice_state_code = '' address_invoice_city = '' partner_cep = '' if invoice.partner_id.country_id.bc_code: partner_bc_code = invoice.partner_id.country_id.bc_code[1:] if invoice.partner_id.country_id.id != \ invoice.company_id.country_id.id: address_invoice_state_code = 'EX' address_invoice_city = 'Exterior' address_invoice_city_code = '9999999' else: address_invoice_state_code = invoice.partner_id.state_id.code address_invoice_city = (normalize( 'NFKD', unicode(invoice.partner_id.l10n_br_city_id.name or '')).encode('ASCII', 'ignore')) address_invoice_city_code = ( '%s%s') % (invoice.partner_id.state_id.ibge_code, invoice.partner_id.l10n_br_city_id.ibge_code) partner_cep = punctuation_rm(invoice.partner_id.zip) # Se o ambiente for de teste deve ser # escrito na razão do destinatário if nfe_environment == 2: self.nfe.infNFe.dest.xNome.valor = ( 'NF-E EMITIDA EM AMBIENTE DE HOMOLOGACAO - SEM VALOR FISCAL') self.nfe.infNFe.dest.CNPJ.valor = '99999999000191' else: self.nfe.infNFe.dest.xNome.valor = (normalize( 'NFKD', unicode(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.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 self.nfe.infNFe.dest.enderDest.xLgr.valor = (normalize( 'NFKD', unicode(invoice.partner_id.street or '')).encode('ASCII', 'ignore')) self.nfe.infNFe.dest.enderDest.nro.valor = (invoice.partner_id.number or '') self.nfe.infNFe.dest.enderDest.xCpl.valor = (normalize( 'NFKD', unicode(invoice.partner_id.street2 or '')).encode('ASCII', 'ignore')) self.nfe.infNFe.dest.enderDest.xBairro.valor = (normalize( 'NFKD', unicode(invoice.partner_id.district or 'Sem Bairro')).encode('ASCII', 'ignore')) self.nfe.infNFe.dest.enderDest.cMun.valor = address_invoice_city_code self.nfe.infNFe.dest.enderDest.xMun.valor = address_invoice_city self.nfe.infNFe.dest.enderDest.UF.valor = address_invoice_state_code self.nfe.infNFe.dest.enderDest.CEP.valor = partner_cep self.nfe.infNFe.dest.enderDest.cPais.valor = partner_bc_code self.nfe.infNFe.dest.enderDest.xPais.valor = ( invoice.partner_id.country_id.name or '') self.nfe.infNFe.dest.enderDest.fone.valor = punctuation_rm( invoice.partner_id.phone or '').replace(' ', '') self.nfe.infNFe.dest.email.valor = invoice.partner_id.email or ''