Related to issue 21415 Ability to define a write-off limit
authorSandra Huguet <sandra.huguet@openbravo.com>
Fri, 14 Sep 2012 13:52:11 +0200
changeset 17960 1922c7ff8ac1
parent 17959 f7657cc77788
child 17961 df5204939921
Related to issue 21415 Ability to define a write-off limit
Ability to define a write-off limit by amount per financial account
Commit Payment Proposal
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MESSAGE.xml
modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-utilities.js
src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/sourcedata/AD_ELEMENT.xml
src-db/database/sourcedata/AD_FIELD.xml
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml	Fri Sep 14 20:14:05 2012 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml	Fri Sep 14 13:52:11 2012 +0200
@@ -13009,6 +13009,7 @@
 <!--BC1D6E2C80084926A4C0C50D50231568-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
 <!--BC1D6E2C80084926A4C0C50D50231568-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
 <!--BC1D6E2C80084926A4C0C50D50231568-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--BC1D6E2C80084926A4C0C50D50231568-->  <EM_OBUIAPP_VALIDATOR><![CDATA[OB.APRM.validatePaymentProposalPickAndEdit]]></EM_OBUIAPP_VALIDATOR>
 <!--BC1D6E2C80084926A4C0C50D50231568-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--BC1D6E2C80084926A4C0C50D50231568--></AD_FIELD>
 
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MESSAGE.xml	Fri Sep 14 20:14:05 2012 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MESSAGE.xml	Fri Sep 14 13:52:11 2012 +0200
@@ -231,6 +231,17 @@
 <!--49C16126D1A141C398175B0632C08F95-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
 <!--49C16126D1A141C398175B0632C08F95--></AD_MESSAGE>
 
+<!--4EA449F1999B4B01B02840DC7AF832D9--><AD_MESSAGE>
+<!--4EA449F1999B4B01B02840DC7AF832D9-->  <AD_MESSAGE_ID><![CDATA[4EA449F1999B4B01B02840DC7AF832D9]]></AD_MESSAGE_ID>
+<!--4EA449F1999B4B01B02840DC7AF832D9-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--4EA449F1999B4B01B02840DC7AF832D9-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--4EA449F1999B4B01B02840DC7AF832D9-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--4EA449F1999B4B01B02840DC7AF832D9-->  <VALUE><![CDATA[APRM_NotAllowWriteOff]]></VALUE>
+<!--4EA449F1999B4B01B02840DC7AF832D9-->  <MSGTEXT><![CDATA[This action is not allowed, write off limit exceeded]]></MSGTEXT>
+<!--4EA449F1999B4B01B02840DC7AF832D9-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--4EA449F1999B4B01B02840DC7AF832D9-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--4EA449F1999B4B01B02840DC7AF832D9--></AD_MESSAGE>
+
 <!--53ED8846C7984389AF83AC1DE983859E--><AD_MESSAGE>
 <!--53ED8846C7984389AF83AC1DE983859E-->  <AD_MESSAGE_ID><![CDATA[53ED8846C7984389AF83AC1DE983859E]]></AD_MESSAGE_ID>
 <!--53ED8846C7984389AF83AC1DE983859E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-utilities.js	Fri Sep 14 20:14:05 2012 +0200
+++ b/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-utilities.js	Fri Sep 14 13:52:11 2012 +0200
@@ -129,11 +129,21 @@
       break;
     }
   }
+  var contextInfo = null;
+  contextInfo = item.grid.view.parentWindow.activeView.getContextInfo(false, true, true, true);
 
   // When possible to capture on change event, move this code to another method
   if (row) {
     row.difference = Number(outstanding.subtract(paidamount));
     row.payment = Number(record.payment);
+    if (contextInfo.inplimitwriteoff !== "") {
+      var differencewriteoff = OB.Utilities.Number.JSToOBMasked((row.difference * contextInfo.inpfinaccTxnConvertRate), OB.Format.defaultNumericMask, OB.Format.defaultDecimalSymbol, OB.Format.defaultGroupingSymbol, OB.Format.defaultGroupingSize);
+      if (differencewriteoff > contextInfo.inplimitwriteoff && record.writeoff === true) {
+        isc.warn(OB.I18N.getLabel('APRM_NotAllowWriteOff'));
+        return false;
+      }
+    }
+
   } else {
     return false;
   }
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Fri Sep 14 20:14:05 2012 +0200
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Fri Sep 14 13:52:11 2012 +0200
@@ -220998,6 +220998,40 @@
 <!--0BD260C46B9547BDB318DEBBDAB70536-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
 <!--0BD260C46B9547BDB318DEBBDAB70536--></AD_COLUMN>
 
