Skip to content

Commit

Permalink
FIX (#1)
Browse files Browse the repository at this point in the history
File "/home/elbati/workspace/odoo/instances/odoo11/parts/l10n-italy/l10n_it_split_payment/models/account.py", line 105, in action_move_create
    self._compute_split_payments()
  File "/home/elbati/workspace/odoo/instances/odoo11/parts/l10n-italy/l10n_it_split_payment/models/account.py", line 80, in _compute_split_payments
    ) / inv_total
ZeroDivisionError: float division by zero
  • Loading branch information
eLBati authored and Borruso committed Sep 7, 2023
1 parent f2271ba commit 507153f
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions l10n_it_split_payment/models/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,23 @@ def _compute_split_payments(self):
for receivable_line in move_line_pool.browse(receivable_line_ids):
inv_total = invoice.amount_sp + invoice.amount_total
if invoice.type == 'out_invoice':
receivable_line_amount = (
invoice.amount_total * receivable_line.debit
) / inv_total
if inv_total:
receivable_line_amount = (
invoice.amount_total * receivable_line.debit
) / inv_total
else:
receivable_line_amount = 0
receivable_line.with_context(
check_move_validity=False
).write(
{'debit': receivable_line_amount})
elif invoice.type == 'out_refund':
receivable_line_amount = (
invoice.amount_total * receivable_line.credit
) / inv_total
if inv_total:
receivable_line_amount = (
invoice.amount_total * receivable_line.credit
) / inv_total
else:
receivable_line_amount = 0
receivable_line.with_context(
check_move_validity=False
).write(
Expand Down

0 comments on commit 507153f

Please sign in to comment.