Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions l10n_it_fatturapa_out_stamp/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* Lorenzo Battistini <https://github.com/eLBati>
* Sergio Corato <https://github.com/sergiocorato>
18 changes: 7 additions & 11 deletions l10n_it_fatturapa_out_stamp/wizard/wizard_export_fatturapa.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).

from odoo import models
from odoo.tools.translate import _
from odoo.exceptions import UserError
from odoo.tools.float_utils import float_round
from odoo.tools.float_utils import float_round, float_is_zero
from odoo.addons.l10n_it_fatturapa.bindings.fatturapa import (
DatiBolloType
)
Expand All @@ -17,13 +15,11 @@ def setDatiGeneraliDocumento(self, invoice, body):
res = super(WizardExportFatturapa, self).setDatiGeneraliDocumento(
invoice, body)
if invoice.tax_stamp:
if not invoice.company_id.tax_stamp_product_id:
raise UserError(_(
"Tax Stamp Product not set for company %s"
) % invoice.company_id.name)
stamp_price = invoice.company_id.tax_stamp_product_id.list_price
body.DatiGenerali.DatiGeneraliDocumento.DatiBollo = DatiBolloType(
BolloVirtuale="SI",
ImportoBollo='%.2f' % float_round(stamp_price, 2),
)
BolloVirtuale="SI")
if invoice.company_id.tax_stamp_product_id:
stamp_price = invoice.company_id.tax_stamp_product_id.list_price
if not float_is_zero(stamp_price, precision_digits=2):
body.DatiGenerali.DatiGeneraliDocumento.DatiBollo.ImportoBollo = \
'%.2f' % float_round(stamp_price, 2)
return res