Skip to content

Commit

Permalink
[14.0][IMP] l10n_it_fatturapa_out_rc: make template data overridable
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMule71 committed Jul 15, 2022
1 parent ecda656 commit 4aa0479
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 33 deletions.
11 changes: 0 additions & 11 deletions l10n_it_fatturapa_out_rc/views/invoice_it_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,6 @@
t-esc="record.fiscal_document_type_id.code"
/>
</xpath>
<xpath expr="//DettaglioPagamento/ImportoPagamento" position="replace" />
<xpath expr="//DettaglioPagamento/ImportoPagamento" position="replace">
<ImportoPagamento
t-if="record.company_id.xml_divisa_value == 'keep_orig'"
t-esc="format_numbers_two(get_sign(record) * (move_line.amount_currency or move_line.debit))"
/>
<ImportoPagamento
t-if="not record.company_id.xml_divisa_value == 'keep_orig'"
t-esc="format_numbers_two(fpa_to_eur(get_sign(record) * (move_line.amount_currency or move_line.debit), record))"
/>
</xpath>
<xpath expr="//DatiRiepilogo/ImponibileImporto" position="replace">
<ImponibileImporto
t-esc="format_monetary(fpa_to_eur(get_sign(record) * tax_data['ImponibileImporto'], record), euro)"
Expand Down
1 change: 0 additions & 1 deletion l10n_it_fatturapa_out_rc/wizard/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
from . import efattura
from . import wizard_export_fatturapa
15 changes: 0 additions & 15 deletions l10n_it_fatturapa_out_rc/wizard/efattura.py

This file was deleted.

22 changes: 16 additions & 6 deletions l10n_it_fatturapa_out_rc/wizard/wizard_export_fatturapa.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
# Copyright 2021 Alex Comba - Agile Business Group
# Copyright 2022 Marco Colombo - Phi srl - <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import api, models

from .efattura import EFatturaOut


class WizardExportFatturapa(models.TransientModel):
_inherit = "wizard.export.fatturapa"

@api.model
def _get_efattura_class(self):
return EFatturaOut

@api.model
def getSign(self, invoice):
sign = 1
Expand All @@ -23,6 +18,21 @@ def getSign(self, invoice):
sign = -1
return sign

@api.model
def getTemplateValues(self, template_values):
template_values = super().getTemplateValues(template_values)
template_values.update({"get_sign": self.getSign})
return template_values

@api.model
def getPayments(self, invoice):
payments = super().getPayments(invoice)
sign = self.getSign(invoice)
for payment in payments:
payment.amount_currency *= sign
payment.debit *= sign
return payments

@api.model
def getImportoTotale(self, invoice):
amount_total = super().getImportoTotale(invoice)
Expand Down

0 comments on commit 4aa0479

Please sign in to comment.