Fixes issue 22955: Not possible to filter by Return documents
authorIoritz Cia <ioritz.cia@openbravo.com>
Thu, 09 May 2013 15:56:54 +0200
changeset 20305 c8f69b3d8d6c
parent 20304 01fcd3b1e098
child 20306 253b5864e293
Fixes issue 22955: Not possible to filter by Return documents
in Product Movement Report.
src-db/database/sourcedata/AD_TEXTINTERFACES.xml
src/org/openbravo/erpCommon/ad_reports/ReportProductMovement.html
src/org/openbravo/erpCommon/ad_reports/ReportProductMovement.java
src/org/openbravo/erpCommon/ad_reports/ReportProductMovement.xml
src/org/openbravo/erpCommon/ad_reports/ReportProductMovement_data.xsql
--- a/src-db/database/sourcedata/AD_TEXTINTERFACES.xml	Thu May 09 19:21:21 2013 +0200
+++ b/src-db/database/sourcedata/AD_TEXTINTERFACES.xml	Thu May 09 15:56:54 2013 +0200
@@ -15122,6 +15122,17 @@
 <!--5A77AA3628F14721BD9C4A7DB1ACDB60-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--5A77AA3628F14721BD9C4A7DB1ACDB60--></AD_TEXTINTERFACES>
 
+<!--5ABED706C5DF4E76B061236463296FA4--><AD_TEXTINTERFACES>
+<!--5ABED706C5DF4E76B061236463296FA4-->  <AD_TEXTINTERFACES_ID><![CDATA[5ABED706C5DF4E76B061236463296FA4]]></AD_TEXTINTERFACES_ID>
+<!--5ABED706C5DF4E76B061236463296FA4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--5ABED706C5DF4E76B061236463296FA4-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--5ABED706C5DF4E76B061236463296FA4-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--5ABED706C5DF4E76B061236463296FA4-->  <TEXT><![CDATA[Return Material Receipt/Return to Vendor Shipment]]></TEXT>
+<!--5ABED706C5DF4E76B061236463296FA4-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportProductMovement.html]]></FILENAME>
+<!--5ABED706C5DF4E76B061236463296FA4-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--5ABED706C5DF4E76B061236463296FA4-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--5ABED706C5DF4E76B061236463296FA4--></AD_TEXTINTERFACES>
+
 <!--5AE12FD8B5CBEDF0E040007F01014C1A--><AD_TEXTINTERFACES>
 <!--5AE12FD8B5CBEDF0E040007F01014C1A-->  <AD_TEXTINTERFACES_ID><![CDATA[5AE12FD8B5CBEDF0E040007F01014C1A]]></AD_TEXTINTERFACES_ID>
 <!--5AE12FD8B5CBEDF0E040007F01014C1A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -16761,6 +16772,17 @@
 <!--6C686CCD6CF94FF69CCF009E8549D849-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--6C686CCD6CF94FF69CCF009E8549D849--></AD_TEXTINTERFACES>
 
+<!--6C79754FD7CD4172BD4F2208A416D3D0--><AD_TEXTINTERFACES>
+<!--6C79754FD7CD4172BD4F2208A416D3D0-->  <AD_TEXTINTERFACES_ID><![CDATA[6C79754FD7CD4172BD4F2208A416D3D0]]></AD_TEXTINTERFACES_ID>
+<!--6C79754FD7CD4172BD4F2208A416D3D0-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--6C79754FD7CD4172BD4F2208A416D3D0-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--6C79754FD7CD4172BD4F2208A416D3D0-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--6C79754FD7CD4172BD4F2208A416D3D0-->  <TEXT><![CDATA[Return M.R./Return to V.S.]]></TEXT>
+<!--6C79754FD7CD4172BD4F2208A416D3D0-->  <FILENAME><![CDATA[/org/openbravo/erpCommon/ad_reports/ReportProductMovement.html]]></FILENAME>
+<!--6C79754FD7CD4172BD4F2208A416D3D0-->  <ISUSED><![CDATA[Y]]></ISUSED>
+<!--6C79754FD7CD4172BD4F2208A416D3D0-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--6C79754FD7CD4172BD4F2208A416D3D0--></AD_TEXTINTERFACES>
+
 <!--6C917BC895CB41199D4C6825D5D23403--><AD_TEXTINTERFACES>
 <!--6C917BC895CB41199D4C6825D5D23403-->  <AD_TEXTINTERFACES_ID><![CDATA[6C917BC895CB41199D4C6825D5D23403]]></AD_TEXTINTERFACES_ID>
 <!--6C917BC895CB41199D4C6825D5D23403-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src/org/openbravo/erpCommon/ad_reports/ReportProductMovement.html	Thu May 09 19:21:21 2013 +0200
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportProductMovement.html	Thu May 09 15:56:54 2013 +0200
@@ -89,6 +89,17 @@
      myframe.OB.Utilities.openDirectTab('800202', recordid); //Internal Consumption
    }
  }
