IDEMPIERE-3443 Payment Schedule leading to -> Current record was changed by another user, please ReQuery

This commit is contained in:
Carlos Ruiz 2017-08-03 14:05:44 +02:00
parent d0b5697dc6
commit c663b563b4
6 changed files with 60 additions and 2 deletions

View File

@ -0,0 +1,15 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-3443
-- Aug 3, 2017 2:01:39 PM CEST
UPDATE AD_Column SET Callout=NULL,Updated=TO_DATE('2017-08-03 14:01:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2187
;
-- Aug 3, 2017 2:02:05 PM CEST
UPDATE AD_Column SET Callout=NULL,Updated=TO_DATE('2017-08-03 14:02:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3500
;
SELECT register_migration_script('201708031402_IDEMPIERE-3443.sql') FROM dual
;

View File

@ -0,0 +1,12 @@
-- IDEMPIERE-3443
-- Aug 3, 2017 2:01:39 PM CEST
UPDATE AD_Column SET Callout=NULL,Updated=TO_TIMESTAMP('2017-08-03 14:01:39','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=2187
;
-- Aug 3, 2017 2:02:05 PM CEST
UPDATE AD_Column SET Callout=NULL,Updated=TO_TIMESTAMP('2017-08-03 14:02:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=3500
;
SELECT register_migration_script('201708031402_IDEMPIERE-3443.sql') FROM dual
;

View File

@ -275,7 +275,9 @@ public class CalloutInvoice extends CalloutEngine
* @param mField field * @param mField field
* @param value value * @param value value
* @return null or error message * @return null or error message
* @Deprecated - business logic moved to MInvoice.beforeSave - must not create/delete external records with callouts
*/ */
@Deprecated
public String paymentTerm (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value) public String paymentTerm (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{ {
Integer C_PaymentTerm_ID = (Integer)value; Integer C_PaymentTerm_ID = (Integer)value;
@ -290,7 +292,6 @@ public class CalloutInvoice extends CalloutEngine
boolean valid = pt.apply (C_Invoice_ID); boolean valid = pt.apply (C_Invoice_ID);
mTab.setValue("IsPayScheduleValid", valid ? "Y" : "N"); mTab.setValue("IsPayScheduleValid", valid ? "Y" : "N");
return ""; return "";
} // paymentTerm } // paymentTerm

View File

@ -745,7 +745,9 @@ public class CalloutOrder extends CalloutEngine
* @param mField field * @param mField field
* @param value value * @param value value
* @return null or error message * @return null or error message
* @Deprecated - business logic moved to MOrder.beforeSave - must not create/delete external records with callouts
*/ */
@Deprecated
public String paymentTerm (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value) public String paymentTerm (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{ {
Integer C_PaymentTerm_ID = (Integer)value; Integer C_PaymentTerm_ID = (Integer)value;

View File

@ -927,6 +927,7 @@ public class MInvoice extends X_C_Invoice implements DocAction
} // validatePaySchedule } // validatePaySchedule
private volatile static boolean recursiveCall = false;
/************************************************************************** /**************************************************************************
* Before Save * Before Save
* @param newRecord new * @param newRecord new
@ -1028,6 +1029,19 @@ public class MInvoice extends X_C_Invoice implements DocAction
} }
} }
if (! recursiveCall && (newRecord || is_ValueChanged(COLUMNNAME_C_PaymentTerm_ID))) {
recursiveCall = true;
try {
MPaymentTerm pt = new MPaymentTerm (getCtx(), getC_PaymentTerm_ID(), get_TrxName());
boolean valid = pt.apply(this);
setIsPayScheduleValid(valid);
} catch (Exception e) {
throw e;
} finally {
recursiveCall = false;
}
}
return true; return true;
} // beforeSave } // beforeSave

View File

@ -71,7 +71,7 @@ public class MOrder extends X_C_Order implements DocAction
/** /**
* *
*/ */
private static final long serialVersionUID = -4032643956656204341L; private static final long serialVersionUID = -7784588474522162502L;
/** /**
* Create new Order by copying * Create new Order by copying
@ -921,6 +921,7 @@ public class MOrder extends X_C_Order implements DocAction
} // validatePaySchedule } // validatePaySchedule
private volatile static boolean recursiveCall = false;
/************************************************************************** /**************************************************************************
* Before Save * Before Save
* @param newRecord new * @param newRecord new
@ -1089,6 +1090,19 @@ public class MOrder extends X_C_Order implements DocAction
} }
} }
if (! recursiveCall && (newRecord || is_ValueChanged(COLUMNNAME_C_PaymentTerm_ID))) {
recursiveCall = true;
try {
MPaymentTerm pt = new MPaymentTerm (getCtx(), getC_PaymentTerm_ID(), get_TrxName());
boolean valid = pt.applyOrder(this);
setIsPayScheduleValid(valid);
} catch (Exception e) {
throw e;
} finally {
recursiveCall = false;
}
}
return true; return true;
} // beforeSave } // beforeSave