+<!--0C6CC9768B5144EBB4827B9B98976816--><AD_COLUMN>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <AD_COLUMN_ID><![CDATA[0C6CC9768B5144EBB4827B9B98976816]]></AD_COLUMN_ID>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <NAME><![CDATA[limitwriteoff]]></NAME>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <COLUMNNAME><![CDATA[limitwriteoff]]></COLUMNNAME>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <AD_TABLE_ID><![CDATA[B9437A72163445C59A0A585209C8ECE5]]></AD_TABLE_ID>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <AD_REFERENCE_ID><![CDATA[22]]></AD_REFERENCE_ID>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <FIELDLENGTH><![CDATA[6]]></FIELDLENGTH>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <SEQNO><![CDATA[310]]></SEQNO>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <AD_ELEMENT_ID><![CDATA[DDC19F22CF8A4A2696B5E74F980BE277]]></AD_ELEMENT_ID>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--0C6CC9768B5144EBB4827B9B98976816-->  <SQLLOGIC><![CDATA[(select ff.writeofflimit  from fin_financial_account ff where ff.fin_financial_account_id=fin_financial_account_id)
+]]></SQLLOGIC>
+<!--0C6CC9768B5144EBB4827B9B98976816--></AD_COLUMN>
+
 <!--0CC9E53ACEFA4F678C718071C423E931--><AD_COLUMN>
 <!--0CC9E53ACEFA4F678C718071C423E931-->  <AD_COLUMN_ID><![CDATA[0CC9E53ACEFA4F678C718071C423E931]]></AD_COLUMN_ID>
 <!--0CC9E53ACEFA4F678C718071C423E931-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_ELEMENT.xml	Fri Sep 14 20:14:05 2012 +0200
+++ b/src-db/database/sourcedata/AD_ELEMENT.xml	Fri Sep 14 13:52:11 2012 +0200
@@ -29051,6 +29051,18 @@
 <!--DBB02A64470D4093A2534F0DFC8BF855-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--DBB02A64470D4093A2534F0DFC8BF855--></AD_ELEMENT>
 
+<!--DDC19F22CF8A4A2696B5E74F980BE277--><AD_ELEMENT>
+<!--DDC19F22CF8A4A2696B5E74F980BE277-->  <AD_ELEMENT_ID><![CDATA[DDC19F22CF8A4A2696B5E74F980BE277]]></AD_ELEMENT_ID>
+<!--DDC19F22CF8A4A2696B5E74F980BE277-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--DDC19F22CF8A4A2696B5E74F980BE277-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--DDC19F22CF8A4A2696B5E74F980BE277-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--DDC19F22CF8A4A2696B5E74F980BE277-->  <COLUMNNAME><![CDATA[limitwriteoff]]></COLUMNNAME>
+<!--DDC19F22CF8A4A2696B5E74F980BE277-->  <NAME><![CDATA[limitwriteoff]]></NAME>
+<!--DDC19F22CF8A4A2696B5E74F980BE277-->  <PRINTNAME><![CDATA[limitwriteoff]]></PRINTNAME>
+<!--DDC19F22CF8A4A2696B5E74F980BE277-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--DDC19F22CF8A4A2696B5E74F980BE277-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--DDC19F22CF8A4A2696B5E74F980BE277--></AD_ELEMENT>
+
 <!--DF31EE4F8B28472089DC155324337471--><AD_ELEMENT>
 <!--DF31EE4F8B28472089DC155324337471-->  <AD_ELEMENT_ID><![CDATA[DF31EE4F8B28472089DC155324337471]]></AD_ELEMENT_ID>
 <!--DF31EE4F8B28472089DC155324337471-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_FIELD.xml	Fri Sep 14 20:14:05 2012 +0200
+++ b/src-db/database/sourcedata/AD_FIELD.xml	Fri Sep 14 13:52:11 2012 +0200
@@ -229128,6 +229128,33 @@
 <!--C424D68ACE9C4A90A5037D81633A0E9E-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--C424D68ACE9C4A90A5037D81633A0E9E--></AD_FIELD>
 
+<!--C457484FCDED46E3A12F73B51E1D52E3--><AD_FIELD>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <AD_FIELD_ID><![CDATA[C457484FCDED46E3A12F73B51E1D52E3]]></AD_FIELD_ID>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <NAME><![CDATA[limitwriteoff]]></NAME>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <AD_TAB_ID><![CDATA[2DD6F1E2CAE0456AA9797A1D627BFF5E]]></AD_TAB_ID>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <AD_COLUMN_ID><![CDATA[0C6CC9768B5144EBB4827B9B98976816]]></AD_COLUMN_ID>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <IGNOREINWAD><![CDATA[Y]]></IGNOREINWAD>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <DISPLAYLENGTH><![CDATA[6]]></DISPLAYLENGTH>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <ISREADONLY><![CDATA[Y]]></ISREADONLY>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <SEQNO><![CDATA[170]]></SEQNO>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <GRID_SEQNO><![CDATA[0]]></GRID_SEQNO>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--C457484FCDED46E3A12F73B51E1D52E3-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--C457484FCDED46E3A12F73B51E1D52E3--></AD_FIELD>
+
 <!--C4EEBC80311BE6EEE040007F0100171C--><AD_FIELD>
 <!--C4EEBC80311BE6EEE040007F0100171C-->  <AD_FIELD_ID><![CDATA[C4EEBC80311BE6EEE040007F0100171C]]></AD_FIELD_ID>
 <!--C4EEBC80311BE6EEE040007F0100171C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>