Skip to content

Commit 7165ab1

Browse files
sergiocoratoTheMule71
authored andcommitted
[12.0][IMP] importo bollo non più obbligatorio e-invoice 1.6 (OCA#1866)
1 parent 11ff57b commit 7165ab1

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
* Lorenzo Battistini <https://github.com/eLBati>
2+
* Sergio Corato <https://github.com/sergiocorato>
Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
from odoo import models
4-
from odoo.tools.translate import _
5-
from odoo.exceptions import UserError
6-
from odoo.tools.float_utils import float_round
4+
from odoo.tools.float_utils import float_round, float_is_zero
75
from odoo.addons.l10n_it_fatturapa.bindings.fatturapa import (
86
DatiBolloType
97
)
@@ -16,13 +14,11 @@ def setDatiGeneraliDocumento(self, invoice, body):
1614
res = super(WizardExportFatturapa, self).setDatiGeneraliDocumento(
1715
invoice, body)
1816
if invoice.tax_stamp:
19-
if not invoice.company_id.tax_stamp_product_id:
20-
raise UserError(_(
21-
"Tax Stamp Product not set for company %s"
22-
) % invoice.company_id.name)
23-
stamp_price = invoice.company_id.tax_stamp_product_id.list_price
2417
body.DatiGenerali.DatiGeneraliDocumento.DatiBollo = DatiBolloType(
25-
BolloVirtuale="SI",
26-
ImportoBollo='%.2f' % float_round(stamp_price, 2),
27-
)
18+
BolloVirtuale="SI")
19+
if invoice.company_id.tax_stamp_product_id:
20+
stamp_price = invoice.company_id.tax_stamp_product_id.list_price
21+
if not float_is_zero(stamp_price, precision_digits=2):
22+
body.DatiGenerali.DatiGeneraliDocumento.DatiBollo.ImportoBollo = \
23+
'%.2f' % float_round(stamp_price, 2)
2824
return res

0 commit comments

Comments
 (0)