[Production-Development] Final Requests - New PPlanDate and restrictions
authorrafaeldemiguel <rdm@openbravo.com>
Wed, 05 Oct 2011 12:11:55 +0200
changeset 14995 c6a3cbc06c65
parent 14994 081881603f57
child 14996 3dcb2ad96674
[Production-Development] Final Requests - New PPlanDate and restrictions
src-db/database/model/tables/M_PRODUCTIONPLAN.xml
src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/sourcedata/AD_ELEMENT.xml
src-db/database/sourcedata/AD_FIELD.xml
src-db/database/sourcedata/AD_MESSAGE.xml
src/org/openbravo/erpCommon/ad_actionButton/CreateWorkEffort.java
src/org/openbravo/erpCommon/ad_actionButton/ValidateWorkEffort_ProductionRun.java
--- a/src-db/database/model/tables/M_PRODUCTIONPLAN.xml	Wed Oct 05 10:47:08 2011 +0200
+++ b/src-db/database/model/tables/M_PRODUCTIONPLAN.xml	Wed Oct 05 12:11:55 2011 +0200
@@ -133,6 +133,10 @@
         <default/>
         <onCreateDefault/>
       </column>
+      <column name="PRODUCTIONPLANDATE" primaryKey="false" required="false" type="TIMESTAMP" size="7" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
       <foreign-key foreignTable="AD_CLIENT" name="M_PRODUCTIONPLAN_AD_CLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Wed Oct 05 10:47:08 2011 +0200
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Wed Oct 05 12:11:55 2011 +0200
@@ -215159,6 +215159,37 @@
 <!--5395A0F40CD24B91A64BF7DC1FC6C202-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
 <!--5395A0F40CD24B91A64BF7DC1FC6C202--></AD_COLUMN>
 
+<!--539C4E45B3FB477BAD74E46CD96F6B33--><AD_COLUMN>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <AD_COLUMN_ID><![CDATA[539C4E45B3FB477BAD74E46CD96F6B33]]></AD_COLUMN_ID>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <NAME><![CDATA[Productionplandate]]></NAME>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <COLUMNNAME><![CDATA[Productionplandate]]></COLUMNNAME>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <AD_TABLE_ID><![CDATA[385]]></AD_TABLE_ID>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <AD_REFERENCE_ID><![CDATA[15]]></AD_REFERENCE_ID>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <FIELDLENGTH><![CDATA[19]]></FIELDLENGTH>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <SEQNO><![CDATA[242]]></SEQNO>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <AD_ELEMENT_ID><![CDATA[0FF8F04EC4204CA3AC8F003F38C0502A]]></AD_ELEMENT_ID>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <POSITION><![CDATA[36]]></POSITION>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--539C4E45B3FB477BAD74E46CD96F6B33-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--539C4E45B3FB477BAD74E46CD96F6B33--></AD_COLUMN>
+
 <!--540860DC16E345E7BC90EA6D0FEDDEA3--><AD_COLUMN>
 <!--540860DC16E345E7BC90EA6D0FEDDEA3-->  <AD_COLUMN_ID><![CDATA[540860DC16E345E7BC90EA6D0FEDDEA3]]></AD_COLUMN_ID>
 <!--540860DC16E345E7BC90EA6D0FEDDEA3-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_ELEMENT.xml	Wed Oct 05 10:47:08 2011 +0200
+++ b/src-db/database/sourcedata/AD_ELEMENT.xml	Wed Oct 05 12:11:55 2011 +0200
@@ -19245,6 +19245,17 @@
 <!--0DCA4840773E45198061B6F1E5F22841-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--0DCA4840773E45198061B6F1E5F22841--></AD_ELEMENT>
 
+<!--0FF8F04EC4204CA3AC8F003F38C0502A--><AD_ELEMENT>
+<!--0FF8F04EC4204CA3AC8F003F38C0502A-->  <AD_ELEMENT_ID><![CDATA[0FF8F04EC4204CA3AC8F003F38C0502A]]></AD_ELEMENT_ID>
+<!--0FF8F04EC4204CA3AC8F003F38C0502A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--0FF8F04EC4204CA3AC8F003F38C0502A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--0FF8F04EC4204CA3AC8F003F38C0502A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--0FF8F04EC4204CA3AC8F003F38C0502A-->  <COLUMNNAME><![CDATA[Productionplandate]]></COLUMNNAME>
+<!--0FF8F04EC4204CA3AC8F003F38C0502A-->  <NAME><![CDATA[Movement Date]]></NAME>
+<!--0FF8F04EC4204CA3AC8F003F38C0502A-->  <PRINTNAME><![CDATA[Movement Date]]></PRINTNAME>
+<!--0FF8F04EC4204CA3AC8F003F38C0502A-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--0FF8F04EC4204CA3AC8F003F38C0502A--></AD_ELEMENT>
+
 <!--11C2BC5D35EE4A098C6C99FE71F06590--><AD_ELEMENT>
 <!--11C2BC5D35EE4A098C6C99FE71F06590-->  <AD_ELEMENT_ID><![CDATA[11C2BC5D35EE4A098C6C99FE71F06590]]></AD_ELEMENT_ID>
 <!--11C2BC5D35EE4A098C6C99FE71F06590-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_FIELD.xml	Wed Oct 05 10:47:08 2011 +0200
+++ b/src-db/database/sourcedata/AD_FIELD.xml	Wed Oct 05 12:11:55 2011 +0200
@@ -185593,6 +185593,31 @@
 <!--845FD2B3462D4B84838E1392D7575895-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
 <!--845FD2B3462D4B84838E1392D7575895--></AD_FIELD>
 
+<!--84657947D4434EC0AA0495E58F3B8DCF--><AD_FIELD>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <AD_FIELD_ID><![CDATA[84657947D4434EC0AA0495E58F3B8DCF]]></AD_FIELD_ID>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <NAME><![CDATA[Productionplandate]]></NAME>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <AD_TAB_ID><![CDATA[C9B5394DBA8C465C9CE26A361696B06E]]></AD_TAB_ID>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <AD_COLUMN_ID><![CDATA[539C4E45B3FB477BAD74E46CD96F6B33]]></AD_COLUMN_ID>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <DISPLAYLENGTH><![CDATA[19]]></DISPLAYLENGTH>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <SEQNO><![CDATA[7]]></SEQNO>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <GRID_SEQNO><![CDATA[7]]></GRID_SEQNO>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--84657947D4434EC0AA0495E58F3B8DCF-->  <ISSHOWNINSTATUSBAR><![CDATA[Y]]></ISSHOWNINSTATUSBAR>
+<!--84657947D4434EC0AA0495E58F3B8DCF--></AD_FIELD>
+
 <!--8467FF65B3154C9183A9250E5B203B4E--><AD_FIELD>
 <!--8467FF65B3154C9183A9250E5B203B4E-->  <AD_FIELD_ID><![CDATA[8467FF65B3154C9183A9250E5B203B4E]]></AD_FIELD_ID>
 <!--8467FF65B3154C9183A9250E5B203B4E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Wed Oct 05 10:47:08 2011 +0200
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Wed Oct 05 12:11:55 2011 +0200
@@ -19786,4 +19786,15 @@
 <!--FF80818132B961A80132BADA86CF002B-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--FF80818132B961A80132BADA86CF002B--></AD_MESSAGE>
 
+<!--FF80818132D366EC0132D36ECD99000D--><AD_MESSAGE>
+<!--FF80818132D366EC0132D36ECD99000D-->  <AD_MESSAGE_ID><![CDATA[FF80818132D366EC0132D36ECD99000D]]></AD_MESSAGE_ID>
+<!--FF80818132D366EC0132D36ECD99000D-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FF80818132D366EC0132D36ECD99000D-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FF80818132D366EC0132D36ECD99000D-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FF80818132D366EC0132D36ECD99000D-->  <VALUE><![CDATA[MoreThanOneProductionPlanError]]></VALUE>
+<!--FF80818132D366EC0132D36ECD99000D-->  <MSGTEXT><![CDATA[Only Work Effort with one Production Run can be validated from this window. In case you want validate a Work Effort with many Production Run you should go to Work Effort window.]]></MSGTEXT>
+<!--FF80818132D366EC0132D36ECD99000D-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--FF80818132D366EC0132D36ECD99000D-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--FF80818132D366EC0132D36ECD99000D--></AD_MESSAGE>
+
 </data>
--- a/src/org/openbravo/erpCommon/ad_actionButton/CreateWorkEffort.java	Wed Oct 05 10:47:08 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_actionButton/CreateWorkEffort.java	Wed Oct 05 12:11:55 2011 +0200
@@ -82,7 +82,6 @@
       workReqOpCriteria.add(Restrictions.eq(WorkRequirementOperation.PROPERTY_WORKREQUIREMENT,
           workReq));
       workReqOpCriteria.add(Restrictions.le(WorkRequirementOperation.PROPERTY_STARTINGDATE, date));
-      workReqOpCriteria.add(Restrictions.ge(WorkRequirementOperation.PROPERTY_ENDINGDATE, date));
       workReqOpCriteria.add(Restrictions.eq(WorkRequirementOperation.PROPERTY_CLOSED, false));
       workReqOpCriteria.addOrderBy(WorkRequirementOperation.PROPERTY_SEQUENCENUMBER, true);
 
@@ -127,6 +126,7 @@
           // Only one line per ProductionTransaction
           productionPlan.setLineNo(10L);
           productionPlan.setWRPhase(wrOp);
+          productionPlan.setProductionplandate(date);
 
           productionPlan.setRunTime(0L);
           productionPlan.setClosephase(false);
--- a/src/org/openbravo/erpCommon/ad_actionButton/ValidateWorkEffort_ProductionRun.java	Wed Oct 05 10:47:08 2011 +0200
+++ b/src/org/openbravo/erpCommon/ad_actionButton/ValidateWorkEffort_ProductionRun.java	Wed Oct 05 12:11:55 2011 +0200
@@ -51,6 +51,16 @@
           strMProductionPlanID);
       ProductionTransaction production = productionPlan.getProduction();
 
+      if (production.getMaterialMgmtProductionPlanList().size() > 1)
+        throw new OBException(Utility.messageBD(conn, "MoreThanOneProductionPlanError", bundle
+            .getContext().getLanguage()));
+
+      if (productionPlan.getProductionplandate() != null) {
+        production.setMovementDate(productionPlan.getProductionplandate());
+        OBDal.getInstance().save(production);
+        OBDal.getInstance().flush();
+      }
+
       validateWorkEffort(production, conn, bundle.getContext().toVars());
       OBDal.getInstance().save(production);
       OBDal.getInstance().flush();