[Reservations]Add callout for SO Lines.
authorGorka Ion Damián <gorkaion.damian@openbravo.com>
Mon, 01 Oct 2012 17:17:40 +0200
changeset 18631 7ca6c9122244
parent 18630 cd60e9de423e
child 18632 d9106bc62ff6
[Reservations]Add callout for SO Lines.
src-db/database/sourcedata/AD_CALLOUT.xml
src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/sourcedata/AD_MODEL_OBJECT.xml
src-db/database/sourcedata/AD_MODEL_OBJECT_MAPPING.xml
src/org/openbravo/erpCommon/ad_callouts/SL_Reservation.java
--- a/src-db/database/sourcedata/AD_CALLOUT.xml	Mon Oct 01 17:13:20 2012 +0200
+++ b/src-db/database/sourcedata/AD_CALLOUT.xml	Mon Oct 01 17:17:40 2012 +0200
@@ -741,6 +741,15 @@
 <!--20FE1F365075451E95AE901650183CC7-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--20FE1F365075451E95AE901650183CC7--></AD_CALLOUT>
 
+<!--2ABC4DCF576144CE8B43E23949262AF3--><AD_CALLOUT>
+<!--2ABC4DCF576144CE8B43E23949262AF3-->  <AD_CALLOUT_ID><![CDATA[2ABC4DCF576144CE8B43E23949262AF3]]></AD_CALLOUT_ID>
+<!--2ABC4DCF576144CE8B43E23949262AF3-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--2ABC4DCF576144CE8B43E23949262AF3-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--2ABC4DCF576144CE8B43E23949262AF3-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--2ABC4DCF576144CE8B43E23949262AF3-->  <NAME><![CDATA[SL_Reservation]]></NAME>
+<!--2ABC4DCF576144CE8B43E23949262AF3-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--2ABC4DCF576144CE8B43E23949262AF3--></AD_CALLOUT>
+
 <!--30F26E853A7241C394D67F910A87F3EF--><AD_CALLOUT>
 <!--30F26E853A7241C394D67F910A87F3EF-->  <AD_CALLOUT_ID><![CDATA[30F26E853A7241C394D67F910A87F3EF]]></AD_CALLOUT_ID>
 <!--30F26E853A7241C394D67F910A87F3EF-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Mon Oct 01 17:13:20 2012 +0200
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Mon Oct 01 17:17:40 2012 +0200
@@ -290269,6 +290269,7 @@
 <!--CA9E531DC5CFEB11E040007F0100672C-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
 <!--CA9E531DC5CFEB11E040007F0100672C-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
 <!--CA9E531DC5CFEB11E040007F0100672C-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CA9E531DC5CFEB11E040007F0100672C-->  <AD_CALLOUT_ID><![CDATA[2ABC4DCF576144CE8B43E23949262AF3]]></AD_CALLOUT_ID>
 <!--CA9E531DC5CFEB11E040007F0100672C-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--CA9E531DC5CFEB11E040007F0100672C-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--CA9E531DC5CFEB11E040007F0100672C-->  <POSITION><![CDATA[13]]></POSITION>
--- a/src-db/database/sourcedata/AD_MODEL_OBJECT.xml	Mon Oct 01 17:13:20 2012 +0200
+++ b/src-db/database/sourcedata/AD_MODEL_OBJECT.xml	Mon Oct 01 17:17:40 2012 +0200
@@ -4148,6 +4148,18 @@
 <!--CA84D1D58D6D4C5495F9FDE7549336E4-->  <OBJECT_TYPE><![CDATA[S]]></OBJECT_TYPE>
 <!--CA84D1D58D6D4C5495F9FDE7549336E4--></AD_MODEL_OBJECT>
 
