details: https://code.openbravo.com/erp/devel/pi/rev/828b60c5381a
changeset: 18491:828b60c5381a
user: Naiara Martinez <naiara.martinez <at> openbravo.com>
date: Tue Nov 06 18:21:30 2012 +0100
summary: [Quotations] feedback code review. Fix bug with validfrom dates
diffstat:
src/org/openbravo/erpCommon/ad_actionButton/ActionButtonUtility.java | 3 ++-
src/org/openbravo/erpCommon/ad_process/ConvertQuotationIntoOrder.java | 10
+++++++---
2 files changed, 9 insertions(+), 4 deletions(-)
diffs (61 lines):
diff -r ec9157e84c63 -r 828b60c5381a
src/org/openbravo/erpCommon/ad_actionButton/ActionButtonUtility.java
--- a/src/org/openbravo/erpCommon/ad_actionButton/ActionButtonUtility.java
Tue Nov 06 13:47:58 2012 +0100
+++ b/src/org/openbravo/erpCommon/ad_actionButton/ActionButtonUtility.java
Tue Nov 06 18:21:30 2012 +0100
@@ -22,6 +22,7 @@
import org.apache.log4j.Logger;
import org.openbravo.base.secureApp.VariablesSecureApp;
+import org.openbravo.dal.core.DalUtil;
import org.openbravo.dal.service.OBDal;
import org.openbravo.data.FieldProvider;
import org.openbravo.database.ConnectionProvider;
@@ -48,7 +49,7 @@
String windowId = "";
if (tabId != null) {
Tab tab = OBDal.getInstance().get(Tab.class, tabId);
- windowId = tab.getWindow().getId();
+ windowId = DalUtil.getId(tab.getWindow()).toString();
}
if (log4j.isDebugEnabled())
diff -r ec9157e84c63 -r 828b60c5381a
src/org/openbravo/erpCommon/ad_process/ConvertQuotationIntoOrder.java
--- a/src/org/openbravo/erpCommon/ad_process/ConvertQuotationIntoOrder.java
Tue Nov 06 13:47:58 2012 +0100
+++ b/src/org/openbravo/erpCommon/ad_process/ConvertQuotationIntoOrder.java
Tue Nov 06 18:21:30 2012 +0100
@@ -58,6 +58,8 @@
import org.openbravo.service.db.DalConnectionProvider;
public class ConvertQuotationIntoOrder extends DalBaseProcess {
+
+ @Override
public void doExecute(ProcessBundle bundle) throws Exception {
String dateFormatString =
OBPropertiesProvider.getInstance().getOpenbravoProperties()
@@ -256,7 +258,7 @@
OrderLine objCloneOrdLine, TaxRate lineTax) {
String strPriceVersionId =
getPriceListVersion(objOrder.getPriceList().getId(), objOrder
- .getClient().getId());
+ .getClient().getId(), objCloneOrder.getOrderDate());
BigDecimal bdPriceList = getPriceList(ordLine.getProduct().getId(),
strPriceVersionId);
BigDecimal bdPriceStd = getPriceStd(ordLine.getProduct().getId(),
strPriceVersionId);
@@ -330,15 +332,17 @@
/**
* Get the Current version of a price list
*/
- private String getPriceListVersion(String priceList, String clientId) {
+ private String getPriceListVersion(String priceList, String clientId, Date
orderDate) {
try {
String whereClause = " as plv left outer join plv.priceList pl where
pl.active='Y' and plv.active='Y' and "
- + " pl.id = :priceList and plv.client.id = :clientId order by
plv.validFromDate desc";
+ + " pl.id = :priceList and plv.client.id = :clientId and
plv.validFromDate<= :orderDate order by plv.validFromDate desc";
OBQuery<PriceListVersion> ppriceListVersion =
OBDal.getInstance().createQuery(
PriceListVersion.class, whereClause);
ppriceListVersion.setNamedParameter("priceList", priceList);
ppriceListVersion.setNamedParameter("clientId", clientId);
+ ppriceListVersion.setNamedParameter("orderDate", orderDate);
+ ppriceListVersion.setMaxResult(1);
if (!ppriceListVersion.list().isEmpty()) {
return ppriceListVersion.list().get(0).getId();
------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits