details: /erp/devel/pi/rev/f1b53dfc9e0d
changeset: 7921:f1b53dfc9e0d
user: David Alsasua <david.alsasua <at> openbravo.com>
date: Mon Jul 26 19:27:40 2010 +0200
summary: Fixes issue 14047.
Currently, callout in invoice line uses client warehouse set in context to
retrieve client location, and uses it to select the appropriate tax rate.
Now, once the warehouse is retrieved, it is checked if the organization for
which this warehouse is set, is in the same branch of the organizational tree.
If not, chooses another warehouse: once set for an organization in the same
branch of the tree of organizations.
diffstat:
src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Product.java | 8 +
src/org/openbravo/erpCommon/ad_callouts/SL_Order_Product_data.xsql | 29 ++++
src/org/openbravo/erpCommon/businessUtility/Organization_data.xsql | 65
++++++++++
3 files changed, 102 insertions(+), 0 deletions(-)
diffs (131 lines):
diff -r 13df5b8fc723 -r f1b53dfc9e0d
src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Product.java
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Product.java Mon Jul
26 12:15:32 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Invoice_Product.java Mon Jul
26 19:27:40 2010 +0200
@@ -29,6 +29,7 @@
import org.openbravo.base.secureApp.HttpSecureAppServlet;
import org.openbravo.base.secureApp.VariablesSecureApp;
import org.openbravo.data.FieldProvider;
+import org.openbravo.erpCommon.businessUtility.OrganizationData;
import org.openbravo.erpCommon.businessUtility.PAttributeSet;
import org.openbravo.erpCommon.businessUtility.PAttributeSetData;
import org.openbravo.erpCommon.businessUtility.Tax;
@@ -65,6 +66,13 @@
String strWindowId = vars.getStringParameter("inpwindowId");
String strIsSOTrx = Utility.getContext(this, vars, "isSOTrx",
strWindowId);
String strWharehouse = Utility.getContext(this, vars, "#M_Warehouse_ID",
strWindowId);
+ String strWarehouseOrg = SLOrderProductData.getWarehouseOrg(this,
strWharehouse);
+ String strWarehouseForOrg = "";
+ if (!OrganizationData.isOrgInTree(this, strADOrgID, strWarehouseOrg,
vars.getClient()))
+ strWarehouseForOrg = SLOrderProductData.getWarehouseOfOrg(this,
vars.getClient(),
+ strADOrgID);
+ if (!strWarehouseForOrg.equals(""))
+ strWharehouse = strWarehouseForOrg;
String strTabId = vars.getStringParameter("inpTabId");
try {
diff -r 13df5b8fc723 -r f1b53dfc9e0d
src/org/openbravo/erpCommon/ad_callouts/SL_Order_Product_data.xsql
--- a/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Product_data.xsql
Mon Jul 26 12:15:32 2010 +0200
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Order_Product_data.xsql
Mon Jul 26 19:27:40 2010 +0200
@@ -147,4 +147,33 @@
<Parameter name="adUserClient" type="replace" optional="true"
after="AD_Client_ID IN (" text="'1'"/>
<Parameter name="adUserOrg" type="replace" optional="true"
after="AD_Org_ID IN (" text="'1'"/>
</SqlMethod>
+
+ <SqlMethod name="getWarehouseOrg" type="preparedStatement" return="String">
+ <SqlMethodComment></SqlMethodComment>
+ <Sql>
+ SELECT AD_ORG_ID
+ FROM M_WAREHOUSE
+ WHERE M_WAREHOUSE_ID = ?
+ </Sql>
+ <Parameter name="cWarehouseID"/>
+ </SqlMethod>
+
+ <SqlMethod name="getWarehouseOfOrg" type="preparedStatement" return="String">
+ <SqlMethodComment></SqlMethodComment>
+ <Sql>
+ <![CDATA[
+ select min(w.m_warehouse_id)
+ from m_warehouse w
+ where w.ad_client_id=?
+ and (ad_isorgincluded(?,w.ad_org_id,?)<>-1
+ or ad_isorgincluded(w.ad_org_id,?,?)<>-1)
+ ]]>
+ </Sql>
+ <Parameter name="adClientId"/>
+ <Parameter name="adOrgId"/>
+ <Parameter name="adClientId"/>
+ <Parameter name="adOrgId"/>
+ <Parameter name="adClientId"/>
+ </SqlMethod>
+
</SqlClass>
diff -r 13df5b8fc723 -r f1b53dfc9e0d
src/org/openbravo/erpCommon/businessUtility/Organization_data.xsql
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/erpCommon/businessUtility/Organization_data.xsql
Mon Jul 26 19:27:40 2010 +0200
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo Public License
+ * Version 1.0 (the "License"), being the Mozilla Public License
+ * Version 1.1 with a permitted attribution clause; you may not use this
+ * file except in compliance with the License. You may obtain a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific language governing rights and limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2010 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s): ______________________________________.
+ ************************************************************************
+-->
+
+
+<SqlClass name="OrganizationData"
package="org.openbravo.erpCommon.businessUtility" accessModifier="public">
+ <SqlMethod name="select" type="preparedStatement" return="multiple">
+ <SqlMethodComment></SqlMethodComment>
+ <Sql>
+ <![CDATA[
+ SELECT '' AS RESULT
+ FROM AD_ORG
+ ]]>
+ </Sql>
+ </SqlMethod>
+
+ <SqlMethod name="isOrgInTree" type="preparedStatement" return="Boolean"
default="false">
+ <SqlMethodComment></SqlMethodComment>
+ <Sql>
+ <![CDATA[
+ select count(*) as result
+ from dual
+ where ad_isorgincluded(?,?,?) <> -1
+ or ad_isorgincluded(?,?,?) <> -1
+ ]]>
+ </Sql>
+ <Parameter name="adOrg1Id"/>
+ <Parameter name="adOrg2Id"/>
+ <Parameter name="adClientId"/>
+ <Parameter name="adOrg2Id"/>
+ <Parameter name="adOrg1Id"/>
+ <Parameter name="adClientId"/>
+ </SqlMethod>
+
+ <SqlMethod name="isParentOrg" type="preparedStatement" return="Boolean"
default="false">
+ <SqlMethodComment></SqlMethodComment>
+ <Sql>
+ <![CDATA[
+ select count(*) as result
+ from dual
+ where ad_isorgincluded(?,?,?) <> -1
+ ]]>
+ </Sql>
+ <Parameter name="adOrgId"/>
+ <Parameter name="adParentOrgId"/>
+ <Parameter name="adClientId"/>
+ </SqlMethod>
+
+</SqlClass>
------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://ad.doubleclick.net/clk;226879339;13503038;l?
http://clk.atdmt.com/CRS/go/247765532/direct/01/
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits