[FIX] account: Fix matching rules reconciliation when dealing with negative amounts
match_total_amount_param on account.reconciliation.model is not respected when paying a vendor bill through bank statement because the amounts from both the statement line and the move line that are used in the comparison will be negative. closes odoo/odoo#44234 X-original-commit: 1a9221584f78fc7619277c2c0e9b9659e7c80ee2 Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
This commit is contained in:
committed by
Laurent Smet
parent
be5e86f464
commit
1e5eca501f
@@ -657,10 +657,13 @@ class AccountReconcileModel(models.Model):
|
||||
if float_is_zero(total_residual - line_residual, precision_rounding=line_currency.rounding):
|
||||
return True
|
||||
|
||||
if line_residual > total_residual:
|
||||
amount_percentage = (total_residual / line_residual) * 100
|
||||
line_residual_to_compare = line_residual if line_residual > 0.0 else -line_residual
|
||||
total_residual_to_compare = total_residual if line_residual > 0.0 else -total_residual
|
||||
|
||||
if line_residual_to_compare > total_residual_to_compare:
|
||||
amount_percentage = (total_residual_to_compare / line_residual_to_compare) * 100
|
||||
elif total_residual:
|
||||
amount_percentage = (line_residual / total_residual) * 100 if total_residual else 0
|
||||
amount_percentage = (line_residual_to_compare / total_residual_to_compare) * 100 if total_residual_to_compare else 0.0
|
||||
else:
|
||||
return False
|
||||
return amount_percentage >= self.match_total_amount_param
|
||||
|
||||
Reference in New Issue
Block a user