+ function openReturnDoc(recordId, issotrx){
+   var myframe = getFrame('LayoutMDI') || top.opener;
+   if (myframe) {
+     if (issotrx == 'Y'){
+       myframe.OB.Utilities.openDirectTab('30576C6ABD12419F9D19D497216FC9B8', recordId); //Return Material Receipt
+     }
+     else{
+       myframe.OB.Utilities.openDirectTab('728DBD16A1F14A4D82335E37BA433E33', recordId); //Return to Vendor Shipment
+     }
+   }
+ }
 function validate(action)
 {
   var frm = document.frmMain;
@@ -419,19 +430,22 @@
               <td class="TitleCell"><span class="LabelText">Shipment/Receipt</span></td>
               <td class="Radio_Check_ContentCell"><span class="Checkbox_container_NOT_Focused"><input type="checkbox" name="inpInout" id="paramInOut" value="-1" checked></input></span></td>
               <td class="ContentCell"> </td>
+              <td class="TitleCell"><span class="LabelText">Return M.R./Return to V.S.</span></td>
+              <td class="Radio_Check_ContentCell"><span class="Checkbox_container_NOT_Focused"><input type="checkbox" name="inpReturn" id="paramReturn" value="-1" checked></input></span></td>
+              <td class="ContentCell"> </td>
+            </tr>
+            <tr>
               <td class="TitleCell"><span class="LabelText">Physical Inventory</span></td>
               <td class="Radio_Check_ContentCell"><span class="Checkbox_container_NOT_Focused"><input type="checkbox" name="inpInventory" id="paramInventory" value="-1" checked></input></span></td>
               <td class="ContentCell"> </td>
-            </tr>
-            <tr>
               <td class="TitleCell"><span class="LabelText">Inventory Move</span></td>
               <td class="Radio_Check_ContentCell"><span class="Checkbox_container_NOT_Focused"><input type="checkbox" name="inpMovement" id="paramMovement" value="-1" checked></input></span></td>
               <td class="ContentCell"> </td>
+            </tr>
+            <tr>
               <td class="TitleCell"><span class="LabelText">Production</span></td>
               <td class="Radio_Check_ContentCell"><span class="Checkbox_container_NOT_Focused"><input type="checkbox" name="inpProduction" id="paramProduction" value="-1" checked></input></span></td>
               <td class="ContentCell"> </td>
-            </tr>
-            <tr>
               <td class="TitleCell"><span class="LabelText">Internal Consumption</span></td>
               <td class="Radio_Check_ContentCell"><span class="Checkbox_container_NOT_Focused"><input type="checkbox" name="inpInternalConsumption" id="paramInternalConsumption" value="-1" checked></input></span></td>
               <td class="ContentCell"> </td>
@@ -535,7 +549,7 @@
                       <th width="6%" class="DataGrid_Header_Cell">Quantity</th>
                     </tr>
                     <div id="sectionDetail"> 
-                      <tr class="DataGrid_Body_Row DataGrid_Body_Row_yy" id="funcEvenOddRow1xx">
+                      <tr class="DataGrid_Body_Row DataGrid_Body_Row_yy" id="funcEvenOddRowxx">
                         <td width="8%" class="DataGrid_Body_Cell"><a href="#" onclick="ShipmentOrReceipt('xx', 'yy');return false;" onmouseover="window.status='Incoming/Outgoing';return true;" onmouseout="window.status='';return true;" class="LabelLink" id="fieldId"> 
                           <span id="fieldDocumentNo">xx850000007</span></a></td>
                         <td width="8%" class="DataGrid_Body_Cell" id="fieldMovementdate">xxfd200</td>
@@ -555,6 +569,70 @@
                     </div>
                   </div>
                 </table>
+                <div style="height:25px;" />
+                <table cellspacing="0" cellpadding="0" width="100%" class="DataGrid_Header_Table DataGrid_Body_Table" style="table-layout: auto;" id="selEliminar6">
+                  <tr class="DataGrid_Body_Row"> 
+                    <th class="DataGrid_Header_Cell" colspan="14"><span>Return Material Receipt/Return to Vendor Shipment</span></th>
+                  </tr>
+                  <div id="sectionPartner6"> 
+                    <tr class="DataGrid_Body_Row"> 
+                      <th colspan="14" class="DataGrid_Header_Cell"><span>Customer<span>:&nbsp;</span><span id="fieldPartnername6">xxAguinaga</span></span></th>
+                    </tr>
+                    <tr class="DataGrid_Body_Row"> 
+                      <th width="8%" class="DataGrid_Header_Cell">Document No.</th>
+                      <th width="8%" class="DataGrid_Header_Cell">Date</th>
+                      <th width="12%" class="DataGrid_Header_Cell">Description</th>
+                      <th width="10%" class="DataGrid_Header_Cell">Attribute</th>
+                      <th width="16%" class="DataGrid_Header_Cell">Starting Warehouse</th>
+                      <th width="9%" class="DataGrid_Header_Cell" colspan="3">
+                        <table width="100%" border="0" cellspacing="0" cellpadding="0" style="background: none; border: 0px none">
+                          <tr class="DataGrid_Header_Cell">
+                            <th class="DataGrid_Header_Cell" width="100%" colspan="3" style="background: none; border: 0px none">Starting location</th>
+                          </tr>
+                          <tr class="DataGrid_Header_Cell">
+                            <th class="DataGrid_Header_Cell" width="34%" style="background: none; border: 0px none">X</th>
+                            <th class="DataGrid_Header_Cell" width="33%" style="background: none; border: 0px none">Y</th>
+                            <th class="DataGrid_Header_Cell" width="33%" style="background: none; border: 0px none">Z</th>
+                          </tr>
+                        </table>
+                      </th>
+                      <th width="16%" class="DataGrid_Header_Cell">Final Warehouse</th>
+                      <th width="9%" class="DataGrid_Header_Cell" colspan="3">
+                        <table width="100%" border="0" cellspacing="0" cellpadding="0" style="background: none; border: 0px none">
+                          <tr class="DataGrid_Header_Cell" style="background: none; border: 0px none">
+                            <th class="DataGrid_Header_Cell" width="100%" colspan="3" style="background: none; border: 0px none">Final location</th>
+                          </tr>
+                          <tr class="DataGrid_Header_Cell">
+                            <th class="DataGrid_Header_Cell" width="34%" style="background: none; border: 0px none">X</th>
+                            <th class="DataGrid_Header_Cell" width="33%" style="background: none; border: 0px none">Y</th>
+                            <th class="DataGrid_Header_Cell" width="33%" style="background: none; border: 0px none">Z</th>
+                          </tr>
+                        </table>
+                      </th>
+                      <th width="6%" class="DataGrid_Header_Cell">Exit</th>
+                      <th width="6%" class="DataGrid_Header_Cell">Quantity</th>
+                    </tr>
+                    <div id="sectionDetail6"> 
+                      <tr class="DataGrid_Body_Row DataGrid_Body_Row_yy" id="funcEvenOddRow6xx">
+                        <td width="8%" class="DataGrid_Body_Cell"><a href="#" onclick="openReturnDoc('xx', 'yy');return false;" onmouseover="window.status='Incoming/Outgoing';return true;" onmouseout="window.status='';return true;" class="LabelLink" id="fieldId6"> 
+                          <span id="fieldDocumentNo6">xx850000007</span></a></td>
+                        <td width="8%" class="DataGrid_Body_Cell" id="fieldMovementdate6">xxfd200</td>
+                        <td width="12%" class="DataGrid_Body_Cell" id="fieldName6">xx2345</td>
+                        <td width="10%" class="DataGrid_Body_Cell" id="fieldAttr6">xx2345</td>
+                        <td width="16%" class="DataGrid_Body_Cell" id="fieldWaOrigin6">xx3</td>
+                        <td width="3%"  class="DataGrid_Body_Cell" id="fieldXOrigin6">xx3</td>
+                        <td width="3%"  class="DataGrid_Body_Cell" id="fieldYOrigin6">xx3</td>
+                        <td width="3%"  class="DataGrid_Body_Cell" id="fieldZOrigin6">xx3</td>
+                        <td width="16%" class="DataGrid_Body_Cell" id="fieldWaDestiny6">xx2</td>
+                        <td width="3%"  class="DataGrid_Body_Cell" id="fieldXDestiny6">xx2</td>
+                        <td width="3%"  class="DataGrid_Body_Cell" id="fieldYDestiny6">xx2</td>
+                        <td width="3%"  class="DataGrid_Body_Cell" id="fieldZDestiny6">xx2</td>
+                        <td width="6%"  class="DataGrid_Body_Cell" id="fieldOut6">xxsi</td>
+                        <td width="6%" class="DataGrid_Body_Cell" id="fieldMovementqty6">xx23</td>
+                      </tr>
+                    </div>
+                  </div>
+                </table>
                 <div style="height:15px;" />
                 <table cellspacing="0" cellpadding="0" width="100%" class="DataGrid_Header_Table DataGrid_Body_Table" style="table-layout: auto;" id="selEliminar2">
                   <tr class="DataGrid_Body_Row">
--- a/src/org/openbravo/erpCommon/ad_reports/ReportProductMovement.java	Thu May 09 19:21:21 2013 +0200
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportProductMovement.java	Thu May 09 15:56:54 2013 +0200
@@ -54,6 +54,7 @@
       String strmAttributesetinstanceId = vars.getGlobalVariable("inpmAttributeSetInstanceId",
           "ReportProductMovement|M_AttributeSetInstance_Id", "");
       String strInout = vars.getGlobalVariable("inpInout", "ReportProductMovement|inout", "-1");
+      String strReturn = vars.getGlobalVariable("inpReturn", "ReportProductMovement|return", "-1");
       String strInventory = vars.getGlobalVariable("inpInventory",
           "ReportProductMovement|inventory", "-1");
       String strMovement = vars.getGlobalVariable("inpMovement", "ReportProductMovement|movement",
@@ -63,8 +64,8 @@
       String strInternalConsumption = vars.getGlobalVariable("inpInternalConsumption",
           "ReportProductMovement|internalConsumption", "-1");
       printPageDataSheet(response, vars, strDateFrom, strDateTo, strcBpartnerId, strmProductId,
-          strInout, strInventory, strMovement, strProduction, strmAttributesetinstanceId,
-          strInternalConsumption);
+          strInout, strReturn, strInventory, strMovement, strProduction,
+          strmAttributesetinstanceId, strInternalConsumption);
     } else if (vars.commandIn("DIRECT")) {
       String strDateFrom = vars.getGlobalVariable("inpDateFrom", "ReportProductMovement|dateFrom",
           "");
@@ -76,6 +77,7 @@
       String strmAttributesetinstanceId = vars.getGlobalVariable("inpmAttributeSetInstanceId",
           "ReportProductMovement|M_AttributeSetInstance_Id", "");
       String strInout = vars.getGlobalVariable("inpInout", "ReportProductMovement|inout", "");
+      String strReturn = vars.getGlobalVariable("inpReturn", "ReportProductMovement|return", "");
       String strInventory = vars.getGlobalVariable("inpInventory",
           "ReportProductMovement|inventory", "");
       String strMovement = vars.getGlobalVariable("inpMovement", "ReportProductMovement|movement",
@@ -86,8 +88,8 @@
           "ReportProductMovement|internalConsumption", "");
       setHistoryCommand(request, "DIRECT");
       printPageDataSheet(response, vars, strDateFrom, strDateTo, strcBpartnerId, strmProductId,
-          strInout, strInventory, strMovement, strProduction, strmAttributesetinstanceId,
-          strInternalConsumption);
+          strInout, strReturn, strInventory, strMovement, strProduction,
+          strmAttributesetinstanceId, strInternalConsumption);
     } else if (vars.commandIn("FIND")) {
       String strDateFrom = vars.getRequestGlobalVariable("inpDateFrom",
           "ReportProductMovement|dateFrom");
@@ -99,6 +101,7 @@
       String strmAttributesetinstanceId = vars.getRequestGlobalVariable(
           "inpmAttributeSetInstanceId", "ReportProductMovement|M_AttributeSetInstance_Id");
       String strInout = vars.getRequestGlobalVariable("inpInout", "ReportProductMovement|inout");
+      String strReturn = vars.getRequestGlobalVariable("inpReturn", "ReportProductMovement|return");
       String strInventory = vars.getRequestGlobalVariable("inpInventory",
           "ReportProductMovement|inventory");
       String strMovement = vars.getRequestGlobalVariable("inpMovement",
@@ -109,17 +112,17 @@
           "ReportProductMovement|internalConsumption");
       setHistoryCommand(request, "DIRECT");
       printPageDataSheet(response, vars, strDateFrom, strDateTo, strcBpartnerId, strmProductId,
-          strInout, strInventory, strMovement, strProduction, strmAttributesetinstanceId,
-          strInternalConsumption);
+          strInout, strReturn, strInventory, strMovement, strProduction,
+          strmAttributesetinstanceId, strInternalConsumption);
     } else
       pageError(response);
   }
 
   private void printPageDataSheet(HttpServletResponse response, VariablesSecureApp vars,
       String strDateFrom, String strDateTo, String strcBpartnerId, String strmProductId,
-      String strInout, String strInventory, String strMovement, String strProduction,
-      String strmAttributesetinstanceId, String strInternalConsumption) throws IOException,
-      ServletException {
+      String strInout, String strReturn, String strInventory, String strMovement,
+      String strProduction, String strmAttributesetinstanceId, String strInternalConsumption)
+      throws IOException, ServletException {
     if (log4j.isDebugEnabled())
       log4j.debug("Output: dataSheet");
     response.setContentType("text/html; charset=UTF-8");
@@ -130,7 +133,8 @@
     ReportProductMovementData[] data2 = null;
     ReportProductMovementData[] data3 = null;
     ReportProductMovementData[] data4 = null;
-    String discard[] = { "discard", "discard", "discard", "discard", "discard" };
+    ReportProductMovementData[] data5 = null;
+    String discard[] = { "discard", "discard", "discard", "discard", "discard", "discard" };
     if (strDateFrom.equals("") && strDateTo.equals("")) {
       strDateTo = DateTimeData.today(this);
       strDateFrom = DateTimeData.weekBefore(this);
@@ -141,7 +145,7 @@
             Utility.getContext(this, vars, "#User_Client", "ReportProductMovement"),
             Utility.getContext(this, vars, "#AccessibleOrgTree", "ReportProductMovement"),
             strDateFrom, DateTimeData.nDaysAfter(this, strDateTo, "1"), strcBpartnerId,
-            strmProductId, strmAttributesetinstanceId);
+            strmProductId, strmAttributesetinstanceId, "N");
         if (data == null || data.length == 0) {
           discard[0] = "selEliminar1";
           data = ReportProductMovementData.set();
@@ -150,6 +154,22 @@
         discard[0] = "selEliminar1";
         data = ReportProductMovementData.set();
       }