+<!--CB0093CB5B33AA24E040007F010049A5--><AD_MODEL_OBJECT>
+<!--CB0093CB5B33AA24E040007F010049A5-->  <AD_MODEL_OBJECT_ID><![CDATA[CB0093CB5B33AA24E040007F010049A5]]></AD_MODEL_OBJECT_ID>
+<!--CB0093CB5B33AA24E040007F010049A5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB0093CB5B33AA24E040007F010049A5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB0093CB5B33AA24E040007F010049A5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB0093CB5B33AA24E040007F010049A5-->  <ACTION><![CDATA[C]]></ACTION>
+<!--CB0093CB5B33AA24E040007F010049A5-->  <CLASSNAME><![CDATA[org.openbravo.erpCommon.ad_callouts.SL_Reservation]]></CLASSNAME>
+<!--CB0093CB5B33AA24E040007F010049A5-->  <ISDEFAULT><![CDATA[Y]]></ISDEFAULT>
+<!--CB0093CB5B33AA24E040007F010049A5-->  <AD_CALLOUT_ID><![CDATA[2ABC4DCF576144CE8B43E23949262AF3]]></AD_CALLOUT_ID>
+<!--CB0093CB5B33AA24E040007F010049A5-->  <OBJECT_TYPE><![CDATA[S]]></OBJECT_TYPE>
+<!--CB0093CB5B33AA24E040007F010049A5--></AD_MODEL_OBJECT>
+
 <!--CBD971929B504D11A3164B58D8C69CBE--><AD_MODEL_OBJECT>
 <!--CBD971929B504D11A3164B58D8C69CBE-->  <AD_MODEL_OBJECT_ID><![CDATA[CBD971929B504D11A3164B58D8C69CBE]]></AD_MODEL_OBJECT_ID>
 <!--CBD971929B504D11A3164B58D8C69CBE-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_MODEL_OBJECT_MAPPING.xml	Mon Oct 01 17:13:20 2012 +0200
+++ b/src-db/database/sourcedata/AD_MODEL_OBJECT_MAPPING.xml	Mon Oct 01 17:17:40 2012 +0200
@@ -4370,6 +4370,16 @@
 <!--CA9DD61616584938849A97BBFBA87D60-->  <ISDEFAULT><![CDATA[Y]]></ISDEFAULT>
 <!--CA9DD61616584938849A97BBFBA87D60--></AD_MODEL_OBJECT_MAPPING>
 
+<!--CB0093CB5B34AA24E040007F010049A5--><AD_MODEL_OBJECT_MAPPING>
+<!--CB0093CB5B34AA24E040007F010049A5-->  <AD_MODEL_OBJECT_MAPPING_ID><![CDATA[CB0093CB5B34AA24E040007F010049A5]]></AD_MODEL_OBJECT_MAPPING_ID>
+<!--CB0093CB5B34AA24E040007F010049A5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB0093CB5B34AA24E040007F010049A5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB0093CB5B34AA24E040007F010049A5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB0093CB5B34AA24E040007F010049A5-->  <AD_MODEL_OBJECT_ID><![CDATA[CB0093CB5B33AA24E040007F010049A5]]></AD_MODEL_OBJECT_ID>
+<!--CB0093CB5B34AA24E040007F010049A5-->  <MAPPINGNAME><![CDATA[/ad_callouts/SL_Reservation.html]]></MAPPINGNAME>
+<!--CB0093CB5B34AA24E040007F010049A5-->  <ISDEFAULT><![CDATA[Y]]></ISDEFAULT>
+<!--CB0093CB5B34AA24E040007F010049A5--></AD_MODEL_OBJECT_MAPPING>
+
 <!--D018FD05F805446099A9DE17D02C8AAE--><AD_MODEL_OBJECT_MAPPING>
 <!--D018FD05F805446099A9DE17D02C8AAE-->  <AD_MODEL_OBJECT_MAPPING_ID><![CDATA[D018FD05F805446099A9DE17D02C8AAE]]></AD_MODEL_OBJECT_MAPPING_ID>
 <!--D018FD05F805446099A9DE17D02C8AAE-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/erpCommon/ad_callouts/SL_Reservation.java	Mon Oct 01 17:17:40 2012 +0200
@@ -0,0 +1,31 @@
+package org.openbravo.erpCommon.ad_callouts;
+
+import javax.servlet.ServletException;
+
+import org.openbravo.base.filter.IsIDFilter;
+import org.openbravo.dal.core.DalUtil;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.model.common.order.OrderLine;
+
+public class SL_Reservation extends SimpleCallout {
+
+  private static final long serialVersionUID = 1L;
+
+  @Override
+  protected void execute(CalloutInfo info) throws ServletException {
+    String lastChanged = info.getLastFieldChanged();
+
+    if ("inpcOrderlineId".equals(lastChanged)) {
+      final String strSalesOrderLineId = info.getStringParameter("inpcOrderlineId",
+          IsIDFilter.instance);
+      if (!"".equals(strSalesOrderLineId)) {
+        final OrderLine soLine = OBDal.getInstance().get(OrderLine.class, strSalesOrderLineId);
+        info.addResult("inpquantity", soLine.getOrderedQuantity());
+        info.addResult("inppendingqty",
+            soLine.getOrderedQuantity().subtract(soLine.getDeliveredQuantity()));
+        info.addResult("inpmProductId", (String) DalUtil.getId(soLine.getProduct()));
+      }
+    }
+  }
+
+}