hg merge release-6.2 (merge release6.2 into default)

This commit is contained in:
Carlos Ruiz 2019-07-27 11:47:28 +02:00
commit f7111b1097
9 changed files with 154 additions and 18 deletions

View File

@ -0,0 +1,46 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-918 - add C_Invoice.RelatedInvoice_ID
-- 07/25/2019 11:08:54
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203348,0,0,'Y',TO_DATE('2019-07-25 11:08:54','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2019-07-25 11:08:54','YYYY-MM-DD HH24:MI:SS'),0,'RelatedInvoice_ID','Related Invoice','Related Invoice','D','30673d40-aeaa-4d46-b9aa-fd2d41ab90f8')
;
-- 07/25/2019 11:10:03
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (213967,0,'Related Invoice',318,'RelatedInvoice_ID',10,'N','N','N','N','N',0,'N',30,336,0,0,'Y',TO_DATE('2019-07-25 11:10:03','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2019-07-25 11:10:03','YYYY-MM-DD HH24:MI:SS'),0,203348,'Y','N','D','N','N','N','Y','75158448-52e0-426b-a393-86141d86157e','N',0,'N','N','N','N')
;
-- 07/25/2019 11:10:08
UPDATE AD_Column SET FKConstraintName='RelatedInvoice_CInvoice', FKConstraintType='N',Updated=TO_DATE('2019-07-25 11:10:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=213967
;
-- 07/25/2019 11:10:08
ALTER TABLE C_Invoice ADD RelatedInvoice_ID NUMBER(10) DEFAULT NULL
;
-- 07/25/2019 11:10:08
ALTER TABLE C_Invoice ADD CONSTRAINT RelatedInvoice_CInvoice FOREIGN KEY (RelatedInvoice_ID) REFERENCES c_invoice(c_invoice_id) DEFERRABLE INITIALLY DEFERRED
;
-- 07/25/2019 11:10:35
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (206135,'Related Invoice',263,213967,'Y',10,460,'N','N','N','N',0,0,'Y',TO_DATE('2019-07-25 11:10:35','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2019-07-25 11:10:35','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','ecbcf980-4cfe-4937-b31a-9e18e7e5767e','Y',450,2)
;
-- 07/25/2019 11:10:44
UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-07-25 11:10:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=204733
;
-- 07/25/2019 11:11:21
UPDATE AD_Field SET DisplayLogic='@RelatedInvoice_ID@ > 0', IsReadOnly='Y', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-07-25 11:11:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206135
;
-- 07/25/2019 11:11:38
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (206136,'Related Invoice',290,213967,'Y',10,440,'N','N','N','N',0,0,'Y',TO_DATE('2019-07-25 11:11:37','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2019-07-25 11:11:37','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','e0bb818f-dfc1-494c-a9c2-1d5f1a9c7945','Y',430,2)
;
-- 07/25/2019 11:12:06
UPDATE AD_Field SET DisplayLogic='@RelatedInvoice_ID@ > 0', IsReadOnly='Y', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-07-25 11:12:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206136
;
SELECT register_migration_script('201907251130_IDEMPIERE-918_Invoice_RelatedInvoice_ID.sql') FROM dual
;

View File

@ -0,0 +1,43 @@
-- IDEMPIERE-918 - add C_Invoice.RelatedInvoice_ID
-- 07/25/2019 11:08:54
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203348,0,0,'Y',TO_TIMESTAMP('2019-07-25 11:08:54','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2019-07-25 11:08:54','YYYY-MM-DD HH24:MI:SS'),0,'RelatedInvoice_ID','Related Invoice','Related Invoice','D','30673d40-aeaa-4d46-b9aa-fd2d41ab90f8')
;
-- 07/25/2019 11:10:03
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Reference_Value_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (213967,0,'Related Invoice',318,'RelatedInvoice_ID',10,'N','N','N','N','N',0,'N',30,336,0,0,'Y',TO_TIMESTAMP('2019-07-25 11:10:03','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2019-07-25 11:10:03','YYYY-MM-DD HH24:MI:SS'),0,203348,'Y','N','D','N','N','N','Y','75158448-52e0-426b-a393-86141d86157e','N',0,'N','N','N','N')
;
-- 07/25/2019 11:10:08
UPDATE AD_Column SET FKConstraintName='RelatedInvoice_CInvoice', FKConstraintType='N',Updated=TO_TIMESTAMP('2019-07-25 11:10:08','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Column_ID=213967
;
-- 07/25/2019 11:10:08
ALTER TABLE C_Invoice ADD COLUMN RelatedInvoice_ID NUMERIC(10) DEFAULT NULL
;
-- 07/25/2019 11:10:08
ALTER TABLE C_Invoice ADD CONSTRAINT RelatedInvoice_CInvoice FOREIGN KEY (RelatedInvoice_ID) REFERENCES c_invoice(c_invoice_id) DEFERRABLE INITIALLY DEFERRED
;
-- 07/25/2019 11:10:35
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (206135,'Related Invoice',263,213967,'Y',10,460,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2019-07-25 11:10:35','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2019-07-25 11:10:35','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','ecbcf980-4cfe-4937-b31a-9e18e7e5767e','Y',450,2)
;
-- 07/25/2019 11:10:44
UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-07-25 11:10:44','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=204733
;
-- 07/25/2019 11:11:21
UPDATE AD_Field SET DisplayLogic='@RelatedInvoice_ID@ > 0', IsReadOnly='Y', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-07-25 11:11:21','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206135
;
-- 07/25/2019 11:11:38
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (206136,'Related Invoice',290,213967,'Y',10,440,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2019-07-25 11:11:37','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2019-07-25 11:11:37','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','e0bb818f-dfc1-494c-a9c2-1d5f1a9c7945','Y',430,2)
;
-- 07/25/2019 11:12:06
UPDATE AD_Field SET DisplayLogic='@RelatedInvoice_ID@ > 0', IsReadOnly='Y', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-07-25 11:12:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=206136
;
SELECT register_migration_script('201907251130_IDEMPIERE-918_Invoice_RelatedInvoice_ID.sql') FROM dual
;

View File

@ -109,21 +109,9 @@ public class InvoiceCreateCreditMemo extends SvrProcess {
if (invoice.isCreditMemo()) {
throw new AdempiereException(Msg.getMsg(getCtx(), "CannotCreateCreditMemoFromCreditMemo"));
}
// Validate if there is already another credit memo for this invoice (via POReference)
final String sql = ""
+ "SELECT C_Invoice_ID "
+ "FROM C_Invoice i "
+ " JOIN C_DocType dt ON ( i.C_DocType_ID = dt.C_DocType_ID ) "
+ "WHERE i.POReference = ? "
+ " AND dt.DocBaseType IN ( ?, ? ) "
+ " AND i.C_BPartner_ID = ? "
+ " AND i.AD_Client_ID = ? "
+ " AND i.AD_Org_ID = ?";
int id = DB.getSQLValue(get_TrxName(), sql,
invoice.getDocumentNo(),
MDocType.DOCBASETYPE_APCreditMemo, MDocType.DOCBASETYPE_ARCreditMemo,
invoice.getC_BPartner_ID(),
invoice.getAD_Client_ID(), invoice.getAD_Org_ID());
// Validate if there is already another credit memo for this invoice
int id = DB.getSQLValueEx(get_TrxName(), "SELECT C_Invoice_ID FROM C_Invoice WHERE RelatedInvoice_ID = ?", invoice.getC_Invoice_ID());
if (id > 0) {
MInvoice actualCreditMemo = MInvoice.get(getCtx(), id);
MDocType dtc = MDocType.get(getCtx(), actualCreditMemo.getC_DocTypeTarget_ID());
@ -182,6 +170,7 @@ public class InvoiceCreateCreditMemo extends SvrProcess {
StringBuilder msgadd = new StringBuilder("{->").append(invoice.getDocumentNo()).append(")");
creditMemo.addDescription(msgadd.toString());
creditMemo.setPOReference(invoice.getDocumentNo());
creditMemo.setRelatedInvoice_ID(invoice.getC_Invoice_ID());
creditMemo.saveEx(get_TrxName());
//
if (p_DocAction != null) {

View File

@ -816,6 +816,17 @@ public interface I_C_Invoice
/** Get Referenced Invoice */
public int getRef_Invoice_ID();
/** Column name RelatedInvoice_ID */
public static final String COLUMNNAME_RelatedInvoice_ID = "RelatedInvoice_ID";
/** Set Related Invoice */
public void setRelatedInvoice_ID (int RelatedInvoice_ID);
/** Get Related Invoice */
public int getRelatedInvoice_ID();
public org.compiere.model.I_C_Invoice getRelatedInvoice() throws RuntimeException;
/** Column name Reversal_ID */
public static final String COLUMNNAME_Reversal_ID = "Reversal_ID";

View File

@ -33,7 +33,7 @@ public class X_C_Invoice extends PO implements I_C_Invoice, I_Persistent
/**
*
*/
private static final long serialVersionUID = 20190106L;
private static final long serialVersionUID = 20190725L;
/** Standard Constructor */
public X_C_Invoice (Properties ctx, int C_Invoice_ID, String trxName)
@ -1454,6 +1454,31 @@ public class X_C_Invoice extends PO implements I_C_Invoice, I_Persistent
return ii.intValue();
}
public org.compiere.model.I_C_Invoice getRelatedInvoice() throws RuntimeException
{
return (org.compiere.model.I_C_Invoice)MTable.get(getCtx(), org.compiere.model.I_C_Invoice.Table_Name)
.getPO(getRelatedInvoice_ID(), get_TrxName()); }
/** Set Related Invoice.
@param RelatedInvoice_ID Related Invoice */
public void setRelatedInvoice_ID (int RelatedInvoice_ID)
{
if (RelatedInvoice_ID < 1)
set_Value (COLUMNNAME_RelatedInvoice_ID, null);
else
set_Value (COLUMNNAME_RelatedInvoice_ID, Integer.valueOf(RelatedInvoice_ID));
}
/** Get Related Invoice.
@return Related Invoice */
public int getRelatedInvoice_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_RelatedInvoice_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_C_Invoice getReversal() throws RuntimeException
{
return (org.compiere.model.I_C_Invoice)MTable.get(getCtx(), org.compiere.model.I_C_Invoice.Table_Name)

View File

@ -1434,6 +1434,21 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
if (isTreeDrivenByValue())
treePanel.prepareForRefresh();
}
if ("Saved".equals(e.getAD_Message()) && model.find(null, gridTab.getRecord_ID()) != null && !isTreeDrivenByValue())
{
DefaultTreeNode<Object> treeNode = model.find(null, gridTab.getRecord_ID());
if (treeNode != null) { //
MTreeNode data = (MTreeNode) treeNode.getData();
String label = (isValueDisplayed() ? (gridTab.getValue("Value").toString() + " - ") : "") + gridTab.get_ValueAsString("Name");
if (!data.getName().equals(label)) {
data.setName(label);
treeNode.setData(data);
}
}
}
if (refresh)
{
int AD_Tree_ID = Env.getContextAsInt (Env.getCtx(), getWindowNo(), "AD_Tree_ID", true);

View File

@ -277,7 +277,7 @@ public class ChangePasswordPanel extends Window implements EventListener<Event>
else if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
{
SessionManager.logoutSession();
wndLogin.loginCancelled();
//wndLogin.loginCancelled();
}
else if (event.getTarget() == txtNewPassword) {
MPasswordRule pwdrule = MPasswordRule.getRules(Env.getCtx(), null);

View File

@ -51,6 +51,7 @@ import org.compiere.model.MTab;
import org.compiere.model.Query;
import org.compiere.model.X_AD_Tab_Customization;
import org.compiere.util.CLogger;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.NamePair;
@ -131,7 +132,7 @@ public class CustomizeGridViewPanel extends Panel
private boolean uiCreated;
private boolean m_saved = false;
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
private ConfirmPanel confirmPanel = new ConfirmPanel(true, false, true, false, false, false);
/**
* Static Layout
@ -290,6 +291,9 @@ public class CustomizeGridViewPanel extends Panel
} else if (event.getTarget().equals(
confirmPanel.getButton(ConfirmPanel.A_CANCEL))) {
getParent().detach();
} else if (event.getTarget().equals(confirmPanel.getButton(ConfirmPanel.A_RESET))) {
tableSeqs.clear();
loadData();
}
}

View File

@ -1981,6 +1981,9 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
// do nothing when parameter not change and at window mode, or at dialog mode but select non record
onOk();
}
else if (m_infoWindowID == 0 && event.getTarget() instanceof InfoGeneralPanel) {
onUserQuery();
}
}else if (event.getName().equals(Events.ON_CANCEL) || (event.getTarget().equals(this) && event.getName().equals(Events.ON_CLOSE))){
m_cancel = true;
dispose(false);