From 022d3ca9107cfc289ff5a19ac1d0dd95247b03bd Mon Sep 17 00:00:00 2001 From: Diego Ruiz Date: Thu, 14 May 2015 11:03:05 +0200 Subject: [PATCH 01/10] IDEMPIERE-2622 Refresh detail tab on save --- .../org/adempiere/webui/adwindow/AbstractADWindowContent.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java index ca0fb0a955..d4579dde66 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java @@ -2053,6 +2053,9 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements adTabbox.getSelectedGridTab().dataRefreshAll(true, true); adTabbox.getSelectedGridTab().refreshParentTabs(); statusBar.setStatusLine(statusLine); + if( adTabbox.getSelectedDetailADTabpanel() != null && + adTabbox.getSelectedDetailADTabpanel().getGridTab() != null ) + adTabbox.getSelectedDetailADTabpanel().getGridTab().dataRefreshAll(true, true); } if (dirtyTabpanel != null) { if (dirtyTabpanel == adTabbox.getSelectedDetailADTabpanel()) From da2f37fbe07a0bc08aa361e5450123cbcf4538dc Mon Sep 17 00:00:00 2001 From: hieplq Date: Thu, 14 May 2015 19:10:22 +0700 Subject: [PATCH 02/10] IDEMPIERE-2616:Bug after closing Search Dialog --- .../WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java index 9bea87bc00..200d07da46 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPanel.java @@ -206,7 +206,8 @@ public abstract class InfoPanel extends Window implements EventListener, infoWindow = MInfoWindow.get(p_keyColumn.replace("_ID", ""), null); addEventListener(WindowContainer.ON_WINDOW_CONTAINER_SELECTION_CHANGED_EVENT, this); addEventListener(ON_RUN_PROCESS, this); - + addEventListener(Events.ON_CLOSE, this); + } // InfoPanel private void init() @@ -1375,7 +1376,7 @@ public abstract class InfoPanel extends Window implements EventListener, // do nothing when parameter not change and at window mode, or at dialog mode but select non record onOk(); } - }else if (event.getName().equals(Events.ON_CANCEL)){ + }else if (event.getName().equals(Events.ON_CANCEL) || (event.getTarget().equals(this) && event.getName().equals(Events.ON_CLOSE))){ m_cancel = true; dispose(false); } From abef172dd0be399986d275672cf5fc74b8916885 Mon Sep 17 00:00:00 2001 From: sauljabin Date: Fri, 15 May 2015 12:52:37 -0500 Subject: [PATCH 03/10] IDEMPIERE-2623 Limit and offset in queryData WebService --- .../Notes/HowToAddNewWebService.txt | 18 ++++++++++++++++++ .../adinterface/ModelADServiceImpl.java | 14 ++++++++++---- .../WEB-INF/xsd/idempiere-schema.xsd | 2 ++ 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/org.idempiere.webservices/Notes/HowToAddNewWebService.txt b/org.idempiere.webservices/Notes/HowToAddNewWebService.txt index 045bd2ce31..341baf5b71 100644 --- a/org.idempiere.webservices/Notes/HowToAddNewWebService.txt +++ b/org.idempiere.webservices/Notes/HowToAddNewWebService.txt @@ -11,9 +11,27 @@ the new webservice will have the following parameters: Note, if you need to define new datatypes you need to define them in WEB-INF/xsd/idempiere-schema.xsd and generate the idempiere-xmlbeans.jar again with this command: + scomp -out ./WEB-INF/lib/idempiere-xmlbeans.jar ./WEB-INF/xsd/idempiere-schema.xsd + scomp will generate the corresponding classes to manipulate the xml objects from the messages +To install xmlbeans Git Clone URL: git://git.apache.org/xmlbeans.git +cd xmlbeans/ +./xbeanenv.sh +ant + +Environment example: +export XMLBEANS_HOME=/opt/xmlbeans +export PATH=$PATH:$XMLBEANS_HOME/bin +export XMLBEANS_LIB=$XMLBEANS_HOME/build/lib +export JAVA_HOME=/usr/lib/jvm/java-1.7.0...(your path) + +Apps: +ant +svn +git + The method will be called modelSetDocAction - the model in name indicates that the web service is going to be based on model classes, current web services are based in UI instead of model. diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java index 7e370c3ff0..4b73fc370e 100644 --- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java +++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java @@ -1478,6 +1478,9 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic POInfo poinfo = POInfo.getPOInfo(ctx, table.getAD_Table_ID()); int cnt = 0; + int rowCnt = 0; + int offset = modelCRUD.getOffset(); + int limit = modelCRUD.getLimit(); PreparedStatement pstmtquery = null; ResultSet rsquery = null; @@ -1539,6 +1542,9 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic DataSet ds = resp.addNewDataSet(); while (rsquery.next ()) { cnt++; + if ((offset >= cnt) || (limit > 0 && offset+limit < cnt)) + continue; + rowCnt++; DataRow dr = ds.addNewDataRow(); for (int i = 0; i < poinfo.getColumnCount(); i++) { String columnName = poinfo.getColumnName(i); @@ -1560,11 +1566,11 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic rsquery = null; pstmtquery = null; } - resp.setSuccess(true); - resp.setRowCount(cnt); - resp.setNumRows(cnt); + resp.setSuccess(true); + resp.setRowCount(rowCnt); + resp.setNumRows(rowCnt); resp.setTotalRows(cnt); - resp.setStartRow(1); + resp.setStartRow(offset); return ret; } finally { diff --git a/org.idempiere.webservices/WEB-INF/xsd/idempiere-schema.xsd b/org.idempiere.webservices/WEB-INF/xsd/idempiere-schema.xsd index 3ec31594ac..0ab0ec392f 100644 --- a/org.idempiere.webservices/WEB-INF/xsd/idempiere-schema.xsd +++ b/org.idempiere.webservices/WEB-INF/xsd/idempiere-schema.xsd @@ -263,6 +263,8 @@ + + From 6bbafff154826bfbc57cadeee0d187a204f5ec06 Mon Sep 17 00:00:00 2001 From: Deepak Pansheriya Date: Wed, 20 May 2015 09:48:39 +0530 Subject: [PATCH 04/10] IDEMPIERE-2632: Bank statement post inactive lines too. --- .../src/org/compiere/acct/Doc_BankStatement.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/acct/Doc_BankStatement.java b/org.adempiere.base/src/org/compiere/acct/Doc_BankStatement.java index ef8f147a95..f8ae106ae8 100644 --- a/org.adempiere.base/src/org/compiere/acct/Doc_BankStatement.java +++ b/org.adempiere.base/src/org/compiere/acct/Doc_BankStatement.java @@ -101,9 +101,11 @@ public class Doc_BankStatement extends Doc for (int i = 0; i < lines.length; i++) { MBankStatementLine line = lines[i]; - DocLine_Bank docLine = new DocLine_Bank(line, this); - - list.add(docLine); + if(line.isActive()) + { + DocLine_Bank docLine = new DocLine_Bank(line, this); + list.add(docLine); + } } // Return Array From fd17ccb58014121bc0c623f953508473e444bff6 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 20 May 2015 09:48:21 -0500 Subject: [PATCH 05/10] IDEMPIERE-2632 Banks statement document posts inactive records / inactive records also changing balance wrongly --- .../src/org/compiere/process/CopyFromBankStmt.java | 2 ++ org.adempiere.base/src/org/compiere/model/MBankStatement.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/org.adempiere.base.process/src/org/compiere/process/CopyFromBankStmt.java b/org.adempiere.base.process/src/org/compiere/process/CopyFromBankStmt.java index 4bdd140712..a78ed98038 100644 --- a/org.adempiere.base.process/src/org/compiere/process/CopyFromBankStmt.java +++ b/org.adempiere.base.process/src/org/compiere/process/CopyFromBankStmt.java @@ -76,6 +76,8 @@ public class CopyFromBankStmt extends SvrProcess for (MBankStatementLine fromLine : from.getLines(false)) { + if (!fromLine.isActive()) + continue; if (fromLine.getC_Payment_ID() > 0) { // check if payment is used on another statement diff --git a/org.adempiere.base/src/org/compiere/model/MBankStatement.java b/org.adempiere.base/src/org/compiere/model/MBankStatement.java index 3a9d647894..4002743401 100644 --- a/org.adempiere.base/src/org/compiere/model/MBankStatement.java +++ b/org.adempiere.base/src/org/compiere/model/MBankStatement.java @@ -317,6 +317,8 @@ public class MBankStatement extends X_C_BankStatement implements DocAction for (int i = 0; i < lines.length; i++) { MBankStatementLine line = lines[i]; + if (!line.isActive()) + continue; total = total.add(line.getStmtAmt()); if (line.getDateAcct().before(minDate)) minDate = line.getDateAcct(); From 9697eb45dd74d34680abf0367c03836b0128ee75 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud Date: Wed, 20 May 2015 11:16:11 -0500 Subject: [PATCH 06/10] IDEMPIERE-2614 Login page - hardcoded log.warning with language --- org.adempiere.base/src/org/compiere/util/Language.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/util/Language.java b/org.adempiere.base/src/org/compiere/util/Language.java index d6a06c9a4e..366ac3f435 100644 --- a/org.adempiere.base/src/org/compiere/util/Language.java +++ b/org.adempiere.base/src/org/compiere/util/Language.java @@ -170,8 +170,6 @@ public class Language implements Serializable StringBuilder msglog = new StringBuilder("Adding Language=").append(language).append(", Country=").append(country).append(", Locale=").append(locale); log.info (msglog.toString()); } - StringBuilder msglog = new StringBuilder("Adding Language=").append(language).append(", Country=").append(country).append(", Locale=").append(locale); - log.warning(msglog.toString()); if (idxReplace >= 0) { s_languages.set(idxReplace, ll); } else { From 7134376d7b070152e5168a1ee5b3f9497f377984 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 20 May 2015 12:17:24 -0500 Subject: [PATCH 07/10] IDEMPIERE-2583 Can't zoom to a sub tab from Info Window --- .../WEB-INF/src/org/adempiere/webui/apps/AEnv.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java index 7e832796e2..4ddbf5965b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/AEnv.java @@ -156,7 +156,11 @@ public final class AEnv if (AD_Window_ID == 0) return; MTable table = MTable.get(Env.getCtx(), AD_Table_ID); - zoom(AD_Window_ID, MQuery.getEqualQuery(table.getKeyColumns()[0], Record_ID)); + MQuery query = MQuery.getEqualQuery(table.getKeyColumns()[0], Record_ID); + query.setZoomTableName(table.getTableName()); + query.setZoomColumnName(table.getKeyColumns()[0]); + query.setZoomValue(Record_ID); + zoom(AD_Window_ID, query); } // zoom /************************************************************************* From 119f51f56416b5e329854c83337f9baf2982ab81 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 20 May 2015 13:01:08 -0500 Subject: [PATCH 08/10] IDEMPIERE-2625 BOMPriceStd function incorre / thanks to red1 and Dietmar (didiber) for suggestion --- .../oracle/functions/BOM_PriceLimit.sql | 2 - .../oracle/functions/BOM_PriceList.sql | 2 - db/ddlutils/oracle/functions/BOM_PriceStd.sql | 2 - .../postgresql/functions/BOM_PriceLimit.sql | 2 - .../postgresql/functions/BOM_PriceList.sql | 2 - .../postgresql/functions/BOM_PriceStd.sql | 2 - .../oracle/201505201243_IDEMPIERE-2625.sql | 157 ++++++++++++++++++ .../201505201243_IDEMPIERE-2625.sql | 113 +++++++++++++ 8 files changed, 270 insertions(+), 12 deletions(-) create mode 100644 migration/i2.1/oracle/201505201243_IDEMPIERE-2625.sql create mode 100644 migration/i2.1/postgresql/201505201243_IDEMPIERE-2625.sql diff --git a/db/ddlutils/oracle/functions/BOM_PriceLimit.sql b/db/ddlutils/oracle/functions/BOM_PriceLimit.sql index 37733c93fe..8ca102b31c 100644 --- a/db/ddlutils/oracle/functions/BOM_PriceLimit.sql +++ b/db/ddlutils/oracle/functions/BOM_PriceLimit.sql @@ -27,8 +27,6 @@ AS WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=Product_ID AND b.M_ProductBOM_ID != Product_ID - AND p.IsBOM='Y' - AND p.IsVerified='Y' AND b.IsActive='Y'; -- BEGIN diff --git a/db/ddlutils/oracle/functions/BOM_PriceList.sql b/db/ddlutils/oracle/functions/BOM_PriceList.sql index da274c35d8..b9590f4501 100644 --- a/db/ddlutils/oracle/functions/BOM_PriceList.sql +++ b/db/ddlutils/oracle/functions/BOM_PriceList.sql @@ -27,8 +27,6 @@ AS WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=Product_ID AND b.M_ProductBOM_ID != Product_ID - AND p.IsBOM='Y' - AND p.IsVerified='Y' AND b.IsActive='Y'; -- BEGIN diff --git a/db/ddlutils/oracle/functions/BOM_PriceStd.sql b/db/ddlutils/oracle/functions/BOM_PriceStd.sql index eace5db30a..143dbf87d6 100644 --- a/db/ddlutils/oracle/functions/BOM_PriceStd.sql +++ b/db/ddlutils/oracle/functions/BOM_PriceStd.sql @@ -27,8 +27,6 @@ AS WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=Product_ID AND b.M_ProductBOM_ID != Product_ID - AND p.IsBOM='Y' - AND p.IsVerified='Y' AND b.IsActive='Y'; -- BEGIN diff --git a/db/ddlutils/postgresql/functions/BOM_PriceLimit.sql b/db/ddlutils/postgresql/functions/BOM_PriceLimit.sql index f9c1b0b4b9..216dce20a5 100644 --- a/db/ddlutils/postgresql/functions/BOM_PriceLimit.sql +++ b/db/ddlutils/postgresql/functions/BOM_PriceLimit.sql @@ -20,8 +20,6 @@ BEGIN WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=Product_ID AND b.M_ProductBOM_ID != Product_ID - AND p.IsBOM='Y' - AND p.IsVerified='Y' AND b.IsActive='Y' LOOP v_ProductPrice := bomPriceLimit (bom.M_ProductBOM_ID, PriceList_Version_ID); diff --git a/db/ddlutils/postgresql/functions/BOM_PriceList.sql b/db/ddlutils/postgresql/functions/BOM_PriceList.sql index 8677da115c..03f69e0dae 100644 --- a/db/ddlutils/postgresql/functions/BOM_PriceList.sql +++ b/db/ddlutils/postgresql/functions/BOM_PriceList.sql @@ -20,8 +20,6 @@ BEGIN WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=Product_ID AND b.M_ProductBOM_ID != Product_ID - AND p.IsBOM='Y' - AND p.IsVerified='Y' AND b.IsActive='Y' LOOP v_ProductPrice := bomPriceList (bom.M_ProductBOM_ID, PriceList_Version_ID); diff --git a/db/ddlutils/postgresql/functions/BOM_PriceStd.sql b/db/ddlutils/postgresql/functions/BOM_PriceStd.sql index 96c3dabf00..5c34e42dca 100644 --- a/db/ddlutils/postgresql/functions/BOM_PriceStd.sql +++ b/db/ddlutils/postgresql/functions/BOM_PriceStd.sql @@ -20,8 +20,6 @@ BEGIN WHERE b.M_ProductBOM_ID=p.M_Product_ID AND b.M_Product_ID=Product_ID AND b.M_ProductBOM_ID != Product_ID - AND p.IsBOM='Y' - AND p.IsVerified='Y' AND b.IsActive='Y' LOOP v_ProductPrice := bomPriceStd (bom.M_ProductBOM_ID, PriceList_Version_ID); diff --git a/migration/i2.1/oracle/201505201243_IDEMPIERE-2625.sql b/migration/i2.1/oracle/201505201243_IDEMPIERE-2625.sql new file mode 100644 index 0000000000..e2acc007da --- /dev/null +++ b/migration/i2.1/oracle/201505201243_IDEMPIERE-2625.sql @@ -0,0 +1,157 @@ +CREATE OR REPLACE FUNCTION BOMPRICELIMIT +( + Product_ID IN NUMBER, + PriceList_Version_ID IN NUMBER +) +RETURN NUMBER +/************************************************************************* + * The contents of this file are subject to the Compiere License. You may + * obtain a copy of the License at http://www.compiere.org/license.html + * Software is on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for details. Code: Compiere ERP+CRM + * Copyright (C) 1999-2002 Jorg Janke, ComPiere, Inc. All Rights Reserved. + ************************************************************************* + * $Id: BOM_PriceLimit.sql,v 1.1 2006/04/21 17:51:58 jjanke Exp $ + *** + * Title: Return Limit Price of Product/BOM + * Description: + * if not found: 0 + ************************************************************************/ +AS + v_Price NUMBER; + v_ProductPrice NUMBER; + -- Get BOM Product info + CURSOR CUR_BOM IS + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND b.IsActive='Y'; + -- +BEGIN + -- Try to get price from PriceList directly + SELECT COALESCE (SUM(PriceLimit), 0) + INTO v_Price + FROM M_PRODUCTPRICE + WHERE M_PriceList_Version_ID=PriceList_Version_ID AND M_Product_ID=Product_ID; +-- DBMS_OUTPUT.PUT_LINE('Price=' || v_Price); + + -- No Price - Check if BOM + IF (v_Price = 0) THEN + FOR bom IN CUR_BOM LOOP + v_ProductPrice := Bompricelimit (bom.M_ProductBOM_ID, PriceList_Version_ID); + v_Price := v_Price + (bom.BOMQty * v_ProductPrice); + END LOOP; + END IF; + -- + RETURN v_Price; +END Bompricelimit; +/ + +CREATE OR REPLACE FUNCTION BOMPRICELIST +( + Product_ID IN NUMBER, + PriceList_Version_ID IN NUMBER +) +RETURN NUMBER +/************************************************************************* + * The contents of this file are subject to the Compiere License. You may + * obtain a copy of the License at http://www.compiere.org/license.html + * Software is on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for details. Code: Compiere ERP+CRM + * Copyright (C) 1999-2002 Jorg Janke, ComPiere, Inc. All Rights Reserved. + ************************************************************************* + * $Id: BOM_PriceList.sql,v 1.1 2006/04/21 17:51:58 jjanke Exp $ + *** + * Title: Return List Price of Product/BOM + * Description: + * if not found: 0 + ************************************************************************/ +AS + v_Price NUMBER; + v_ProductPrice NUMBER; + -- Get BOM Product info + CURSOR CUR_BOM IS + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND b.IsActive='Y'; + -- +BEGIN + -- Try to get price from pricelist directly + SELECT COALESCE (SUM(PriceList), 0) + INTO v_Price + FROM M_PRODUCTPRICE + WHERE M_PriceList_Version_ID=PriceList_Version_ID AND M_Product_ID=Product_ID; +-- DBMS_OUTPUT.PUT_LINE('Price=' || Price); + + -- No Price - Check if BOM + IF (v_Price = 0) THEN + FOR bom IN CUR_BOM LOOP + v_ProductPrice := Bompricelist (bom.M_ProductBOM_ID, PriceList_Version_ID); + v_Price := v_Price + (bom.BOMQty * v_ProductPrice); + -- DBMS_OUTPUT.PUT_LINE('Qry=' || bom.BOMQty || ' @ ' || v_ProductPrice || ', Price=' || v_Price); + END LOOP; -- BOM + END IF; + -- + RETURN v_Price; +END Bompricelist; +/ + +CREATE OR REPLACE FUNCTION BOMPRICESTD +( + Product_ID IN NUMBER, + PriceList_Version_ID IN NUMBER +) +RETURN NUMBER +/************************************************************************* + * The contents of this file are subject to the Compiere License. You may + * obtain a copy of the License at http://www.compiere.org/license.html + * Software is on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either + * express or implied. See the License for details. Code: Compiere ERP+CRM + * Copyright (C) 1999-2002 Jorg Janke, ComPiere, Inc. All Rights Reserved. + ************************************************************************* + * $Id: BOM_PriceStd.sql,v 1.1 2006/04/21 17:51:58 jjanke Exp $ + *** + * Title: Return Standard Price of Product/BOM + * Description: + * if not found: 0 + ************************************************************************/ +AS + v_Price NUMBER; + v_ProductPrice NUMBER; + -- Get BOM Product info + CURSOR CUR_BOM IS + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM + FROM M_PRODUCT_BOM b, M_PRODUCT p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND b.IsActive='Y'; + -- +BEGIN + -- Try to get price from pricelist directly + SELECT COALESCE(SUM(PriceStd), 0) + INTO v_Price + FROM M_PRODUCTPRICE + WHERE M_PriceList_Version_ID=PriceList_Version_ID AND M_Product_ID=Product_ID; +-- DBMS_OUTPUT.PUT_LINE('Price=' || v_Price); + + -- No Price - Check if BOM + IF (v_Price = 0) THEN + FOR bom IN CUR_BOM LOOP + v_ProductPrice := Bompricestd (bom.M_ProductBOM_ID, PriceList_Version_ID); + v_Price := v_Price + (bom.BOMQty * v_ProductPrice); + -- DBMS_OUTPUT.PUT_LINE('Price=' || v_Price); + END LOOP; -- BOM + END IF; + -- + RETURN v_Price; +END Bompricestd; +/ + +SELECT register_migration_script('201505201243_IDEMPIERE-2625.sql') FROM dual +; diff --git a/migration/i2.1/postgresql/201505201243_IDEMPIERE-2625.sql b/migration/i2.1/postgresql/201505201243_IDEMPIERE-2625.sql new file mode 100644 index 0000000000..3a299d3b64 --- /dev/null +++ b/migration/i2.1/postgresql/201505201243_IDEMPIERE-2625.sql @@ -0,0 +1,113 @@ +CREATE OR REPLACE FUNCTION bompricelimit (in product_id numeric, in pricelist_version_id numeric) RETURNS numeric AS +$BODY$ +DECLARE + v_Price NUMERIC; + v_ProductPrice NUMERIC; + bom RECORD; + +BEGIN + -- Try to get price from PriceList directly + SELECT COALESCE (SUM(PriceLimit), 0) + INTO v_Price + FROM M_ProductPrice + WHERE M_PriceList_Version_ID=PriceList_Version_ID AND M_Product_ID=Product_ID; + + -- No Price - Check if BOM + IF (v_Price = 0) THEN + FOR bom IN + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM + FROM M_Product_BOM b, M_Product p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND b.IsActive='Y' + LOOP + v_ProductPrice := bomPriceLimit (bom.M_ProductBOM_ID, PriceList_Version_ID); + v_Price := v_Price + (bom.BOMQty * v_ProductPrice); + END LOOP; + END IF; + -- + RETURN v_Price; + +END; + +$BODY$ +LANGUAGE 'plpgsql' STABLE +; + +CREATE OR REPLACE FUNCTION bompricelist (in product_id numeric, in pricelist_version_id numeric) RETURNS numeric AS +$BODY$ +DECLARE + v_Price NUMERIC; + v_ProductPrice NUMERIC; + bom RECORD; + +BEGIN + -- Try to get price from pricelist directly + SELECT COALESCE (SUM(PriceList), 0) + INTO v_Price + FROM M_ProductPrice + WHERE M_PriceList_Version_ID=PriceList_Version_ID AND M_Product_ID=Product_ID; + + -- No Price - Check if BOM + IF (v_Price = 0) THEN + FOR bom IN + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM + FROM M_Product_BOM b, M_Product p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND b.IsActive='Y' + LOOP + v_ProductPrice := bomPriceList (bom.M_ProductBOM_ID, PriceList_Version_ID); + v_Price := v_Price + (bom.BOMQty * v_ProductPrice); + END LOOP; + END IF; + -- + RETURN v_Price; + +END; + +$BODY$ +LANGUAGE 'plpgsql' STABLE +; + +CREATE OR REPLACE FUNCTION bompricestd (in product_id numeric, in pricelist_version_id numeric) RETURNS numeric AS +$BODY$ +DECLARE + v_Price NUMERIC; + v_ProductPrice NUMERIC; + bom RECORD; + +BEGIN + -- Try to get price from PriceList directly + SELECT COALESCE(SUM(PriceStd), 0) + INTO v_Price + FROM M_ProductPrice + WHERE M_PriceList_Version_ID=PriceList_Version_ID AND M_Product_ID=Product_ID; + + -- No Price - Check if BOM + IF (v_Price = 0) THEN + FOR bom IN + SELECT b.M_ProductBOM_ID, b.BOMQty, p.IsBOM + FROM M_Product_BOM b, M_Product p + WHERE b.M_ProductBOM_ID=p.M_Product_ID + AND b.M_Product_ID=Product_ID + AND b.M_ProductBOM_ID != Product_ID + AND b.IsActive='Y' + LOOP + v_ProductPrice := bomPriceStd (bom.M_ProductBOM_ID, PriceList_Version_ID); + v_Price := v_Price + (bom.BOMQty * v_ProductPrice); + END LOOP; + END IF; + -- + RETURN v_Price; + +END; + +$BODY$ +LANGUAGE 'plpgsql' STABLE +; + +SELECT register_migration_script('201505201243_IDEMPIERE-2625.sql') FROM dual +; From b375650101b66b463ab5b2c6834c5094660b4821 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 20 May 2015 18:44:08 -0500 Subject: [PATCH 09/10] IDEMPIERE-2594 RMA does not allow repeat returns on same shipment. / based on patch provided by Redhuan (red1) --- org.adempiere.ui/src/org/compiere/grid/CreateFromRMA.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/org.adempiere.ui/src/org/compiere/grid/CreateFromRMA.java b/org.adempiere.ui/src/org/compiere/grid/CreateFromRMA.java index e25d66206f..444de85e38 100644 --- a/org.adempiere.ui/src/org/compiere/grid/CreateFromRMA.java +++ b/org.adempiere.ui/src/org/compiere/grid/CreateFromRMA.java @@ -73,7 +73,7 @@ public abstract class CreateFromRMA extends CreateFrom { sqlStmt.append("SELECT iol.M_InOutLine_ID, iol.Line, "); sqlStmt.append("COALESCE(p.Name, c.Name) AS ProductName, "); sqlStmt.append("iol.QtyEntered, "); - sqlStmt.append("iol.movementQty, "); + sqlStmt.append("iol.movementQty-(SELECT COALESCE((SELECT SUM(rmal.qty) FROM M_RMALine rmal JOIN M_RMA rma ON rma.M_RMA_ID=rmal.M_RMA_ID WHERE rmal.M_InOutLine_ID=iol.M_InOutLine_ID AND rma.DocStatus IN ('CO','CL')),0)) AS MovementQty, "); sqlStmt.append("CASE WHEN iol.M_AttributeSetInstance_ID IS NOT NULL THEN (SELECT SerNo FROM M_AttributeSetInstance asi WHERE asi.M_AttributeSetInstance_ID=iol.M_AttributeSetInstance_ID) END as ASI "); sqlStmt.append("FROM M_InOutLine iol "); sqlStmt.append("LEFT JOIN M_Product p ON p.M_Product_ID = iol.M_Product_ID "); @@ -136,7 +136,7 @@ public abstract class CreateFromRMA extends CreateFrom { miniTable.setColumnClass(2, String.class, true); // 2-Product miniTable.setColumnClass(3, String.class, true); // 3-ASI miniTable.setColumnClass(4, BigDecimal.class, true); // 4-Qty - miniTable.setColumnClass(5, BigDecimal.class, true); // 5-Delivered Qty + miniTable.setColumnClass(5, BigDecimal.class, false); // 5-Delivered Qty // Table UI miniTable.autoSize(); From 7c80d8caa4e86f1774831a2109732d12687d6e84 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 20 May 2015 20:41:44 -0500 Subject: [PATCH 10/10] IDEMPIERE-2629 M_StorageOnHand Qty and Total M_Transaction Qty did not match --- .../src/org/compiere/db/DB_Oracle.java | 2 ++ .../src/org/compiere/db/DB_PostgreSQL.java | 2 ++ 2 files changed, 4 insertions(+) diff --git a/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java b/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java index 61addf67a7..e82eee8deb 100644 --- a/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java +++ b/org.compiere.db.oracle.provider/src/org/compiere/db/DB_Oracle.java @@ -1362,6 +1362,8 @@ public class DB_Oracle implements AdempiereDatabase } rs = stmt.executeQuery(); if (rs.next()) { + // reload the record being locked - it could have changed in a different thread - IDEMPIERE-2629 + po.load(po.get_TrxName()); return true; } else { return false; diff --git a/org.compiere.db.postgresql.provider/src/org/compiere/db/DB_PostgreSQL.java b/org.compiere.db.postgresql.provider/src/org/compiere/db/DB_PostgreSQL.java index 05c7113916..80002cbba8 100755 --- a/org.compiere.db.postgresql.provider/src/org/compiere/db/DB_PostgreSQL.java +++ b/org.compiere.db.postgresql.provider/src/org/compiere/db/DB_PostgreSQL.java @@ -1089,6 +1089,8 @@ public class DB_PostgreSQL implements AdempiereDatabase rs = stmt.executeQuery(); if (rs.next()) { + // reload the record being locked - it could have changed in a different thread - IDEMPIERE-2629 + po.load(po.get_TrxName()); return true; } else { return false;