Skip to content

96507 BankReconciliation : blocked the reconciliation of multiple lin… #14501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 18, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -332,4 +332,7 @@ private BankPaymentExceptionMessage() {}

public static final String BANK_RECONCILIATION_CREATING_MOVE_MISSING_JOURNAL = /*$$(*/
"Missing journal while creating a move from a bank reconciliation." /*)*/;

public static final String BANK_RECONCILIATION_MULTIPLE_MOVE_LINE_RECONCILIATION_ERROR = /*$$(*/
"The movelines %s are already reconciled with another bank statement line. Multiple bank statement lines can't be reconciled with the same move line." /*)*/;
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@
*/
package com.axelor.apps.bankpayment.service;

import com.axelor.apps.account.db.MoveLine;
import com.axelor.apps.bankpayment.db.BankReconciliation;
import com.axelor.apps.bankpayment.db.BankReconciliationLine;
import com.axelor.apps.base.db.Company;
import com.axelor.common.ObjectUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class BankReconciliationToolService {
Expand All @@ -33,4 +38,32 @@ public static boolean isForeignCurrency(BankReconciliation bankReconciliation) {
}
return false;
}

public static List<MoveLine> getMoveLineOnMultipleReconciliationLine(
BankReconciliation bankReconciliation) {
List<MoveLine> errorMoveLineList = new ArrayList<>();

if (bankReconciliation == null
|| ObjectUtils.isEmpty(bankReconciliation.getBankReconciliationLineList())) {
return errorMoveLineList;
}

List<MoveLine> moveLineList = new ArrayList<>();

for (BankReconciliationLine bankReconciliationLine :
bankReconciliation.getBankReconciliationLineList()) {
MoveLine moveLine = bankReconciliationLine.getMoveLine();
if (moveLine == null) {
continue;
}

if (moveLineList.contains(moveLine)) {
errorMoveLineList.add(moveLine);
} else {
moveLineList.add(moveLine);
}
}

return errorMoveLineList;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import com.axelor.apps.base.db.repo.TraceBackRepository;
import com.axelor.apps.base.service.BankDetailsService;
import com.axelor.apps.base.service.exception.TraceBackService;
import com.axelor.common.ObjectUtils;
import com.axelor.db.EntityHelper;
import com.axelor.i18n.I18n;
import com.axelor.inject.Beans;
Expand Down Expand Up @@ -556,4 +557,23 @@ public void computeSelections(ActionRequest request, ActionResponse response) {
TraceBackService.trace(response, e);
}
}

public void checkMultipleMoveLine(ActionRequest request, ActionResponse response) {
BankReconciliation bankReconciliation = request.getContext().asType(BankReconciliation.class);
List<MoveLine> moveLineList =
BankReconciliationToolService.getMoveLineOnMultipleReconciliationLine(bankReconciliation);
if (ObjectUtils.isEmpty(moveLineList)) {
return;
}

response.setError(
String.format(
I18n.get(
BankPaymentExceptionMessage
.BANK_RECONCILIATION_MULTIPLE_MOVE_LINE_RECONCILIATION_ERROR),
moveLineList.stream()
.map(MoveLine::getName)
.distinct()
.collect(Collectors.joining(","))));
}
}
1 change: 1 addition & 0 deletions axelor-bank-payment/src/main/resources/i18n/messages.csv
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@
"The company %s does not have bank order sequence",,,
"The field encryption.bankorder.password in config file must be filled.",,,
"The move %s can't be reversed because it is linked to a bank reconciliation with status validated",,,
"The movelines %s are already reconciled with another bank statement line. Multiple bank statement lines can't be reconciled with the same move line.",,,
"The moves %s couldn't be reversed because these are linked to a bank reconciliation with status validated",,,
"The password is incorrect.",,,
"The payment status will not update.",,,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@
"The company %s does not have bank order sequence",,,
"The field encryption.bankorder.password in config file must be filled.",,,
"The move %s can't be reversed because it is linked to a bank reconciliation with status validated",,,
"The movelines %s are already reconciled with another bank statement line. Multiple bank statement lines can't be reconciled with the same move line.",,,
"The moves %s couldn't be reversed because these are linked to a bank reconciliation with status validated",,,
"The password is incorrect.",,,
"The payment status will not update.",,,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@
"The company %s does not have bank order sequence","La société %s n'a pas de séquence d'ordre bancaire configurée",,
"The field encryption.bankorder.password in config file must be filled.","Le champ encryption.bankorder.password dans la configuration doit être rempli.",,
"The move %s can't be reversed because it is linked to a bank reconciliation with status validated","L'écriture %s ne peut être extournée car elle est liée à un rapprochement bancaire au statut validé",,
"The movelines %s are already reconciled with another bank statement line. Multiple bank statement lines can't be reconciled with the same move line.","Les lignes d'écriture %s pointent déjà vers une autre ligne de rapprochement bancaire. Il n'est pas possible de faire pointer plusieurs lignes de rapprochement bancaire vers une même ligne d'écriture.",,
"The moves %s couldn't be reversed because these are linked to a bank reconciliation with status validated","Les écritures %s ne peuvent être extournées car elle sont liées à un rapprochement bancaire au statut validé",,
"The password is incorrect.","Le mot de passe est incorrect.",,
"The payment status will not update.","Le statut du paiement ne sera pas mis à jour.",,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

