Merci @Francois pour ce retour.
Je n’arrive toujours pas à trouver la cause de ce message d’erreur. J’ai encore besoin de votre aide svp.
Voici le code (Rhino) de l’action :
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ImmoAccountingFinancial.reglerPartielLigne = function() {
try {
if (this.getFieldValue("accountingFiRapproFlag") == '0' ||this.getFieldValue("accountingFiRapproFlag") == '2' ) {// non rapproché ou rapproché partiellement
console.log("Règlement partiel de la ligne = " + this.getRowId() + " / Montant = " + this.getFieldValue("accountingFiRglPartiel"));
var today = Tool.getCurrentDate();
var anneeComptable = Tool.getYear(today);
// On copie la même ligne à l’exception du libellé « REGLEMENT PARTIEL », du montant partiel et de la date comptable (date du jour).
var o1 = this.getGrant().getObject("reglerPartielLigne","ImmoAccountingFinancial");
o1.setRowId(ObjectField.DEFAULT_ROW_ID);
o1.resetValues(true);
o1.setFieldValue("accountingFiMvtType", this.getFieldValue("accountingFiMvtType"));
o1.setFieldValue("accountingFiYear",anneeComptable); // On prend l'année de la date du jour
o1.setFieldValue("accountingFiDateAcc",today); // On met la date du jour pour la date comptable
o1.setFieldValue("accountingFiAmountC", this.getFieldValue("accountingFiRglPartiel")); // On prend la valeur du paiement partiel
o1.setFieldValue("accountingFiDatePrevi", this.getFieldValue("accountingFiDatePrevi"));
o1.setFieldValue("accountingFiCurrency", this.getFieldValue("accountingFiCurrency"));
o1.setFieldValue("accountingFiCurrencyAcc", this.getFieldValue("accountingFiCurrencyAcc"));
o1.setFieldValue("accountingFiImmoPropertyId", this.getFieldValue("accountingFiImmoPropertyId"));
o1.setFieldValue("accountingFiImmoInvestorId", this.getFieldValue("accountingFiImmoInvestorId"));
o1.setFieldValue("accountingFiImmoCompanyId", this.getFieldValue("accountingFiImmoCompanyId"));
o1.setFieldValue("accountingFiLabel","REGLEMENT PARTIEL : " + this.getFieldValue("accountingFiLabel")); // On ajoute " REGLEMENT PARTIEL : "
o1.setFieldValue("accountingFiAmountD", 0); // On met à 0 le D ( c'est un règelemnt partiel et non pas total)
o1.setFieldValue("accountingFiImmoThirdPartyId", this.getFieldValue("accountingFiImmoThirdPartyId"));
o1.setFieldValue("accountingFiImmoLeaseId", this.getFieldValue("accountingFiImmoLeaseId"));
o1.setFieldValue("accountingFiRapproType", this.getFieldValue("accountingFiRapproType"));
o1.setFieldValue("accountingFiRapproFlag", '2'); // Témoin de rapprochement : Rapprochement partiel
o1.setFieldValue("accountingFiImmoBankAccountId", this.getFieldValue("accountingFiImmoBankAccountId"));
o1.setFieldValue("accountingFiImmoNatPersonId", this.getFieldValue("accountingFiImmoNatPersonId"));
o1.setFieldValue("accountingFiImmoLegEntityId", this.getFieldValue("accountingFiImmoLegEntityId"));
o1.setFieldValue("accountingFiTenantName", this.getFieldValue("accountingFiTenantName"));
o1.setFieldValue("accountingFiGeneralAcc", this.getFieldValue("accountingFiGeneralAcc"));
o1.setFieldValue("accountingFiImmoGenAccountId", this.getFieldValue("accountingFiImmoGenAccountId"));
o1.setFieldValue("accountingFiPieceNbr", this.getFieldValue("accountingFiPieceNbr"));
o1.setFieldValue("accountingFiRglPartiel", 0);
new BusinessObjectTool(o1).validateAndSave();
// On met à "Rapproché" la ligne source aussi :
this.setFieldValue("accountingFiRapproFlag", '2'); // Témoin de rapprochement : Rapprochement partiel
this.setFieldValue("accountingFiRglPartiel", 0); // on remet à vide le montant de règlement partiel.
new BusinessObjectTool(this).validateAndSave();
}
} catch (e) {
console.error("ImmoAccountingFinancial.reglerPartielLigne : "+ (e.javaException ? e.javaException.getMessage() : e));
return e.javaException ? e.javaException.getMessage() : e;
}
return '';
};
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Le principe est de dupliquer la ligne en changeant qq attributs, et ensuite, remettre à 0 le champ accountingFiRglPartiel afin de masquer le bouton d’action.
C’est cette valorisation de l’attribut “accountingFiRglPartiel” qui pose pb, car quand je la mets en commentaire, l’action se termine normalement, mais le bouton d’action reste bien sûr affiché.
Voici la contrainte :
Voici l’action :
Je n’ai pas de isActionEnable dans cet objet. Quels seraient les autres endroits où un droit peut être retiré ?
Merci d’avance.