def setDatiRiepilogo(self, invoice, body): for tax_line in invoice.tax_line_ids: tax = tax_line.tax_id riepilogo = DatiRiepilogoType(AliquotaIVA='%.2f' % tax.amount, ImponibileImporto='%.2f' % tax_line.base, Imposta='%.2f' % tax_line.amount) if tax.amount == 0.0: if not tax.kind_id: raise UserError( _("No 'nature' field for tax %s.") % tax.name) riepilogo.Natura = tax.kind_id.code if not tax.law_reference: raise UserError( _("No 'law reference' field for tax %s.") % tax.name) riepilogo.RiferimentoNormativo = tax.law_reference.encode( 'latin', 'ignore').decode('latin') if tax.payability: riepilogo.EsigibilitaIVA = tax.payability # TODO # el.remove(el.find('SpeseAccessorie')) # el.remove(el.find('Arrotondamento')) body.DatiBeniServizi.DatiRiepilogo.append(riepilogo) return True
def setDatiRiepilogo(self, invoice, body): if not invoice.tax_line_ids: raise UserError( _("Invoice {invoice} has no tax lines").format( invoice=invoice.display_name)) for tax_line in invoice.tax_line_ids: tax = tax_line.tax_id riepilogo = DatiRiepilogoType( AliquotaIVA='%.2f' % float_round(tax.amount, 2), ImponibileImporto='%.2f' % float_round(tax_line.base, 2), Imposta='%.2f' % float_round(tax_line.amount, 2)) if tax.amount == 0.0: if not tax.kind_id: raise UserError( _("No 'nature' field for tax %s.") % tax.name) riepilogo.Natura = tax.kind_id.code if not tax.law_reference: raise UserError( _("No 'law reference' field for tax %s.") % tax.name) riepilogo.RiferimentoNormativo = encode_for_export( tax.law_reference, 100) if tax.payability: riepilogo.EsigibilitaIVA = tax.payability # TODO # el.remove(el.find('SpeseAccessorie')) # el.remove(el.find('Arrotondamento')) body.DatiBeniServizi.DatiRiepilogo.append(riepilogo) return True
def setDatiRiepilogo(self, invoice, body): res = super(WizardExportFatturapa, self).setDatiRiepilogo( invoice, body) wt_lines_to_write = invoice.withholding_tax_line_ids.filtered( lambda x: x.withholding_tax_id.wt_types not in ('ritenuta', 'other') and x.withholding_tax_id.use_daticassaprev ) for wt_line in wt_lines_to_write: tax_id = wt_line.withholding_tax_id.daticassprev_tax_id tax_riepilogo = self.get_tax_riepilogo(body, tax_id) if tax_riepilogo: base_amount = float(tax_riepilogo.ImponibileImporto) base_amount += wt_line.tax tax_riepilogo.ImponibileImporto = '%.2f' % float_round( base_amount, 2) else: riepilogo = DatiRiepilogoType( AliquotaIVA='0.00', ImponibileImporto='%.2f' % float_round(wt_line.tax, 2), Imposta='0.00', Natura=tax_id.kind_id.code, RiferimentoNormativo=tax_id.law_reference, ) body.DatiBeniServizi.DatiRiepilogo.append(riepilogo) return res
def setDatiRiepilogo(self, invoice, body): super().setDatiRiepilogo(invoice, body) force_dichiarazione_intento_ids = invoice.dichiarazione_intento_ids.browse( ) for line in invoice.invoice_line_ids: if line.force_dichiarazione_intento_id: force_dichiarazione_intento_ids |= line.force_dichiarazione_intento_id to_add = invoice.dichiarazione_intento_ids - force_dichiarazione_intento_ids if not to_add: return riepilogo = DatiRiepilogoType( AliquotaIVA="0.00", ImponibileImporto="0.00", Imposta="0.00", Natura="N1", RiferimentoNormativo="Esclusa ex. Art. 15", ) body.DatiBeniServizi.DatiRiepilogo.append(riepilogo)
def setDatiRiepilogo(self, invoice, body): res = super(WizardExportFatturapa, self).setDatiRiepilogo(invoice, body) enasarco_lines_to_write = invoice.withholding_tax_line_ids.filtered( lambda x: x.withholding_tax_id.wt_types == 'enasarco' and x. withholding_tax_id.use_daticassaprev_for_enasarco) if enasarco_lines_to_write: n2_riepilogo = self.get_n2_tax_riepilogo(body) enasarco_base = sum(enasarco_lines_to_write.mapped('tax')) if n2_riepilogo: base_amount = float(n2_riepilogo.ImponibileImporto) base_amount += enasarco_base n2_riepilogo.ImponibileImporto = '%.2f' % base_amount else: riepilogo = DatiRiepilogoType( AliquotaIVA='0.00', ImponibileImporto='%.2f' % enasarco_base, Imposta='0.00', Natura='N2', RiferimentoNormativo='Escluso Art. 13 5C DPR 633/72', ) body.DatiBeniServizi.DatiRiepilogo.append(riepilogo) return res