Skip to content

Commit 045425f

Browse files
committed
[FIX] l10n_es_edi_tbai prevent ZeroDivisionError when invoice line quantity is zero
closes odoo#193500 Signed-off-by: Ruben Gomes (rugo) <[email protected]>
1 parent 53f94da commit 045425f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

addons/l10n_es_edi_tbai/models/account_edi_format.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ def _l10n_es_tbai_get_invoice_values(self, invoice, cancel):
369369
invoice_lines.append({
370370
'line': line,
371371
'discount': discount * refund_sign,
372-
'unit_price': (line.balance + discount) / line.quantity * refund_sign,
372+
'unit_price': (line.balance + discount) / line.quantity * refund_sign if line.quantity else 0.0,
373373
'total': total,
374374
'description': regex_sub(r'[^0-9a-zA-Z ]', '', line.name or '')[:250]
375375
})

0 commit comments

Comments
 (0)