<form name="bank-reconciliation-form" title="Bank reconciliation"
model="com.axelor.apps.bankpayment.db.BankReconciliation" width="large"
onNew="action-bank-reconciliation-onnew-group" onLoad="action-bank-reconciliation-onload-group">
onNew="action-bank-reconciliation-onnew-group" onLoad="action-bank-reconciliation-onload-group"
onSave="action-bank-reconciliation-method-check-multiple-move-line">
<panel name="mainPanel" colSpan="12">
<spacer colSpan="10"/>
<button name="correctBtn" title="Correct" hidden="true"
Expand Down Expand Up @@ -100,13 +101,13 @@
orderBy="effectDate" height="12"/>
<button name="autoReconcileBtn" title="Auto reconcile"
showIf="bankStatement &amp;&amp; bankReconciliationLineList.length > 0" colSpan="3"
onClick="action-bank-reconciliation-method-automatic-reconciliation"/>
onClick="action-bank-reconciliation-method-automatic-reconciliation,action-bank-reconciliation-method-check-multiple-move-line"/>
<button name="multipleReconcileBtn" title="Multiple reconciles" colSpan="3"
onClick="save,action-bank-reconciliation-validate-lines-selected,action-bank-reconciliation-view-multiple-reconcile-wizard"/>
<button name="unreconcileBtn" title="Unreconcile selected" colSpan="3"
onClick="save,action-bank-reconciliation-method-unreconcile"/>
<button name="reconcileBtn" title="Reconcile selected" colSpan="3"
onClick="save,action-bank-reconciliation-method-reconcile-selected"/>
onClick="action-group-bank-reconciliation-reconcile"/>
<spacer colSpan="1"/>
<label name="selectionBankReconciliationLinesLabel"
title="Selection total for bank reconciliation lines" css="label-bold" colSpan="3"/>
Expand Down Expand Up @@ -227,6 +228,7 @@
<action name="save"/>
<action name="action-bank-reconciliation-method-compute"/>
<action name="action-bank-reconciliation-check-incomplete-bankreconciliation-line"/>
<action name="action-bank-reconciliation-method-check-multiple-move-line"/>
<action name="action-bank-reconciliation-method-validate"/>
<action name="action-bank-reconciliation-method-compute-balances"/>
<action name="action-bank-reconciliation-method-set-bank-statement-is-fully-reconciled"/>
Expand All @@ -237,6 +239,12 @@
<action name="action-bank-reconciliation-method-compute"/>
</action-group>

<action-group name="action-group-bank-reconciliation-reconcile">
<action name="save"/>
<action name="action-bank-reconciliation-method-reconcile-selected"/>
<action name="action-bank-reconciliation-method-check-multiple-move-line"/>
</action-group>

<action-record model="com.axelor.apps.bankpayment.db.BankReconciliation"
name="action-bank-reconciliation-active-company">
<field name="company" expr="eval:__user__.activeCompany"
Expand Down Expand Up @@ -463,6 +471,11 @@
<call class="com.axelor.apps.bankpayment.web.BankReconciliationController" method="correct"/>
</action-method>

<action-method name="action-bank-reconciliation-method-check-multiple-move-line">
<call class="com.axelor.apps.bankpayment.web.BankReconciliationController"
method="checkMultipleMoveLine"/>
</action-method>

<search-filters name="bank-reconciliation-filters"
model="com.axelor.apps.bankpayment.db.BankReconciliation" title="Bank reconciliation filters">
<field name="company" hidden="true"
Expand Down
3 changes: 3 additions & 0 deletions changelogs/unreleased/96507.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
title: "Bank Reconciliation: blocked the reconciliation of multiple lines on a single move line."
module: axelor-bank-payment
Loading