+
+      if (strReturn.equals("-1")) {
+        data5 = ReportProductMovementData.select(this, vars.getLanguage(),
+            Utility.getContext(this, vars, "#User_Client", "ReportProductMovement"),
+            Utility.getContext(this, vars, "#AccessibleOrgTree", "ReportProductMovement"),
+            strDateFrom, DateTimeData.nDaysAfter(this, strDateTo, "1"), strcBpartnerId,
+            strmProductId, strmAttributesetinstanceId, "Y");
+        if (data5 == null || data5.length == 0) {
+          discard[5] = "selEliminar6";
+          data5 = ReportProductMovementData.set();
+        }
+      } else {
+        discard[5] = "selEliminar6";
+        data5 = ReportProductMovementData.set();
+      }
+
       if (strInventory.equals("-1")) {
         data1 = ReportProductMovementData.selectInventory(this,
             Utility.getContext(this, vars, "#User_Client", "ReportProductMovement"),
@@ -212,11 +232,13 @@
       discard[2] = "selEliminar3";
       discard[3] = "selEliminar4";
       discard[4] = "selEliminar5";
+      discard[5] = "selEliminar6";
       data = ReportProductMovementData.set();
       data1 = ReportProductMovementData.set();
       data2 = ReportProductMovementData.set();
       data3 = ReportProductMovementData.set();
       data4 = ReportProductMovementData.set();
+      data5 = ReportProductMovementData.set();
     }
     xmlDocument = xmlEngine.readXmlTemplate(
         "org/openbravo/erpCommon/ad_reports/ReportProductMovement", discard).createXmlDocument();
@@ -277,6 +299,7 @@
     xmlDocument.setParameter("productDescription",
         ReportProductMovementData.selectMproduct(this, strmProductId));
     xmlDocument.setParameter("inout", strInout);
+    xmlDocument.setParameter("return", strReturn);
     xmlDocument.setParameter("inventory", strInventory);
     xmlDocument.setParameter("movement", strMovement);
     xmlDocument.setParameter("production", strProduction);
@@ -286,6 +309,7 @@
     xmlDocument.setData("structure3", data2);
     xmlDocument.setData("structure4", data3);
     xmlDocument.setData("structure5", data4);
+    xmlDocument.setData("structure6", data5);
 
     out.println(xmlDocument.print());
     out.close();
--- a/src/org/openbravo/erpCommon/ad_reports/ReportProductMovement.xml	Thu May 09 19:21:21 2013 +0200
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportProductMovement.xml	Thu May 09 15:56:54 2013 +0200
@@ -36,6 +36,8 @@
   <PARAMETER id="paramProductDescription" name="productDescription" attribute="value"/>
   <PARAMETER id="parameterInOut" name="constantInout" default="-1"/>
   <PARAMETER id="paramInOut" name="inout" boolean="checked" withId="parameterInOut"/>
+  <PARAMETER id="parameterReturn" name="constantReturn" default="-1"/>
+  <PARAMETER id="paramReturn" name="return" boolean="checked" withId="parameterReturn"/>
   <PARAMETER id="parameterInventory" name="constantInventory" default="-1"/>
   <PARAMETER id="paramInventory" name="inventory" boolean="checked" withId="parameterInventory"/>
   <PARAMETER id="parameterMovement" name="constantMovement" default="-1"/>
@@ -162,4 +164,27 @@
     <SECTION id="sectionPartner4" field="partnername"/>
     <SECTION id="sectionDetail4"/>
   </structure>
+  <structure name="structure6">
+    <FIELD id="fieldRownum6">rownum</FIELD>
+    <FUNCTION id="funcEvenOddRow6xx" name="MODULE" arg1="fieldRownum6" arg2="param2" format="integerEdition" attribute="class" replace="yy"/>
+    <FIELD id="fieldId6" attribute="onclick" replace="xx">mInoutId</FIELD>
+    <FIELD id="fieldId6" attribute="onclick" replace="yy">issotrx</FIELD>
+    <FIELD id="fieldDocumentNo6">documentno</FIELD>
+    <FIELD id="fieldName6">name</FIELD>
+    <FIELD id="fieldAttr6">attr</FIELD>
+    <FIELD id="fieldPartnername6">partnername</FIELD>
+    <FIELD id="fieldMovementdate6">movementdate</FIELD>
+    <FIELD id="fieldMovementqty6">movementqty</FIELD>
+    <FIELD id="fieldXOrigin6">xOrigin</FIELD>
+    <FIELD id="fieldYOrigin6">yOrigin</FIELD>
+    <FIELD id="fieldZOrigin6">zOrigin</FIELD>
+    <FIELD id="fieldWaOrigin6">waOrigin</FIELD>
+    <FIELD id="fieldXDestiny6">xDestiny</FIELD>
+    <FIELD id="fieldYDestiny6">yDestiny</FIELD>
+    <FIELD id="fieldZDestiny6">zDestiny</FIELD>
+    <FIELD id="fieldWaDestiny6">waDestiny</FIELD>
+    <FIELD id="fieldOut6">out</FIELD>
+    <SECTION id="sectionPartner6" field="partnername"/>
+    <SECTION id="sectionDetail6"/>
+  </structure>
 </REPORT>
--- a/src/org/openbravo/erpCommon/ad_reports/ReportProductMovement_data.xsql	Thu May 09 19:21:21 2013 +0200
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportProductMovement_data.xsql	Thu May 09 15:56:54 2013 +0200
@@ -43,7 +43,8 @@
       '' AS M_INVENTORY_ID, '' AS M_MOVEMENT_ID, '' AS M_PRODUCTIONPLAN_ID, '' AS PRODUCTION_PLAN, '' AS M_INTERNAL_CONSUMPTION_ID
       FROM M_PRODUCT right join M_TRANSACTION on M_TRANSACTION.M_PRODUCT_ID = M_PRODUCT.M_PRODUCT_ID
                      left join M_ATTRIBUTESETINSTANCE ON M_ATTRIBUTESETINSTANCE.M_ATTRIBUTESETINSTANCE_ID=M_TRANSACTION.M_ATTRIBUTESETINSTANCE_ID,
-           M_INOUT left join C_BPARTNER on M_INOUT.C_BPARTNER_ID=C_BPARTNER.C_BPARTNER_ID, 
+           M_INOUT left join C_BPARTNER on M_INOUT.C_BPARTNER_ID=C_BPARTNER.C_BPARTNER_ID
+           left join C_DOCTYPE on M_INOUT.C_DOCTYPE_ID = C_DOCTYPE.C_DOCTYPE_ID, 
            M_LOCATOR, M_INOUTLINE, C_UOM, M_WAREHOUSE
       WHERE M_TRANSACTION.M_LOCATOR_ID = M_LOCATOR.M_LOCATOR_ID
       AND M_TRANSACTION.M_INOUTLINE_ID = M_INOUTLINE.M_INOUTLINE_ID
@@ -68,6 +69,7 @@
     <Parameter name="cBpartner" optional="true" after="AND 1=1"><![CDATA[ AND C_BPARTNER.C_BPARTNER_ID = ?]]></Parameter>
     <Parameter name="mProductId" optional="true" after="AND 1=1"><![CDATA[ AND M_PRODUCT.M_PRODUCT_ID = ?]]></Parameter>
     <Parameter name="parmAttributeSetInstanceId" optional="true" after="AND 1=1"><![CDATA[AND M_TRANSACTION.M_ATTRIBUTESETINSTANCE_ID = ?]]></Parameter>
+    <Parameter name="isReturn" optional="true" after="AND 1=1"><![CDATA[AND C_DOCTYPE.ISRETURN = ?]]></Parameter>
   </SqlMethod>
 
   <SqlMethod name="selectInventory" type="preparedStatement" return="multiple">