CI: promote changesets from pi to main
authorRM packaging bot <staff.rm@openbravo.com>
Wed, 15 Sep 2010 18:54:59 +0000
changeset 8424 80bfed94a6e8
parent 8387 f49fef579783 (current diff)
parent 8423 71cf3dcc3b33 (diff)
child 8426 26952fae0077
CI: promote changesets from pi to main
src-db/database/sourcedata/AD_MODULE.xml
Binary file src-db/database/lib/dbsourcemanager.jar has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-db/database/model/excludeFilter.xml	Wed Sep 15 18:54:59 2010 +0000
@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+  <vector>
+    <excludedTable name="PLAN_TABLE"/>
+    <excludedTable name="AD_SYSTEM_MODEL"/>
+    <excludedTable name="C_TEMP_SELECTION"/>
+    <excludedTable name="C_TEMP_SELECTION2"/>
+    <excludedTable name="AD_CONTEXT_INFO"/>
+    <excludedView name="DUAL"/>
+    <excludedView name="USER_CONS_COLUMNS"/>
+    <excludedView name="USER_TABLES"/>
+    <excludedView name="USER_CONSTRAINTS"/>
+    <excludedView name="USER_INDEXES"/>
+    <excludedView name="USER_IND_COLUMNS"/>
+    <excludedView name="USER_OBJECTS"/>
+    <excludedView name="USER_TAB_COLUMNS"/>
+    <excludedView name="USER_TRIGGERS"/>
+    <excludedView name="V$VERSION"/>
+    <excludedView name="AD_INTEGER"/>
+    <excludedFunction name="EXIST_LANGUAGE"/>
+    <excludedFunction name="INSERT_PG_LANGUAGE"/>
+    <excludedFunction name="CREATE_LANGUAGE"/>
+    <excludedFunction name="DATEFORMAT"/>
+    <excludedFunction name="TO_NUMBER"/>
+    <excludedFunction name="TO_DATE"/>
+    <excludedFunction name="TO_TIMESTAMP"/>
+    <excludedFunction name="TO_CHAR"/>
+    <excludedFunction name="ROUND"/>
+    <excludedFunction name="RPAD"/>
+    <excludedFunction name="SUBSTR"/>
+    <excludedFunction name="TO_INTERVAL"/>
+    <excludedFunction name="ADD_MONTHS"/>
+    <excludedFunction name="ADD_DAYS"/>
+    <excludedFunction name="TYPE_OID"/>
+    <excludedFunction name="SUBSTRACT_DAYS"/>
+    <excludedFunction name="TRUNC"/>
+    <excludedFunction name="INSTR"/>
+    <excludedFunction name="LAST_DAY"/>
+    <excludedFunction name="IS_TRIGGER_ENABLED"/>
+    <excludedFunction name="DROP_VIEW"/>
+    <excludedFunction name="MONTHS_BETWEEN"/>
+    <excludedFunction name="AD_SCRIPT_DISABLE_TRIGGERS"/>
+    <excludedFunction name="AD_SCRIPT_DISABLE_CONSTRAINTS"/>
+    <excludedFunction name="AD_SCRIPT_ENABLE_TRIGGERS"/>
+    <excludedFunction name="AD_SCRIPT_ENABLE_CONSTRAINTS"/>
+    <excludedFunction name="AD_SCRIPT_DROP_RECREATE_INDEXES"/>
+    <excludedFunction name="AD_SCRIPT_DROP_RECREATE_INDEX"/>
+    <excludedFunction name="AD_SCRIPT_EXECUTE"/>
+    <excludedFunction name="DBA_GETATTNUMPOS"/>
+    <excludedFunction name="DBA_GETSTANDARD_SEARCH_TEXT"/>
+    <excludedFunction name="DUMP"/>
+    <excludedFunction name="NEGATION"/>
+    <excludedFunction name="EQUAL"/>
+    <excludedFunction name="GREATEREQUAL"/>
+    <excludedFunction name="LOWEREQUAL"/>
+    <excludedFunction name="LOWEREQUALNUMERIC"/>
+    <excludedFunction name="LOWEREQUALTIMESTAMP"/>
+    <excludedFunction name="DBA_RECOMPILE"/>
+    <excludedFunction name="DBA_AFTERIMPORT"/>
+    <excludedFunction name="NOW"/>
+    <excludedFunction name="UPDATE_DATEFORMAT"/>
+    <excludedFunction name="GET_UUID"/>
+    <excludedFunction name="HEX_TO_INT"/>
+    <excludedFunction name="UUID_GENERATE_V4"/>
+    <excludedFunction name="AD_ORG_CHK_DOCUMENTS"/>
+    <excludedFunction name="AD_ORG_CHK_DOC_PAYMENTS"/>
+    <excludedFunction name="C_CREATE_TEMPORARY_TABLES"/>
+    <excludedFunction name="AD_DB_MODIFIED"/>
+    <excludedFunction name="AD_GET_DOC_LE_BU"/>
+    <excludedFunction name="AD_GET_RDBMS"/>
+    <excludedFunction name="AD_CREATE_AUDIT_TRIGGERS"/>
+  </vector>
--- a/src-db/database/model/functions/MRP_RUN_INITIALIZE.xml	Mon Sep 13 20:27:46 2010 +0000
+++ b/src-db/database/model/functions/MRP_RUN_INITIALIZE.xml	Wed Sep 15 18:54:59 2010 +0000
@@ -137,6 +137,7 @@
                                            --AND C_Order_Status(o.C_ORDER_ID) IN (1, 2, 3)
                                            AND o.PROCESSED = 'Y'
                                            AND ol.QTYORDERED <> ol.QTYDELIVERED
+                                           AND ol.m_product_id = p.m_product_id
                                            AND ol.DatePromised IS NOT NULL
                                            AND Mrp_Check_Planningmethod(
                                                     COALESCE(po.MRP_PlanningMethod_ID, p.MRP_PlanningMethod_ID),
@@ -147,6 +148,7 @@
                                            WHERE sf.MRP_SALESFORECAST_ID = sfl.MRP_SALESFORECAST_ID
                                              AND sf.IsActive = 'Y'
                                              AND sf.C_BPartner_ID = bp.C_BPartner_ID
+                                             AND sfl.m_product_id = p.m_product_id
                                              AND bp.C_BP_Group_ID = p_BP_Group_ID
                                              AND Mrp_Check_Planningmethod(
                                                     COALESCE(po.MRP_PlanningMethod_ID, p.MRP_PlanningMethod_ID),
--- a/src-db/database/model/functions/M_INOUT_CREATEINVOICE.xml	Mon Sep 13 20:27:46 2010 +0000
+++ b/src-db/database/model/functions/M_INOUT_CREATEINVOICE.xml	Wed Sep 15 18:54:59 2010 +0000
@@ -85,6 +85,7 @@
       v_C_PaymentTerm_ID VARCHAR2(32) ;
       v_C_Currency_ID VARCHAR2(32) ;
       v_M_PriceList_ID VARCHAR2(32) ;
+      v_FIN_PaymentMethod_ID VARCHAR2(32) ;
       --
       v_C_UOM_ID VARCHAR2(32) ;
       v_C_Tax_ID VARCHAR2(32) ;
@@ -168,9 +169,9 @@
           IF(CUR_Shipment.C_Order_ID IS NOT NULL) THEN
             v_ResultStr:='GetCurrencyInfo-Order';
             SELECT C_Currency_ID,
-              M_PriceList_ID
+              M_PriceList_ID, FIN_PaymentMethod_ID
             INTO v_C_Currency_ID,
-              v_M_PriceList_ID
+              v_M_PriceList_ID, v_FIN_PaymentMethod_ID
             FROM C_ORDER
             WHERE C_Order_ID=CUR_Shipment.C_Order_ID;
           ELSE
@@ -183,6 +184,9 @@
               M_PRICELIST_VERSION plv
             WHERE pl.M_PriceList_ID=plv.M_PriceList_ID
               AND M_PriceList_Version_ID=v_M_PriceList_Version_ID;
+            SELECT po_paymentmethod_id INTO v_FIN_PaymentMethod_ID
+            FROM c_bpartner
+            WHERE c_bpartner_id = CUR_Shipment.C_BPartner_ID;
           END IF;
           --
           v_ResultStr:='GetDocTypeInfo';
@@ -214,7 +218,7 @@
               C_Currency_ID, PaymentRule, C_Charge_ID, ChargeAmt,
               TotalLines, GrandTotal, M_PriceList_ID, C_Campaign_ID,
               C_Project_ID, C_Activity_ID, AD_OrgTrx_ID, User1_ID,
-              User2_ID
+              User2_ID, fin_paymentmethod_id
             )
             VALUES
             (
@@ -229,7 +233,7 @@
               v_C_Currency_ID, v_PaymentRule, NULL, 0,
               0, 0, v_M_PriceList_ID, CUR_Shipment.C_Campaign_ID,
               CUR_Shipment.C_Project_ID, CUR_Shipment.C_Activity_ID, CUR_Shipment.AD_OrgTrx_ID, CUR_Shipment.User1_ID,
-              CUR_Shipment.User2_ID
+              CUR_Shipment.User2_ID, v_fin_paymentmethod_id
             )
             ;
           -- Lines
--- a/src-db/database/model/tables/AD_TREENODE.xml	Mon Sep 13 20:27:46 2010 +0000
+++ b/src-db/database/model/tables/AD_TREENODE.xml	Wed Sep 15 18:54:59 2010 +0000
@@ -52,7 +52,7 @@
       <foreign-key foreignTable="AD_CLIENT" name="AD_TREENODE_AD_CLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
-      <foreign-key foreignTable="AD_ORG" name="AD_TREENODE_AD_ORG" onDelete="cascade">
+      <foreign-key foreignTable="AD_ORG" name="AD_TREENODE_AD_ORG">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
       <foreign-key foreignTable="AD_TREE" name="AD_TREENODE_AD_TREE" onDelete="cascade">
--- a/src-db/database/model/triggers/AD_ORG_TRG.xml	Mon Sep 13 20:27:46 2010 +0000
+++ b/src-db/database/model/triggers/AD_ORG_TRG.xml	Wed Sep 15 18:54:59 2010 +0000
@@ -26,6 +26,7 @@
   v_xParent_ID VARCHAR2(32);
   TYPE RECORD IS REF CURSOR;
     CUR_PeriodControl RECORD;
+    v_count NUMBER;
   
     
 BEGIN
@@ -111,6 +112,11 @@
     INTO v_xTree_ID
     FROM AD_ClientInfo c
     WHERE c.AD_Client_ID=:old.AD_Client_ID;
+    select COUNT(*) INTO v_count from AD_TREENODE where parent_id=:old.AD_ORG_ID
+  	and AD_TREE_ID=v_xTree_ID;
+    IF(v_count>0) THEN
+    	RAISE_APPLICATION_ERROR(-20000, '@ChildOrgCheck@') ;
+    END IF;
     DELETE
     FROM AD_TREENODE
     WHERE AD_CLIENT_ID=:old.AD_Client_ID
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Mon Sep 13 20:27:46 2010 +0000
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Wed Sep 15 18:54:59 2010 +0000
@@ -46991,7 +46991,7 @@
 <!--2920-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--2920-->  <NAME><![CDATA[Credit Limit]]></NAME>
 <!--2920-->  <DESCRIPTION><![CDATA[Total outstanding invoice amounts allowed]]></DESCRIPTION>
-<!--2920-->  <HELP><![CDATA[The Credit Limit indicates the total amount allowed 'on account'.  If this is exceeded a warning message will be generated.]]></HELP>
+<!--2920-->  <HELP><![CDATA[The Credit Line Limit indicates the total amount allowed 'on account'.  If this is exceeded a warning message will be generated.]]></HELP>
 <!--2920-->  <COLUMNNAME><![CDATA[SO_CreditLimit]]></COLUMNNAME>
 <!--2920-->  <AD_TABLE_ID><![CDATA[291]]></AD_TABLE_ID>
 <!--2920-->  <AD_REFERENCE_ID><![CDATA[12]]></AD_REFERENCE_ID>
@@ -47023,7 +47023,7 @@
 <!--2921-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--2921-->  <NAME><![CDATA[Credit Used]]></NAME>
 <!--2921-->  <DESCRIPTION><![CDATA[Current open balance]]></DESCRIPTION>
-<!--2921-->  <HELP><![CDATA[The Credit Used indicates the total amount of open or unpaid invoices for this Business Partner.]]></HELP>
+<!--2921-->  <HELP><![CDATA[The Customer Balance indicates the total amount of open or unpaid invoices for this Business Partner.]]></HELP>
 <!--2921-->  <COLUMNNAME><![CDATA[SO_CreditUsed]]></COLUMNNAME>
 <!--2921-->  <AD_TABLE_ID><![CDATA[291]]></AD_TABLE_ID>
 <!--2921-->  <AD_REFERENCE_ID><![CDATA[12]]></AD_REFERENCE_ID>
@@ -119745,7 +119745,7 @@
 <!--7571-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--7571-->  <NAME><![CDATA[Credit Used]]></NAME>
 <!--7571-->  <DESCRIPTION><![CDATA[Current open balance]]></DESCRIPTION>
-<!--7571-->  <HELP><![CDATA[The Credit Used indicates the total amount of open or unpaid invoices for this Business Partner.]]></HELP>
+<!--7571-->  <HELP><![CDATA[The Customer Balance indicates the total amount of open or unpaid invoices for this Business Partner.]]></HELP>
 <!--7571-->  <COLUMNNAME><![CDATA[SO_CreditUsed]]></COLUMNNAME>
 <!--7571-->  <AD_TABLE_ID><![CDATA[520]]></AD_TABLE_ID>
 <!--7571-->  <AD_REFERENCE_ID><![CDATA[12]]></AD_REFERENCE_ID>
@@ -119877,7 +119877,7 @@
 <!--7575-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--7575-->  <NAME><![CDATA[Credit Limit]]></NAME>
 <!--7575-->  <DESCRIPTION><![CDATA[Total outstanding invoice amounts allowed]]></DESCRIPTION>
-<!--7575-->  <HELP><![CDATA[The Credit Limit indicates the total amount allowed 'on account'.  If this is exceeded a warning message will be generated.]]></HELP>
+<!--7575-->  <HELP><![CDATA[The Credit Line Limit indicates the total amount allowed 'on account'.  If this is exceeded a warning message will be generated.]]></HELP>
 <!--7575-->  <COLUMNNAME><![CDATA[SO_CreditLimit]]></COLUMNNAME>
 <!--7575-->  <AD_TABLE_ID><![CDATA[520]]></AD_TABLE_ID>
 <!--7575-->  <AD_REFERENCE_ID><![CDATA[12]]></AD_REFERENCE_ID>
@@ -288927,7 +288927,6 @@
 <!--7891269C83DE655DE040007F010155CE-->  <ISPARENT><![CDATA[N]]></ISPARENT>
 <!--7891269C83DE655DE040007F010155CE-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
 <!--7891269C83DE655DE040007F010155CE-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
-<!--7891269C83DE655DE040007F010155CE-->  <READONLYLOGIC><![CDATA[@Processed@='Y']]></READONLYLOGIC>
 <!--7891269C83DE655DE040007F010155CE-->  <ISIDENTIFIER><![CDATA[Y]]></ISIDENTIFIER>
 <!--7891269C83DE655DE040007F010155CE-->  <SEQNO><![CDATA[150]]></SEQNO>
 <!--7891269C83DE655DE040007F010155CE-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
@@ -300816,7 +300815,8 @@
 <!--828EE0AE802D5FA1E040007F010067C7-->  <DESCRIPTION><![CDATA[It is the method by which payment is expected to be made or received.]]></DESCRIPTION>
 <!--828EE0AE802D5FA1E040007F010067C7-->  <COLUMNNAME><![CDATA[FIN_Paymentmethod_ID]]></COLUMNNAME>
 <!--828EE0AE802D5FA1E040007F010067C7-->  <AD_TABLE_ID><![CDATA[291]]></AD_TABLE_ID>
-<!--828EE0AE802D5FA1E040007F010067C7-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--828EE0AE802D5FA1E040007F010067C7-->  <AD_REFERENCE_ID><![CDATA[18]]></AD_REFERENCE_ID>
+<!--828EE0AE802D5FA1E040007F010067C7-->  <AD_REFERENCE_VALUE_ID><![CDATA[EED0EF97D4A7421687F3B365D009E7A6]]></AD_REFERENCE_VALUE_ID>
 <!--828EE0AE802D5FA1E040007F010067C7-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
 <!--828EE0AE802D5FA1E040007F010067C7-->  <ISKEY><![CDATA[N]]></ISKEY>
 <!--828EE0AE802D5FA1E040007F010067C7-->  <ISPARENT><![CDATA[N]]></ISPARENT>
@@ -300883,7 +300883,8 @@
 <!--828EE0AE802F5FA1E040007F010067C7-->  <HELP><![CDATA[Financial account used to deposit / withdrawal money such as bank accounts or petty cash]]></HELP>
 <!--828EE0AE802F5FA1E040007F010067C7-->  <COLUMNNAME><![CDATA[FIN_Financial_Account_ID]]></COLUMNNAME>
 <!--828EE0AE802F5FA1E040007F010067C7-->  <AD_TABLE_ID><![CDATA[291]]></AD_TABLE_ID>
-<!--828EE0AE802F5FA1E040007F010067C7-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--828EE0AE802F5FA1E040007F010067C7-->  <AD_REFERENCE_ID><![CDATA[18]]></AD_REFERENCE_ID>
+<!--828EE0AE802F5FA1E040007F010067C7-->  <AD_REFERENCE_VALUE_ID><![CDATA[DF1CEA94B3564A33AFDB37C07E1CE353]]></AD_REFERENCE_VALUE_ID>
 <!--828EE0AE802F5FA1E040007F010067C7-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
 <!--828EE0AE802F5FA1E040007F010067C7-->  <ISKEY><![CDATA[N]]></ISKEY>
 <!--828EE0AE802F5FA1E040007F010067C7-->  <ISPARENT><![CDATA[N]]></ISPARENT>
@@ -300912,6 +300913,8 @@
 <!--828EE0AE80305FA1E040007F010067C7-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--828EE0AE80305FA1E040007F010067C7-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--828EE0AE80305FA1E040007F010067C7-->  <NAME><![CDATA[PO Financial Account]]></NAME>
+<!--828EE0AE80305FA1E040007F010067C7-->  <DESCRIPTION><![CDATA[Financial account used to deposit / withdrawal money such as bank accounts or petty cash]]></DESCRIPTION>
+<!--828EE0AE80305FA1E040007F010067C7-->  <HELP><![CDATA[Financial account used to deposit / withdrawal money such as bank accounts or petty cash]]></HELP>
 <!--828EE0AE80305FA1E040007F010067C7-->  <COLUMNNAME><![CDATA[PO_Financial_Account_ID]]></COLUMNNAME>
 <!--828EE0AE80305FA1E040007F010067C7-->  <AD_TABLE_ID><![CDATA[291]]></AD_TABLE_ID>
 <!--828EE0AE80305FA1E040007F010067C7-->  <AD_REFERENCE_ID><![CDATA[18]]></AD_REFERENCE_ID>
@@ -306244,7 +306247,7 @@
 <!--8E7CC7A39182B541E040007F01004601-->  <ISPARENT><![CDATA[N]]></ISPARENT>
 <!--8E7CC7A39182B541E040007F01004601-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
 <!--8E7CC7A39182B541E040007F01004601-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
-<!--8E7CC7A39182B541E040007F01004601-->  <READONLYLOGIC><![CDATA[@isReceipt@='Y' & @status@!'RPAP']]></READONLYLOGIC>
+<!--8E7CC7A39182B541E040007F01004601-->  <READONLYLOGIC><![CDATA[@isReceipt@='Y' | @status@!'RPAP']]></READONLYLOGIC>
 <!--8E7CC7A39182B541E040007F01004601-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
 <!--8E7CC7A39182B541E040007F01004601-->  <SEQNO><![CDATA[400]]></SEQNO>
 <!--8E7CC7A39182B541E040007F01004601-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
--- a/src-db/database/sourcedata/AD_ELEMENT.xml	Mon Sep 13 20:27:46 2010 +0000
+++ b/src-db/database/sourcedata/AD_ELEMENT.xml	Wed Sep 15 18:54:59 2010 +0000
@@ -3871,10 +3871,10 @@
 <!--553-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--553-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--553-->  <COLUMNNAME><![CDATA[SO_CreditLimit]]></COLUMNNAME>
-<!--553-->  <NAME><![CDATA[Credit Limit]]></NAME>
-<!--553-->  <PRINTNAME><![CDATA[Credit Limit]]></PRINTNAME>
+<!--553-->  <NAME><![CDATA[Credit Line Limit]]></NAME>
+<!--553-->  <PRINTNAME><![CDATA[Credit Line Limit]]></PRINTNAME>
 <!--553-->  <DESCRIPTION><![CDATA[Total outstanding invoice amounts allowed]]></DESCRIPTION>
-<!--553-->  <HELP><![CDATA[The Credit Limit indicates the total amount allowed 'on account'.  If this is exceeded a warning message will be generated.]]></HELP>
+<!--553-->  <HELP><![CDATA[The Credit Line Limit indicates the total amount allowed 'on account'.  If this is exceeded a warning message will be generated.]]></HELP>
 <!--553-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--553--></AD_ELEMENT>
 
@@ -3884,10 +3884,10 @@
 <!--554-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--554-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--554-->  <COLUMNNAME><![CDATA[SO_CreditUsed]]></COLUMNNAME>
-<!--554-->  <NAME><![CDATA[Credit Used]]></NAME>
-<!--554-->  <PRINTNAME><![CDATA[Credit Used]]></PRINTNAME>
+<!--554-->  <NAME><![CDATA[Customer Balance]]></NAME>
+<!--554-->  <PRINTNAME><![CDATA[Customer Balance]]></PRINTNAME>
 <!--554-->  <DESCRIPTION><![CDATA[Current open balance]]></DESCRIPTION>
-<!--554-->  <HELP><![CDATA[The Credit Used indicates the total amount of open or unpaid invoices for this Business Partner.]]></HELP>
+<!--554-->  <HELP><![CDATA[The Customer Balance indicates the total amount of open or unpaid invoices for this Business Partner.]]></HELP>
 <!--554-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--554--></AD_ELEMENT>
 
@@ -26336,6 +26336,8 @@
 <!--828EE0AE80325FA1E040007F010067C7-->  <COLUMNNAME><![CDATA[PO_Financial_Account_ID]]></COLUMNNAME>
 <!--828EE0AE80325FA1E040007F010067C7-->  <NAME><![CDATA[PO Financial account]]></NAME>
 <!--828EE0AE80325FA1E040007F010067C7-->  <PRINTNAME><![CDATA[PO Financial account]]></PRINTNAME>
+<!--828EE0AE80325FA1E040007F010067C7-->  <DESCRIPTION><![CDATA[Financial account used to deposit / withdrawal money such as bank accounts or petty cash]]></DESCRIPTION>
+<!--828EE0AE80325FA1E040007F010067C7-->  <HELP><![CDATA[Financial account used to deposit / withdrawal money such as bank accounts or petty cash]]></HELP>
 <!--828EE0AE80325FA1E040007F010067C7-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--828EE0AE80325FA1E040007F010067C7--></AD_ELEMENT>
 
--- a/src-db/database/sourcedata/AD_FIELD.xml	Mon Sep 13 20:27:46 2010 +0000
+++ b/src-db/database/sourcedata/AD_FIELD.xml	Wed Sep 15 18:54:59 2010 +0000
@@ -27134,9 +27134,9 @@
 <!--2427-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--2427-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--2427-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--2427-->  <NAME><![CDATA[Credit Limit]]></NAME>
+<!--2427-->  <NAME><![CDATA[Credit Line Limit]]></NAME>
 <!--2427-->  <DESCRIPTION><![CDATA[Total outstanding invoice amounts allowed]]></DESCRIPTION>
-<!--2427-->  <HELP><![CDATA[The Credit Limit indicates the total amount allowed 'on account'.  If this is exceeded a warning message will be generated.]]></HELP>
+<!--2427-->  <HELP><![CDATA[The Credit Line Limit indicates the total amount allowed 'on account'.  If this is exceeded a warning message will be generated.]]></HELP>
 <!--2427-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--2427-->  <AD_TAB_ID><![CDATA[223]]></AD_TAB_ID>
 <!--2427-->  <AD_COLUMN_ID><![CDATA[2920]]></AD_COLUMN_ID>
@@ -27158,9 +27158,9 @@
 <!--2428-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--2428-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--2428-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--2428-->  <NAME><![CDATA[Credit Used]]></NAME>
+<!--2428-->  <NAME><![CDATA[Customer Balance]]></NAME>
 <!--2428-->  <DESCRIPTION><![CDATA[Current open balance]]></DESCRIPTION>
-<!--2428-->  <HELP><![CDATA[The Credit Used indicates the total amount of open or unpaid invoices for this Business Partner.]]></HELP>
+<!--2428-->  <HELP><![CDATA[The Customer Balance indicates the total amount of open or unpaid invoices for this Business Partner.]]></HELP>
 <!--2428-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--2428-->  <AD_TAB_ID><![CDATA[223]]></AD_TAB_ID>
 <!--2428-->  <AD_COLUMN_ID><![CDATA[2921]]></AD_COLUMN_ID>
@@ -37437,9 +37437,9 @@
 <!--3277-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--3277-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--3277-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--3277-->  <NAME><![CDATA[Credit Used]]></NAME>
+<!--3277-->  <NAME><![CDATA[Customer Balance]]></NAME>
 <!--3277-->  <DESCRIPTION><![CDATA[Current open balance]]></DESCRIPTION>
-<!--3277-->  <HELP><![CDATA[The Credit Used indicates the total amount of open or unpaid invoices for this Business Partner.]]></HELP>
+<!--3277-->  <HELP><![CDATA[The Customer Balance indicates the total amount of open or unpaid invoices for this Business Partner.]]></HELP>
 <!--3277-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--3277-->  <AD_TAB_ID><![CDATA[220]]></AD_TAB_ID>
 <!--3277-->  <AD_COLUMN_ID><![CDATA[2921]]></AD_COLUMN_ID>
@@ -174158,7 +174158,7 @@
 <!--1002100045-->  <AD_COLUMN_ID><![CDATA[1002100012]]></AD_COLUMN_ID>
 <!--1002100045-->  <AD_FIELDGROUP_ID><![CDATA[101]]></AD_FIELDGROUP_ID>
 <!--1002100045-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
-<!--1002100045-->  <DISPLAYLOGIC><![CDATA[@FinancialManagement@='' & @FinancialManagementDep@='N']]></DISPLAYLOGIC>
+<!--1002100045-->  <DISPLAYLOGIC><![CDATA[@FinancialManagement@='']]></DISPLAYLOGIC>
 <!--1002100045-->  <DISPLAYLENGTH><![CDATA[12]]></DISPLAYLENGTH>
 <!--1002100045-->  <ISREADONLY><![CDATA[Y]]></ISREADONLY>
 <!--1002100045-->  <SEQNO><![CDATA[420]]></SEQNO>
@@ -175835,7 +175835,7 @@
 <!--1002100233-->  <AD_TAB_ID><![CDATA[290]]></AD_TAB_ID>
 <!--1002100233-->  <AD_COLUMN_ID><![CDATA[1002100009]]></AD_COLUMN_ID>
 <!--1002100233-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
-<!--1002100233-->  <DISPLAYLOGIC><![CDATA[@FinancialManagement@='' & @FinancialManagementDep@='N']]></DISPLAYLOGIC>
+<!--1002100233-->  <DISPLAYLOGIC><![CDATA[@FinancialManagement@='' ]]></DISPLAYLOGIC>
 <!--1002100233-->  <DISPLAYLENGTH><![CDATA[12]]></DISPLAYLENGTH>
 <!--1002100233-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--1002100233-->  <SEQNO><![CDATA[240]]></SEQNO>
@@ -195459,7 +195459,7 @@
 <!--7C541AC0C76CFDD7E040007F01016B4D-->  <AD_COLUMN_ID><![CDATA[7891269C83DE655DE040007F010155CE]]></AD_COLUMN_ID>
 <!--7C541AC0C76CFDD7E040007F01016B4D-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
 <!--7C541AC0C76CFDD7E040007F01016B4D-->  <DISPLAYLENGTH><![CDATA[12]]></DISPLAYLENGTH>
-<!--7C541AC0C76CFDD7E040007F01016B4D-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--7C541AC0C76CFDD7E040007F01016B4D-->  <ISREADONLY><![CDATA[Y]]></ISREADONLY>
 <!--7C541AC0C76CFDD7E040007F01016B4D-->  <SEQNO><![CDATA[130]]></SEQNO>
 <!--7C541AC0C76CFDD7E040007F01016B4D-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
 <!--7C541AC0C76CFDD7E040007F01016B4D-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
@@ -198926,14 +198926,14 @@
 <!--82B7B2BAEDF94980E040007F010008E7-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
 <!--82B7B2BAEDF94980E040007F010008E7-->  <DISPLAYLENGTH><![CDATA[12]]></DISPLAYLENGTH>
 <!--82B7B2BAEDF94980E040007F010008E7-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
-<!--82B7B2BAEDF94980E040007F010008E7-->  <SEQNO><![CDATA[100]]></SEQNO>
-<!--82B7B2BAEDF94980E040007F010008E7-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--82B7B2BAEDF94980E040007F010008E7-->  <SEQNO><![CDATA[110]]></SEQNO>
+<!--82B7B2BAEDF94980E040007F010008E7-->  <ISSAMELINE><![CDATA[Y]]></ISSAMELINE>
 <!--82B7B2BAEDF94980E040007F010008E7-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
 <!--82B7B2BAEDF94980E040007F010008E7-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
 <!--82B7B2BAEDF94980E040007F010008E7-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
 <!--82B7B2BAEDF94980E040007F010008E7-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
 <!--82B7B2BAEDF94980E040007F010008E7-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
-<!--82B7B2BAEDF94980E040007F010008E7-->  <GRID_SEQNO><![CDATA[40]]></GRID_SEQNO>
+<!--82B7B2BAEDF94980E040007F010008E7-->  <GRID_SEQNO><![CDATA[50]]></GRID_SEQNO>
 <!--82B7B2BAEDF94980E040007F010008E7--></AD_FIELD>
 
 <!--82B7B2BAEDFA4980E040007F010008E7--><AD_FIELD>
@@ -198971,17 +198971,18 @@
 <!--82B7B2BAEDFB4980E040007F010008E7-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--82B7B2BAEDFB4980E040007F010008E7-->  <AD_TAB_ID><![CDATA[7F5E8E4C55914138A358F5087B532B59]]></AD_TAB_ID>
 <!--82B7B2BAEDFB4980E040007F010008E7-->  <AD_COLUMN_ID><![CDATA[8189F49FFEC66E56E040007F01003E83]]></AD_COLUMN_ID>
+<!--82B7B2BAEDFB4980E040007F010008E7-->  <AD_FIELDGROUP_ID><![CDATA[103]]></AD_FIELDGROUP_ID>
 <!--82B7B2BAEDFB4980E040007F010008E7-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
 <!--82B7B2BAEDFB4980E040007F010008E7-->  <DISPLAYLENGTH><![CDATA[12]]></DISPLAYLENGTH>
 <!--82B7B2BAEDFB4980E040007F010008E7-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
-<!--82B7B2BAEDFB4980E040007F010008E7-->  <SEQNO><![CDATA[110]]></SEQNO>
-<!--82B7B2BAEDFB4980E040007F010008E7-->  <ISSAMELINE><![CDATA[Y]]></ISSAMELINE>
+<!--82B7B2BAEDFB4980E040007F010008E7-->  <SEQNO><![CDATA[100]]></SEQNO>
+<!--82B7B2BAEDFB4980E040007F010008E7-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
 <!--82B7B2BAEDFB4980E040007F010008E7-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
 <!--82B7B2BAEDFB4980E040007F010008E7-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
 <!--82B7B2BAEDFB4980E040007F010008E7-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
 <!--82B7B2BAEDFB4980E040007F010008E7-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
 <!--82B7B2BAEDFB4980E040007F010008E7-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
-<!--82B7B2BAEDFB4980E040007F010008E7-->  <GRID_SEQNO><![CDATA[50]]></GRID_SEQNO>
+<!--82B7B2BAEDFB4980E040007F010008E7-->  <GRID_SEQNO><![CDATA[40]]></GRID_SEQNO>
 <!--82B7B2BAEDFB4980E040007F010008E7--></AD_FIELD>
 
 <!--82B7B2BAEDFC4980E040007F010008E7--><AD_FIELD>
@@ -199541,6 +199542,7 @@
 <!--830698140BED4AC3E040007F01000289-->  <AD_COLUMN_ID><![CDATA[828EE0AE800F5FA1E040007F010067C7]]></AD_COLUMN_ID>
 <!--830698140BED4AC3E040007F01000289-->  <AD_FIELDGROUP_ID><![CDATA[800000]]></AD_FIELDGROUP_ID>
 <!--830698140BED4AC3E040007F01000289-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--830698140BED4AC3E040007F01000289-->  <DISPLAYLOGIC><![CDATA[@$Element_AY@='Y']]></DISPLAYLOGIC>
 <!--830698140BED4AC3E040007F01000289-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
 <!--830698140BED4AC3E040007F01000289-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--830698140BED4AC3E040007F01000289-->  <SEQNO><![CDATA[180]]></SEQNO>
@@ -199565,6 +199567,7 @@
 <!--830698140BEE4AC3E040007F01000289-->  <AD_COLUMN_ID><![CDATA[828EE0AE800E5FA1E040007F010067C7]]></AD_COLUMN_ID>
 <!--830698140BEE4AC3E040007F01000289-->  <AD_FIELDGROUP_ID><![CDATA[800000]]></AD_FIELDGROUP_ID>
 <!--830698140BEE4AC3E040007F01000289-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--830698140BEE4AC3E040007F01000289-->  <DISPLAYLOGIC><![CDATA[@$Element_MC@='Y']]></DISPLAYLOGIC>
 <!--830698140BEE4AC3E040007F01000289-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
 <!--830698140BEE4AC3E040007F01000289-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--830698140BEE4AC3E040007F01000289-->  <SEQNO><![CDATA[190]]></SEQNO>
@@ -199589,6 +199592,7 @@
 <!--830698140BEF4AC3E040007F01000289-->  <AD_COLUMN_ID><![CDATA[828EE0AE800D5FA1E040007F010067C7]]></AD_COLUMN_ID>
 <!--830698140BEF4AC3E040007F01000289-->  <AD_FIELDGROUP_ID><![CDATA[800000]]></AD_FIELDGROUP_ID>
 <!--830698140BEF4AC3E040007F01000289-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--830698140BEF4AC3E040007F01000289-->  <DISPLAYLOGIC><![CDATA[@$Element_PJ@='Y']]></DISPLAYLOGIC>
 <!--830698140BEF4AC3E040007F01000289-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
 <!--830698140BEF4AC3E040007F01000289-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--830698140BEF4AC3E040007F01000289-->  <SEQNO><![CDATA[170]]></SEQNO>
@@ -199613,6 +199617,7 @@
 <!--830698140BF04AC3E040007F01000289-->  <AD_COLUMN_ID><![CDATA[828EE0AE80105FA1E040007F010067C7]]></AD_COLUMN_ID>
 <!--830698140BF04AC3E040007F01000289-->  <AD_FIELDGROUP_ID><![CDATA[800000]]></AD_FIELDGROUP_ID>
 <!--830698140BF04AC3E040007F01000289-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--830698140BF04AC3E040007F01000289-->  <DISPLAYLOGIC><![CDATA[@$Element_U1@='Y']]></DISPLAYLOGIC>
 <!--830698140BF04AC3E040007F01000289-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
 <!--830698140BF04AC3E040007F01000289-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--830698140BF04AC3E040007F01000289-->  <SEQNO><![CDATA[200]]></SEQNO>
@@ -199637,6 +199642,7 @@
 <!--830698140BF14AC3E040007F01000289-->  <AD_COLUMN_ID><![CDATA[828EE0AE80115FA1E040007F010067C7]]></AD_COLUMN_ID>
 <!--830698140BF14AC3E040007F01000289-->  <AD_FIELDGROUP_ID><![CDATA[800000]]></AD_FIELDGROUP_ID>
 <!--830698140BF14AC3E040007F01000289-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--830698140BF14AC3E040007F01000289-->  <DISPLAYLOGIC><![CDATA[@$Element_U2@='Y']]></DISPLAYLOGIC>
 <!--830698140BF14AC3E040007F01000289-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
 <!--830698140BF14AC3E040007F01000289-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--830698140BF14AC3E040007F01000289-->  <SEQNO><![CDATA[210]]></SEQNO>
@@ -199661,6 +199667,7 @@
 <!--830698140BF24AC3E040007F01000289-->  <AD_COLUMN_ID><![CDATA[828EE0AE800F5FA1E040007F010067C7]]></AD_COLUMN_ID>
 <!--830698140BF24AC3E040007F01000289-->  <AD_FIELDGROUP_ID><![CDATA[800000]]></AD_FIELDGROUP_ID>
 <!--830698140BF24AC3E040007F01000289-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--830698140BF24AC3E040007F01000289-->  <DISPLAYLOGIC><![CDATA[@$Element_AY@='Y']]></DISPLAYLOGIC>
 <!--830698140BF24AC3E040007F01000289-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
 <!--830698140BF24AC3E040007F01000289-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--830698140BF24AC3E040007F01000289-->  <SEQNO><![CDATA[180]]></SEQNO>
@@ -199685,6 +199692,7 @@
 <!--830698140BF34AC3E040007F01000289-->  <AD_COLUMN_ID><![CDATA[828EE0AE800E5FA1E040007F010067C7]]></AD_COLUMN_ID>
 <!--830698140BF34AC3E040007F01000289-->  <AD_FIELDGROUP_ID><![CDATA[800000]]></AD_FIELDGROUP_ID>
 <!--830698140BF34AC3E040007F01000289-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--830698140BF34AC3E040007F01000289-->  <DISPLAYLOGIC><![CDATA[@$Element_MC@='Y']]></DISPLAYLOGIC>
 <!--830698140BF34AC3E040007F01000289-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
 <!--830698140BF34AC3E040007F01000289-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--830698140BF34AC3E040007F01000289-->  <SEQNO><![CDATA[190]]></SEQNO>
@@ -199709,6 +199717,7 @@
 <!--830698140BF44AC3E040007F01000289-->  <AD_COLUMN_ID><![CDATA[828EE0AE800D5FA1E040007F010067C7]]></AD_COLUMN_ID>
 <!--830698140BF44AC3E040007F01000289-->  <AD_FIELDGROUP_ID><![CDATA[800000]]></AD_FIELDGROUP_ID>
 <!--830698140BF44AC3E040007F01000289-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--830698140BF44AC3E040007F01000289-->  <DISPLAYLOGIC><![CDATA[@$Element_PJ@='Y']]></DISPLAYLOGIC>
 <!--830698140BF44AC3E040007F01000289-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
 <!--830698140BF44AC3E040007F01000289-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--830698140BF44AC3E040007F01000289-->  <SEQNO><![CDATA[170]]></SEQNO>
@@ -199733,6 +199742,7 @@
 <!--830698140BF54AC3E040007F01000289-->  <AD_COLUMN_ID><![CDATA[828EE0AE80105FA1E040007F010067C7]]></AD_COLUMN_ID>
 <!--830698140BF54AC3E040007F01000289-->  <AD_FIELDGROUP_ID><![CDATA[800000]]></AD_FIELDGROUP_ID>
 <!--830698140BF54AC3E040007F01000289-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--830698140BF54AC3E040007F01000289-->  <DISPLAYLOGIC><![CDATA[@$Element_U1@='Y']]></DISPLAYLOGIC>
 <!--830698140BF54AC3E040007F01000289-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
 <!--830698140BF54AC3E040007F01000289-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--830698140BF54AC3E040007F01000289-->  <SEQNO><![CDATA[200]]></SEQNO>
@@ -199757,6 +199767,7 @@
 <!--830698140BF64AC3E040007F01000289-->  <AD_COLUMN_ID><![CDATA[828EE0AE80115FA1E040007F010067C7]]></AD_COLUMN_ID>
 <!--830698140BF64AC3E040007F01000289-->  <AD_FIELDGROUP_ID><![CDATA[800000]]></AD_FIELDGROUP_ID>
 <!--830698140BF64AC3E040007F01000289-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--830698140BF64AC3E040007F01000289-->  <DISPLAYLOGIC><![CDATA[@$Element_U2@='Y']]></DISPLAYLOGIC>
 <!--830698140BF64AC3E040007F01000289-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
 <!--830698140BF64AC3E040007F01000289-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--830698140BF64AC3E040007F01000289-->  <SEQNO><![CDATA[210]]></SEQNO>
@@ -202202,7 +202213,7 @@
 <!--98C2FF6256AC11DE8C2BD7F555940B62-->  <AD_TAB_ID><![CDATA[161]]></AD_TAB_ID>
 <!--98C2FF6256AC11DE8C2BD7F555940B62-->  <AD_COLUMN_ID><![CDATA[17FDE34256AC11DE8CD0DFCC30CA23CC]]></AD_COLUMN_ID>
 <!--98C2FF6256AC11DE8C2BD7F555940B62-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
-<!--98C2FF6256AC11DE8C2BD7F555940B62-->  <DISPLAYLOGIC><![CDATA[@FinancialManagement@='' & @FinancialManagementDep@='N']]></DISPLAYLOGIC>
+<!--98C2FF6256AC11DE8C2BD7F555940B62-->  <DISPLAYLOGIC><![CDATA[@FinancialManagement@='']]></DISPLAYLOGIC>
 <!--98C2FF6256AC11DE8C2BD7F555940B62-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
 <!--98C2FF6256AC11DE8C2BD7F555940B62-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--98C2FF6256AC11DE8C2BD7F555940B62-->  <SEQNO><![CDATA[200]]></SEQNO>
@@ -202226,7 +202237,7 @@
 <!--98C38D2E56AC11DE8275F3BADDEF3F7F-->  <AD_TAB_ID><![CDATA[161]]></AD_TAB_ID>
 <!--98C38D2E56AC11DE8275F3BADDEF3F7F-->  <AD_COLUMN_ID><![CDATA[17E54C6A56AC11DEBAE03BCB821144C5]]></AD_COLUMN_ID>
 <!--98C38D2E56AC11DE8275F3BADDEF3F7F-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
-<!--98C38D2E56AC11DE8275F3BADDEF3F7F-->  <DISPLAYLOGIC><![CDATA[@FinancialManagement@='' & @FinancialManagementDep@='N']]></DISPLAYLOGIC>
+<!--98C38D2E56AC11DE8275F3BADDEF3F7F-->  <DISPLAYLOGIC><![CDATA[@FinancialManagement@='']]></DISPLAYLOGIC>
 <!--98C38D2E56AC11DE8275F3BADDEF3F7F-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
 <!--98C38D2E56AC11DE8275F3BADDEF3F7F-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--98C38D2E56AC11DE8275F3BADDEF3F7F-->  <SEQNO><![CDATA[210]]></SEQNO>
@@ -203717,7 +203728,7 @@
 <!--C925D6B656AC11DEAE52E723C9919EF7-->  <AD_TAB_ID><![CDATA[800033]]></AD_TAB_ID>
 <!--C925D6B656AC11DEAE52E723C9919EF7-->  <AD_COLUMN_ID><![CDATA[DA4F35FA56AB11DEA15BF76C2FF29E52]]></AD_COLUMN_ID>
 <!--C925D6B656AC11DEAE52E723C9919EF7-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
-<!--C925D6B656AC11DEAE52E723C9919EF7-->  <DISPLAYLOGIC><![CDATA[@Enableinfininvoices@='N' & @FinancialManagement@='' & @FinancialManagementDep@='N']]></DISPLAYLOGIC>
+<!--C925D6B656AC11DEAE52E723C9919EF7-->  <DISPLAYLOGIC><![CDATA[@Enableinfininvoices@='N' & @FinancialManagement@='']]></DISPLAYLOGIC>
 <!--C925D6B656AC11DEAE52E723C9919EF7-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
 <!--C925D6B656AC11DEAE52E723C9919EF7-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--C925D6B656AC11DEAE52E723C9919EF7-->  <SEQNO><![CDATA[90]]></SEQNO>
@@ -203733,7 +203744,7 @@
 <!--C92612B656AC11DEBB69837DC96AB39A-->  <AD_FIELD_ID><![CDATA[C92612B656AC11DEBB69837DC96AB39A]]></AD_FIELD_ID>
 <!--C92612B656AC11DEBB69837DC96AB39A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--C92612B656AC11DEBB69837DC96AB39A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--C92612B656AC11DEBB69837DC96AB39A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--C92612B656AC11DEBB69837DC96AB39A-->  <ISACTIVE><![CDATA[N]]></ISACTIVE>
 <!--C92612B656AC11DEBB69837DC96AB39A-->  <NAME><![CDATA[Tax]]></NAME>
 <!--C92612B656AC11DEBB69837DC96AB39A-->  <DESCRIPTION><![CDATA[The percentage of money requested by the government for this specified product or transaction.]]></DESCRIPTION>
 <!--C92612B656AC11DEBB69837DC96AB39A-->  <HELP><![CDATA[The Tax indicates the type of tax for this document line.]]></HELP>
@@ -203741,7 +203752,7 @@
 <!--C92612B656AC11DEBB69837DC96AB39A-->  <AD_TAB_ID><![CDATA[800033]]></AD_TAB_ID>
 <!--C92612B656AC11DEBB69837DC96AB39A-->  <AD_COLUMN_ID><![CDATA[DA2DB20456AB11DE9BB80FC471DFC7FA]]></AD_COLUMN_ID>
 <!--C92612B656AC11DEBB69837DC96AB39A-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
-<!--C92612B656AC11DEBB69837DC96AB39A-->  <DISPLAYLOGIC><![CDATA[@Enableinfininvoices@='N']]></DISPLAYLOGIC>
+<!--C92612B656AC11DEBB69837DC96AB39A-->  <DISPLAYLOGIC><![CDATA[@Enableinfininvoices@='N' & @FinancialManagement@='']]></DISPLAYLOGIC>
 <!--C92612B656AC11DEBB69837DC96AB39A-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
 <!--C92612B656AC11DEBB69837DC96AB39A-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--C92612B656AC11DEBB69837DC96AB39A-->  <SEQNO><![CDATA[80]]></SEQNO>
@@ -204250,7 +204261,7 @@
 <!--D9A9CA880316499E83F26F4DDEE28626-->  <AD_TAB_ID><![CDATA[800033]]></AD_TAB_ID>
 <!--D9A9CA880316499E83F26F4DDEE28626-->  <AD_COLUMN_ID><![CDATA[00A4CC469B0D4EF4AB17FA4ADC8C0EA5]]></AD_COLUMN_ID>
 <!--D9A9CA880316499E83F26F4DDEE28626-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
-<!--D9A9CA880316499E83F26F4DDEE28626-->  <DISPLAYLOGIC><![CDATA[@Enableinfininvoices@='Y' & @FinancialManagement@='' & @FinancialManagementDep@='N']]></DISPLAYLOGIC>
+<!--D9A9CA880316499E83F26F4DDEE28626-->  <DISPLAYLOGIC><![CDATA[@Enableinfininvoices@='Y']]></DISPLAYLOGIC>
 <!--D9A9CA880316499E83F26F4DDEE28626-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
 <!--D9A9CA880316499E83F26F4DDEE28626-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--D9A9CA880316499E83F26F4DDEE28626-->  <SEQNO><![CDATA[70]]></SEQNO>
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Mon Sep 13 20:27:46 2010 +0000
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Wed Sep 15 18:54:59 2010 +0000
@@ -28155,7 +28155,7 @@
 <!--1006300002-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--1006300002-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--1006300002-->  <VALUE><![CDATA[BPS_SO_CREDITAVAILABLE]]></VALUE>
-<!--1006300002-->  <MSGTEXT><![CDATA[Credit available]]></MSGTEXT>
+<!--1006300002-->  <MSGTEXT><![CDATA[Credit Line available]]></MSGTEXT>
 <!--1006300002-->  <MSGTIP><![CDATA[Used for column name translation in Business Partner Selector]]></MSGTIP>
 <!--1006300002-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
 <!--1006300002-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
@@ -28167,7 +28167,7 @@
 <!--1006300003-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--1006300003-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--1006300003-->  <VALUE><![CDATA[BPS_SO_CREDITUSED]]></VALUE>
-<!--1006300003-->  <MSGTEXT><![CDATA[Credit used]]></MSGTEXT>
+<!--1006300003-->  <MSGTEXT><![CDATA[Customer Balance]]></MSGTEXT>
 <!--1006300003-->  <MSGTIP><![CDATA[Used for column name translation in Business Partner Selector]]></MSGTIP>
 <!--1006300003-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
 <!--1006300003-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
@@ -29932,6 +29932,17 @@
 <!--173455990A494A799F86C2737D8F9617-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--173455990A494A799F86C2737D8F9617--></AD_MESSAGE>
 
+<!--17456DF6F0804BF2996AE696DFA31EC9--><AD_MESSAGE>
+<!--17456DF6F0804BF2996AE696DFA31EC9-->  <AD_MESSAGE_ID><![CDATA[17456DF6F0804BF2996AE696DFA31EC9]]></AD_MESSAGE_ID>
+<!--17456DF6F0804BF2996AE696DFA31EC9-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--17456DF6F0804BF2996AE696DFA31EC9-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--17456DF6F0804BF2996AE696DFA31EC9-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--17456DF6F0804BF2996AE696DFA31EC9-->  <VALUE><![CDATA[ChildOrgCheck]]></VALUE>
+<!--17456DF6F0804BF2996AE696DFA31EC9-->  <MSGTEXT><![CDATA[This organization cannot be deleted because it has child organizations. Please, delete the child organizations first]]></MSGTEXT>
+<!--17456DF6F0804BF2996AE696DFA31EC9-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--17456DF6F0804BF2996AE696DFA31EC9-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--17456DF6F0804BF2996AE696DFA31EC9--></AD_MESSAGE>
+
 <!--17EB942A41BC417FA70FDFCA35027276--><AD_MESSAGE>
 <!--17EB942A41BC417FA70FDFCA35027276-->  <AD_MESSAGE_ID><![CDATA[17EB942A41BC417FA70FDFCA35027276]]></AD_MESSAGE_ID>
 <!--17EB942A41BC417FA70FDFCA35027276-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_MODULE.xml	Mon Sep 13 20:27:46 2010 +0000
+++ b/src-db/database/sourcedata/AD_MODULE.xml	Wed Sep 15 18:54:59 2010 +0000
@@ -6,7 +6,7 @@
 <!--0-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--0-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--0-->  <NAME><![CDATA[core]]></NAME>
-<!--0-->  <VERSION><![CDATA[2.50.18386]]></VERSION>
+<!--0-->  <VERSION><![CDATA[2.50.18423]]></VERSION>
 <!--0-->  <DESCRIPTION><![CDATA[Core module is the base one]]></DESCRIPTION>
 <!--0-->  <HELP><![CDATA[Core module is the base one, all developments in core are included as part of the standard Openbravo ERP.]]></HELP>
 <!--0-->  <URL><![CDATA[www.openbravo.com]]></URL>
--- a/src-db/database/sourcedata/AD_REF_LIST.xml	Mon Sep 13 20:27:46 2010 +0000
+++ b/src-db/database/sourcedata/AD_REF_LIST.xml	Wed Sep 15 18:54:59 2010 +0000
@@ -5967,7 +5967,7 @@
 <!--800080-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--800080-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--800080-->  <VALUE><![CDATA[N]]></VALUE>
-<!--800080-->  <NAME><![CDATA[All Selected]]></NAME>
+<!--800080-->  <NAME><![CDATA[Only those defined]]></NAME>
 <!--800080-->  <AD_REFERENCE_ID><![CDATA[800029]]></AD_REFERENCE_ID>
 <!--800080-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--800080--></AD_REF_LIST>
@@ -5978,7 +5978,7 @@
 <!--800081-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--800081-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--800081-->  <VALUE><![CDATA[Y]]></VALUE>
-<!--800081-->  <NAME><![CDATA[Not Selected]]></NAME>
+<!--800081-->  <NAME><![CDATA[All excluding defined]]></NAME>
 <!--800081-->  <AD_REFERENCE_ID><![CDATA[800029]]></AD_REFERENCE_ID>
 <!--800081-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--800081--></AD_REF_LIST>
--- a/src-db/database/sourcedata/AD_TABLE.xml	Mon Sep 13 20:27:46 2010 +0000
+++ b/src-db/database/sourcedata/AD_TABLE.xml	Wed Sep 15 18:54:59 2010 +0000
@@ -10219,7 +10219,7 @@
 <!--4D8C3B3C31D1410DA046140C9F024D17-->  <ISHIGHVOLUME><![CDATA[N]]></ISHIGHVOLUME>
 <!--4D8C3B3C31D1410DA046140C9F024D17-->  <IMPORTTABLE><![CDATA[N]]></IMPORTTABLE>
 <!--4D8C3B3C31D1410DA046140C9F024D17-->  <ISCHANGELOG><![CDATA[N]]></ISCHANGELOG>
-<!--4D8C3B3C31D1410DA046140C9F024D17-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
+<!--4D8C3B3C31D1410DA046140C9F024D17-->  <ISDEFAULTACCT><![CDATA[Y]]></ISDEFAULTACCT>
 <!--4D8C3B3C31D1410DA046140C9F024D17-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--4D8C3B3C31D1410DA046140C9F024D17-->  <AD_PACKAGE_ID><![CDATA[5A3ED54AB1E64B84E040007F01006125]]></AD_PACKAGE_ID>
 <!--4D8C3B3C31D1410DA046140C9F024D17-->  <ACCTDATE_COLUMN_ID><![CDATA[7DC34559B416B45BE040007F0100784A]]></ACCTDATE_COLUMN_ID>
@@ -10858,7 +10858,7 @@
 <!--B1B7075C46934F0A9FD4C4D0F1457B42-->  <ISHIGHVOLUME><![CDATA[N]]></ISHIGHVOLUME>
 <!--B1B7075C46934F0A9FD4C4D0F1457B42-->  <IMPORTTABLE><![CDATA[N]]></IMPORTTABLE>
 <!--B1B7075C46934F0A9FD4C4D0F1457B42-->  <ISCHANGELOG><![CDATA[N]]></ISCHANGELOG>
-<!--B1B7075C46934F0A9FD4C4D0F1457B42-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
+<!--B1B7075C46934F0A9FD4C4D0F1457B42-->  <ISDEFAULTACCT><![CDATA[Y]]></ISDEFAULTACCT>
 <!--B1B7075C46934F0A9FD4C4D0F1457B42-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--B1B7075C46934F0A9FD4C4D0F1457B42-->  <AD_PACKAGE_ID><![CDATA[5A3ED54AB1E64B84E040007F01006125]]></AD_PACKAGE_ID>
 <!--B1B7075C46934F0A9FD4C4D0F1457B42-->  <ACCTDATE_COLUMN_ID><![CDATA[8189F49FFEE26E56E040007F01003E83]]></ACCTDATE_COLUMN_ID>
@@ -11121,7 +11121,7 @@
 <!--D1A97202E832470285C9B1EB026D54E2-->  <IMPORTTABLE><![CDATA[N]]></IMPORTTABLE>
 <!--D1A97202E832470285C9B1EB026D54E2-->  <ISCHANGELOG><![CDATA[N]]></ISCHANGELOG>
 <!--D1A97202E832470285C9B1EB026D54E2-->  <PO_WINDOW_ID><![CDATA[6F8F913FA60F4CBD93DC1D3AA696E76E]]></PO_WINDOW_ID>
-<!--D1A97202E832470285C9B1EB026D54E2-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
+<!--D1A97202E832470285C9B1EB026D54E2-->  <ISDEFAULTACCT><![CDATA[Y]]></ISDEFAULTACCT>
 <!--D1A97202E832470285C9B1EB026D54E2-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--D1A97202E832470285C9B1EB026D54E2-->  <AD_PACKAGE_ID><![CDATA[5A3ED54AB1E64B84E040007F01006125]]></AD_PACKAGE_ID>
 <!--D1A97202E832470285C9B1EB026D54E2-->  <ACCTDATE_COLUMN_ID><![CDATA[7891269C83DB655DE040007F010155CE]]></ACCTDATE_COLUMN_ID>
--- a/src-db/src/com/openbravo/db/OpenbravoExcludeFilter.java	Mon Sep 13 20:27:46 2010 +0000
+++ b/src-db/src/com/openbravo/db/OpenbravoExcludeFilter.java	Wed Sep 15 18:54:59 2010 +0000
@@ -14,9 +14,9 @@
 
 import org.apache.ddlutils.platform.ExcludeFilter;
 
+@Deprecated
 /**
- * 
- * @author adrian
+ * @Deprecated This class has been replaced by the new excludeFilter functionality. If you need to extend the list, you can check this document: http://wiki.openbravo.com/wiki/ERP/2.50/Developers_Guide/How_To_Exclude_Database_Physical_Objects_From_Model
  */
 public class OpenbravoExcludeFilter extends ExcludeFilter {
 
--- a/src/org/openbravo/erpCommon/ad_forms/AcctServer.java	Mon Sep 13 20:27:46 2010 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/AcctServer.java	Wed Sep 15 18:54:59 2010 +0000
@@ -262,7 +262,7 @@
 
   /**
    * Cosntructor
-   *
+   * 
    * @param m_AD_Client_ID
    *          Client ID of these Documents
    * @param connectionProvider
@@ -339,7 +339,7 @@
 
   /**
    * Factory - Create Posting document
-   *
+   * 
    * @param AD_Table_ID
    *          Table ID of Documents
    * @param AD_Client_ID
@@ -568,6 +568,7 @@
         loadObjectFieldProvider(connectionProvider, AD_Client_ID, strClave);
       } catch (ServletException e) {
         log4j.warn(e);
+        e.printStackTrace();
       }
       FieldProvider data[] = getObjectFieldProvider();
       try {
@@ -584,6 +585,7 @@
         Status = AcctServer.STATUS_Error;
         save(conn, vars.getUser());
         log4j.warn(e);
+        e.printStackTrace();
       }
     } catch (ServletException e) {
       log4j.error(e);
@@ -661,7 +663,7 @@
 
   /**
    * Post Commit. Save Facts & Document
-   *
+   * 
    * @param status
    *          status
    * @return Posting Status
@@ -707,7 +709,7 @@
 
   /**
    * Save to Disk - set posted flag
-   *
+   * 
    * @param con
    *          connection
    * @param strUser
@@ -720,6 +722,7 @@
       no = AcctServerData.updateSave(conn, tableName, Status, strUser, Record_ID);
     } catch (ServletException e) {
       log4j.warn(e);
+      e.printStackTrace();
     }
     return no == 1;
   } // save
@@ -743,6 +746,7 @@
       return loadDocument(data, force, conn, con);
     } catch (NoConnectionAvailableException e) {
       log4j.warn(e);
+      e.printStackTrace();
       return false;
     }
   }
@@ -835,6 +839,7 @@
         AcctServerData.delete(connectionProvider, AD_Table_ID, Record_ID);
       } catch (ServletException e) {
         log4j.warn(e);
+        e.printStackTrace();
       }
       // if (log4j.isDebugEnabled()) log4j.debug("post - deleted=" + no);
     } else if (Posted.equals("Y")) {
@@ -872,6 +877,7 @@
       }
     } catch (ServletException e) {
       log4j.warn(e);
+      e.printStackTrace();
     }
     if (GL_Category_ID != null && GL_Category_ID.equals(""))
       log4j.warn("AcctServer - loadDocumentType - No GL Info");
@@ -918,6 +924,7 @@
       }
     } catch (ServletException e) {
       log4j.warn(e);
+      e.printStackTrace();
     }
 
     return no == 1;
@@ -925,7 +932,7 @@
 
   /**
    * Posting logic for Accounting Schema index
-   *
+   * 
    * @param index
    *          Accounting Schema index
    * @return posting status/error code
@@ -953,6 +960,7 @@
       m_fact[index] = createFact(m_as[index], conn, con, vars);
     } catch (Exception e) {
       log4j.warn(e);
+      e.printStackTrace();
     }
     if (m_fact[index] == null)
       return STATUS_Error;
@@ -1005,7 +1013,7 @@
 
   /**
    * Is the Source Document Balanced
-   *
+   * 
    * @return true if (source) balanced
    */
   public boolean isBalanced() {
@@ -1013,7 +1021,7 @@
     if (MultiCurrency)
       return true;
     //
-    boolean retValue = (getBalance().compareTo(new BigDecimal("0.00")) == 0);
+    boolean retValue = (getBalance().compareTo(ZERO) == 0);
     if (retValue) {
       if (log4j.isDebugEnabled())
         log4j.debug("AcctServer - isBalanced - " + DocumentNo);
@@ -1024,7 +1032,7 @@
 
   /**
    * Is Document convertible to currency and Conversion Type
-   *
+   * 
    * @param acctSchema
    *          accounting schema
    * @return true, if convertable to accounting currency
@@ -1084,7 +1092,7 @@
 
   /**
    * Get the Amount (loaded in loadDocumentDetails)
-   *
+   * 
    * @param AmtType
    *          see AMTTYPE_*
    * @return Amount
@@ -1097,7 +1105,7 @@
 
   /**
    * Get Amount with index 0
-   *
+   * 
    * @return Amount (primary document amount)
    */
   public String getAmount() {
@@ -1106,7 +1114,7 @@
 
   /**
    * Convert an amount
-   *
+   * 
    * @param CurFrom_ID
    *          The C_Currency_ID FROM
    * @param CurTo_ID
@@ -1149,6 +1157,7 @@
           client, org);
     } catch (ServletException e) {
       log4j.warn(e);
+      e.printStackTrace();
     }
     if (data == null || data.length == 0) {
       /*
@@ -1165,7 +1174,7 @@
 
   /**
    * Is Period Open
-   *
+   * 
    * @return true if period is open
    */
   public boolean isPeriodOpen() {
@@ -1206,12 +1215,13 @@
             + DocumentType + " => " + C_Period_ID);
     } catch (ServletException e) {
       log4j.warn(e);
+      e.printStackTrace();
     }
   } // setC_Period_ID
 
   /**
    * Matching
-   *
+   * 
    * <pre>
    *  Derive Invoice-Receipt Match from PO-Invoice and PO-Receipt
    *  Purchase Order (20)
@@ -1225,10 +1235,10 @@
    *  (b) Creates Indirects
    *      - Invoice1 - Receipt2 (5)
    *  (Not imlemented)
-   *
-   *
+   * 
+   * 
    * </pre>
-   *
+   * 
    * @return number of records created
    */
   public int match(VariablesSecureApp vars, ConnectionProvider conn, Connection con) {
@@ -1255,6 +1265,7 @@
           compare = DateTimeData.compare(conn, dateTrx1, dateTrx2);
         } catch (ServletException e) {
           log4j.warn(e);
+          e.printStackTrace();
         }
         String DateTrx = dateTrx1;
         if (compare.equals("-1"))
@@ -1274,6 +1285,7 @@
       }
     } catch (ServletException e) {
       log4j.warn(e);
+      e.printStackTrace();
     }
     // if (log4j.isDebugEnabled())
     // log4j.debug("AcctServer - Matcher.match - Client_ID=" + AD_Client_ID
@@ -1283,7 +1295,7 @@
 
   /**
    * Create MatchInv record
-   *
+   * 
    * @param AD_Client_ID
    *          Client
    * @param AD_Org_ID
@@ -1315,13 +1327,14 @@
           M_InOutLine_ID, C_InvoiceLine_ID, M_Product_ID, DateTrx, Qty);
     } catch (ServletException e) {
       log4j.warn(e);
+      e.printStackTrace();
     }
     return no;
   } // createMatchInv
 
   /**
    * Get the account for Accounting Schema
-   *
+   * 
    * @param AcctType
    *          see ACCTTYPE_*
    * @param as
@@ -1437,6 +1450,7 @@
       // log4j.debug("AcctServer - *******************************getAccount 3");
     } catch (ServletException e) {
       log4j.warn(e);
+      e.printStackTrace();
     }
     // Get Acct
     String Account_ID = "";
@@ -1457,13 +1471,14 @@
       acct = Account.getAccount(conn, Account_ID);
     } catch (ServletException e) {
       log4j.warn(e);
+      e.printStackTrace();
     }
     return acct;
   } // getAccount
 
   /**
    * Get the account for Accounting Schema
-   *
+   * 
    * @param cBPartnerId
    *          business partner id
    * @param as
@@ -1480,6 +1495,7 @@
       whereClause.append(" as cusa ");
       whereClause.append(" where cusa.businessPartner.id = '" + cBPartnerId + "'");
       whereClause.append(" and cusa.accountingSchema.id = '" + as.m_C_AcctSchema_ID + "'");
+      whereClause.append(" and (cusa.status is null or cusa.status = 'DE')");
 
       final OBQuery<CustomerAccounts> obqParameters = OBDal.getInstance().createQuery(
           CustomerAccounts.class, whereClause.toString());
@@ -1495,9 +1511,10 @@
     } else {
       final StringBuilder whereClause = new StringBuilder();
 
-      whereClause.append(" as cusa ");
-      whereClause.append(" where cusa.businessPartner.id = '" + cBPartnerId + "'");
-      whereClause.append(" and cusa.accountingSchema.id = '" + as.m_C_AcctSchema_ID + "'");
+      whereClause.append(" as vena ");
+      whereClause.append(" where vena.businessPartner.id = '" + cBPartnerId + "'");
+      whereClause.append(" and vena.accountingSchema.id = '" + as.m_C_AcctSchema_ID + "'");
+      whereClause.append(" and (vena.status is null or vena.status = 'DE')");
 
       final OBQuery<VendorAccounts> obqParameters = OBDal.getInstance().createQuery(
           VendorAccounts.class, whereClause.toString());
@@ -1580,16 +1597,16 @@
     Account account = null;
     String strvalidCombination = "";
     try {
-      if (use.equals("INT"))
+      if ("INT".equals(use))
         strvalidCombination = bIsReceipt ? financialAccountAccounting
             .getInTransitPaymentAccountIN().getId() : financialAccountAccounting
             .getFINOutIntransitAcct().getId();
-      else if (use.equals("DEP"))
+      else if ("DEP".equals(use))
         strvalidCombination = financialAccountAccounting.getDepositAccount().getId();
-      else if (use.equals("CLE"))
+      else if ("CLE".equals(use))
         strvalidCombination = bIsReceipt ? financialAccountAccounting.getClearedPaymentAccount()
             .getId() : financialAccountAccounting.getClearedPaymentAccountOUT().getId();
-      else if (use.equals("WIT"))
+      else if ("WIT".equals(use))
         strvalidCombination = financialAccountAccounting.getWithdrawalAccount().getId();
       else
         return null;
@@ -1615,14 +1632,14 @@
 
   /**
    * Get Source Currency Balance - subtracts line (and tax) amounts from total - no rounding
-   *
+   * 
    * @return positive amount, if total header is bigger than lines
    */
   public abstract BigDecimal getBalance();
 
   /**
    * Create Facts (the accounting logic)
-   *
+   * 
    * @param as
    *          accounting schema
    * @return Fact
--- a/src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java	Mon Sep 13 20:27:46 2010 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocFINFinAccTransaction.java	Wed Sep 15 18:54:59 2010 +0000
@@ -56,6 +56,8 @@
   public static final String TRXTYPE_BPDeposit = "BPD";
   public static final String TRXTYPE_BPWithdrawal = "BPW";
   public static final String TRXTYPE_BankFee = "BF";
+  BigDecimal usedCredit = ZERO;
+  BigDecimal generatedCredit = ZERO;
 
   private static final long serialVersionUID = 1L;
   private static final Logger log4j = Logger.getLogger(DocFINFinAccTransaction.class);
@@ -74,8 +76,14 @@
   public boolean loadDocumentDetails(FieldProvider[] data, ConnectionProvider conn) {
     DocumentType = AcctServer.DOCTYPE_FinAccTransaction;
     DateDoc = data[0].getField("trxdate");
-    BigDecimal paymentAmount = new BigDecimal(data[0].getField("PaymentAmount"));
-    BigDecimal depositAmount = new BigDecimal(data[0].getField("DepositAmount"));
+    BigDecimal paymentAmount = "".equals(data[0].getField("PaymentAmount")) ? ZERO
+        : new BigDecimal(data[0].getField("PaymentAmount"));
+    BigDecimal depositAmount = "".equals(data[0].getField("DepositAmount")) ? ZERO
+        : new BigDecimal(data[0].getField("DepositAmount"));
+    usedCredit = "".equals(data[0].getField("UsedCredit")) ? ZERO : new BigDecimal(data[0]
+        .getField("UsedCredit"));
+    generatedCredit = "".equals(data[0].getField("GeneratedCredit")) ? ZERO : new BigDecimal(
+        data[0].getField("GeneratedCredit"));
     Amounts[AMTTYPE_Gross] = depositAmount.subtract(paymentAmount).toString();
     loadDocumentType();
     p_lines = loadLines();
@@ -103,6 +111,10 @@
       for (int i = 0; i < data.length; i++) {
         if (!getPaymentConfirmation(payment))
           continue;
+        // Details refunded used credit are excluded as the entry will be created using the credit
+        // used
+        if (paymentDetails.get(i).isRefund() && paymentDetails.get(i).isPrepayment())
+          continue;
         data[i] = new FieldProviderFactory(new HashMap());
         FieldProviderFactory.setField(data[i], "FIN_Finacc_Transaction_ID", transaction.getId());
         FieldProviderFactory.setField(data[i], "AD_Client_ID", paymentDetails.get(i).getClient()
@@ -189,6 +201,8 @@
     if (data == null || data.length == 0)
       return null;
     for (int i = 0; i < data.length; i++) {
+      if (data[i] == null)
+        continue;
       String Line_ID = data[i].getField("FIN_Finacc_Transaction_ID");
       DocLine_FINFinAccTransaction docLine = new DocLine_FINFinAccTransaction(DocumentType,
           Record_ID, Line_ID);
@@ -260,65 +274,126 @@
       OBContext.restorePreviousMode();
     }
     Fact fact = new Fact(this, as, Fact.POST_Actual);
-    for (int i = 0; p_lines != null && i < p_lines.length; i++) {
-      DocLine_FINFinAccTransaction line = (DocLine_FINFinAccTransaction) p_lines[i];
-      FIN_FinaccTransaction transaction = OBDal.getInstance().get(FIN_FinaccTransaction.class,
-          Record_ID);
-      // 3 Scenarios: 1st Bank fee 2nd glitem transaction 3rd payment related transaction
-      if (TRXTYPE_BankFee.equals(transaction.getTransactionType()))
-        fact = createFactFee(line, transaction, as, conn, fact);
-      else if (!"".equals(line.getFinPaymentId()))
-        fact = createFactPaymentDetails(line, as, conn, fact);
-      else
-        fact = createFactGLItem(line, as, conn, fact);
-    }
+    FIN_FinaccTransaction transaction = OBDal.getInstance().get(FIN_FinaccTransaction.class,
+        Record_ID);
+    // 3 Scenarios: 1st Bank fee 2nd payment related transaction 3rd glitem transaction
+    if (TRXTYPE_BankFee.equals(transaction.getTransactionType()))
+      fact = createFactFee(transaction, as, conn, fact);
+    else if (transaction.getFinPayment() != null)
+      fact = createFactPaymentDetails(as, conn, fact);
+    else
+      fact = createFactGLItem(as, conn, fact);
     return fact;
   }
 
   /*
    * Creates accounting related to a bank fee transaction
    */
-  public Fact createFactFee(DocLine_FINFinAccTransaction line, FIN_FinaccTransaction transaction,
-      AcctSchema as, ConnectionProvider conn, Fact fact) throws ServletException {
+  public Fact createFactFee(FIN_FinaccTransaction transaction, AcctSchema as,
+      ConnectionProvider conn, Fact fact) throws ServletException {
     String Fact_Acct_Group_ID = SequenceIdData.getUUID();
-    fact.createLine(line, getAccountFee(as, transaction.getAccount(), conn), C_Currency_ID, line
-        .getPaymentAmount(), line.getDepositAmount(), Fact_Acct_Group_ID, nextSeqNo(SeqNo),
-        DocumentType, conn);
-    fact.createLine(line, getWithdrawalAccount(as, null, transaction.getAccount(), conn),
-        C_Currency_ID, line.getDepositAmount(), line.getPaymentAmount(), Fact_Acct_Group_ID,
-        nextSeqNo(SeqNo), DocumentType, conn);
+    for (int i = 0; p_lines != null && i < p_lines.length; i++) {
+      DocLine_FINFinAccTransaction line = (DocLine_FINFinAccTransaction) p_lines[i];
+      fact.createLine(line, getAccountFee(as, transaction.getAccount(), conn), C_Currency_ID, line
+          .getPaymentAmount(), line.getDepositAmount(), Fact_Acct_Group_ID, nextSeqNo(SeqNo),
+          DocumentType, conn);
+      fact.createLine(line, getWithdrawalAccount(as, null, transaction.getAccount(), conn),
+          C_Currency_ID, line.getDepositAmount(), line.getPaymentAmount(), Fact_Acct_Group_ID,
+          nextSeqNo(SeqNo), DocumentType, conn);
+    }
     SeqNo = "0";
     return fact;
   }
 
-  public Fact createFactPaymentDetails(DocLine_FINFinAccTransaction line, AcctSchema as,
+  /*
+   * Creates accounting related to a bank fee transaction
+   */
+  @Deprecated
+  public Fact createFactFee(DocLine_FINFinAccTransaction docline,
+      FIN_FinaccTransaction transaction, AcctSchema as, ConnectionProvider conn, Fact fact)
+      throws ServletException {
+    return createFactFee(transaction, as, conn, fact);
+  }
+
+  public Fact createFactPaymentDetails(AcctSchema as, ConnectionProvider conn, Fact fact)
+      throws ServletException {
+    FIN_FinaccTransaction transaction = OBDal.getInstance().get(FIN_FinaccTransaction.class,
+        Record_ID);
+    String Fact_Acct_Group_ID = SequenceIdData.getUUID();
+    if (!getDocumentPaymentConfirmation(transaction.getFinPayment())) {
+      for (int i = 0; p_lines != null && i < p_lines.length; i++) {
+        DocLine_FINFinAccTransaction line = (DocLine_FINFinAccTransaction) p_lines[i];
+        boolean isPrepayment = "Y".equals(line.getIsPrepayment());
+        boolean isReceipt = transaction.getFinPayment().isReceipt();
+        BigDecimal bpamount = new BigDecimal(line.getAmount());
+        if (!"".equals(line.getWriteOffAmt())
+            && ZERO.compareTo(new BigDecimal(line.getWriteOffAmt())) != 0) {
+          fact.createLine(line, getAccount(AcctServer.ACCTTYPE_WriteOffDefault, as, conn),
+              C_Currency_ID, (isReceipt ? line.getWriteOffAmt() : ""), (isReceipt ? "" : line
+                  .getWriteOffAmt()), Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn);
+          bpamount = bpamount.add(new BigDecimal(line.getWriteOffAmt()));
+        }
+        fact.createLine(line, getAccountBPartner(
+            (line.m_C_BPartner_ID == null || line.m_C_BPartner_ID.equals("")) ? this.C_BPartner_ID
+                : line.m_C_BPartner_ID, as, isReceipt, isPrepayment, conn), C_Currency_ID,
+            !isReceipt ? bpamount.toString() : "", isReceipt ? bpamount.toString() : "",
+            Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn);
+      }
+      // Pre-payment is consumed when Used Credit Amount not equals Zero. When consuming Credit no
+      // credit is generated
+      if (transaction.getFinPayment().getUsedCredit().compareTo(ZERO) != 0
+          && transaction.getFinPayment().getGeneratedCredit().compareTo(ZERO) == 0) {
+        fact.createLine(null, getAccountBPartner(C_BPartner_ID, as, transaction.getFinPayment()
+            .isReceipt(), true, conn), C_Currency_ID,
+            (transaction.getFinPayment().isReceipt() ? transaction.getFinPayment().getUsedCredit()
+                .toString() : ""), (transaction.getFinPayment().isReceipt() ? "" : transaction
+                .getFinPayment().getUsedCredit().toString()), Fact_Acct_Group_ID, nextSeqNo(SeqNo),
+            DocumentType, conn);
+      }
+    } else {
+      fact.createLine(null, getAccountPayment(conn, transaction.getFinPayment().getPaymentMethod(),
+          transaction.getFinPayment().getAccount(), as, transaction.getFinPayment().isReceipt()),
+          C_Currency_ID, !transaction.getFinPayment().isReceipt() ? transaction.getFinPayment()
+              .getAmount().toString() : "", transaction.getFinPayment().isReceipt() ? transaction
+              .getFinPayment().getAmount().toString() : "", Fact_Acct_Group_ID, nextSeqNo(SeqNo),
+          DocumentType, conn);
+    }
+    fact.createLine(null, getWithdrawalAccount(as, null, transaction.getAccount(), conn),
+        C_Currency_ID, transaction.getDepositAmount().toString(), transaction.getPaymentAmount()
+            .toString(), Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn);
+
+    SeqNo = "0";
+    return fact;
+  }
+
+  @Deprecated
+  public Fact createFactPaymentDetails(DocLine_FINFinAccTransaction docline, AcctSchema as,
       ConnectionProvider conn, Fact fact) throws ServletException {
-    boolean isPrepayment = "Y".equals(line.getIsPrepayment());
-    BigDecimal paymentAmount = new BigDecimal(line.getPaymentAmount());
-    BigDecimal depositAmount = new BigDecimal(line.getDepositAmount());
-    boolean isReceipt = paymentAmount.compareTo(depositAmount) < 0;
-    String Fact_Acct_Group_ID = SequenceIdData.getUUID();
-    FIN_Payment payment = OBDal.getInstance().get(FIN_Payment.class, line.getFinPaymentId());
-    if (!getDocumentPaymentConfirmation(payment))
-      fact.createLine(line, getAccountBPartner(
-          (line.m_C_BPartner_ID == null || line.m_C_BPartner_ID.equals("")) ? this.C_BPartner_ID
-              : line.m_C_BPartner_ID, as, isReceipt, isPrepayment, conn), C_Currency_ID,
-          !isReceipt ? line.getAmount() : "", isReceipt ? line.getAmount() : "",
-          Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn);
-    else
-      fact.createLine(line, getAccountPayment(conn, payment.getPaymentMethod(), payment
-          .getAccount(), as, isReceipt), C_Currency_ID, !isReceipt ? line.getAmount() : "",
-          isReceipt ? line.getAmount() : "", Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType,
+    return createFactPaymentDetails(as, conn, fact);
+  }
+
+  /*
+   * Creates the accounting for a transaction related directly with a GLItem
+   */
+  public Fact createFactGLItem(AcctSchema as, ConnectionProvider conn, Fact fact)
+      throws ServletException {
+    for (int i = 0; p_lines != null && i < p_lines.length; i++) {
+      DocLine_FINFinAccTransaction line = (DocLine_FINFinAccTransaction) p_lines[i];
+      BigDecimal paymentAmount = new BigDecimal(line.getPaymentAmount());
+      BigDecimal depositAmount = new BigDecimal(line.getDepositAmount());
+      boolean isReceipt = paymentAmount.compareTo(depositAmount) < 0;
+      String Fact_Acct_Group_ID = SequenceIdData.getUUID();
+      if (!"".equals(line.getCGlItemId()))
+        fact.createLine(line, getAccountGLItem(OBDal.getInstance().get(GLItem.class,
+            line.getCGlItemId()), as, isReceipt, conn), C_Currency_ID, line.getPaymentAmount(),
+            line.getDepositAmount(), Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn);
+      FIN_FinaccTransaction transaction = OBDal.getInstance().get(FIN_FinaccTransaction.class,
+          Record_ID);
+      fact.createLine(line, getAccountUponDepositWithdrawal(conn,
+          transaction.getFinPayment() != null ? transaction.getFinPayment().getPaymentMethod()
+              : null, transaction.getAccount(), as, isReceipt), C_Currency_ID, line
+          .getDepositAmount(), line.getPaymentAmount(), Fact_Acct_Group_ID, "999999", DocumentType,
           conn);
-    fact.createLine(line, getAccountUponDepositWithdrawal(conn, payment.getPaymentMethod(), payment
-        .getAccount(), as, isReceipt), C_Currency_ID, isReceipt ? line.getAmount() : "",
-        !isReceipt ? line.getAmount() : "", Fact_Acct_Group_ID, "999999", DocumentType, conn);
-
-    if (payment.getWriteoffAmount() != null
-        && payment.getWriteoffAmount().compareTo(BigDecimal.ZERO) != 0) {
-      fact.createLine(line, getAccount(AcctServer.ACCTTYPE_WriteOffDefault, as, conn),
-          C_Currency_ID, (isReceipt ? line.getWriteOffAmt() : ""), (isReceipt ? "" : line
-              .getWriteOffAmt()), Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn);
     }
     SeqNo = "0";
     return fact;
@@ -327,25 +402,10 @@
   /*
    * Creates the accounting for a transaction related directly with a GLItem
    */
-  public Fact createFactGLItem(DocLine_FINFinAccTransaction line, AcctSchema as,
+  @Deprecated
+  public Fact createFactGLItem(DocLine_FINFinAccTransaction docline, AcctSchema as,
       ConnectionProvider conn, Fact fact) throws ServletException {
-    BigDecimal paymentAmount = new BigDecimal(line.getPaymentAmount());
-    BigDecimal depositAmount = new BigDecimal(line.getDepositAmount());
-    boolean isReceipt = paymentAmount.compareTo(depositAmount) < 0;
-    String Fact_Acct_Group_ID = SequenceIdData.getUUID();
-    if (!"".equals(line.getCGlItemId()))
-      fact.createLine(line, getAccountGLItem(OBDal.getInstance().get(GLItem.class,
-          line.getCGlItemId()), as, isReceipt, conn), C_Currency_ID, line.getPaymentAmount(), line
-          .getDepositAmount(), Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn);
-    FIN_FinaccTransaction transaction = OBDal.getInstance().get(FIN_FinaccTransaction.class,
-        Record_ID);
-    fact.createLine(line,
-        getAccountUponDepositWithdrawal(conn, transaction.getFinPayment() != null ? transaction
-            .getFinPayment().getPaymentMethod() : null, transaction.getAccount(), as, isReceipt),
-        C_Currency_ID, line.getDepositAmount(), line.getPaymentAmount(), Fact_Acct_Group_ID,
-        "999999", DocumentType, conn);
-    SeqNo = "0";
-    return fact;
+    return createFactGLItem(as, conn, fact);
   }
 
   public String nextSeqNo(String oldSeqNo) {
@@ -355,7 +415,7 @@
   }
 
   /**
-   * Get Source Currency Balance - subtracts line amounts from total - no rounding
+   * Get Source Currency Balance - subtracts line amounts from total + usedCredit - no rounding
    * 
    * @return positive amount, if total is bigger than lines
    */
@@ -365,7 +425,9 @@
     StringBuffer sb = new StringBuffer(" [");
     // Total
     retValue = retValue.add(new BigDecimal(getAmount(AcctServer.AMTTYPE_Gross)));
-    sb.append(getAmount(AcctServer.AMTTYPE_Gross));
+    if (usedCredit.compareTo(ZERO) != 0 && generatedCredit.compareTo(ZERO) == 0)
+      retValue.add(usedCredit);
+    sb.append(retValue);
     // - Lines
     for (int i = 0; i < p_lines.length; i++) {
       BigDecimal lineBalance = new BigDecimal(
@@ -630,6 +692,15 @@
       // FieldProviderFactory.setField(data[0], "User2_ID", transaction.getNdDimension().getId());
       FieldProviderFactory.setField(data[0], "FIN_Payment_ID",
           transaction.getFinPayment() != null ? transaction.getFinPayment().getId() : "");
+      FieldProviderFactory.setField(data[0], "C_BPartner_ID",
+          transaction.getFinPayment() != null ? transaction.getFinPayment().getBusinessPartner()
+              .getId() : "");
+      FieldProviderFactory.setField(data[0], "UsedCredit",
+          transaction.getFinPayment() != null ? transaction.getFinPayment().getUsedCredit()
+              .toString() : "");
+      FieldProviderFactory.setField(data[0], "GeneratedCredit",
+          transaction.getFinPayment() != null ? transaction.getFinPayment().getGeneratedCredit()
+              .toString() : "");
       String dateFormat = OBPropertiesProvider.getInstance().getOpenbravoProperties().getProperty(
           "dateFormat.java");
       SimpleDateFormat outputFormat = new SimpleDateFormat(dateFormat);
--- a/src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java	Mon Sep 13 20:27:46 2010 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocFINPayment.java	Wed Sep 15 18:54:59 2010 +0000
@@ -55,6 +55,8 @@
   static Logger log4j = Logger.getLogger(DocFINPayment.class);
 
   String SeqNo = "0";
+  String generatedAmount = "";
+  String usedAmount = "";
 
   public DocFINPayment() {
   }
@@ -67,6 +69,8 @@
   public boolean loadDocumentDetails(FieldProvider[] data, ConnectionProvider conn) {
     DateDoc = data[0].getField("PaymentDate");
     Amounts[AMTTYPE_Gross] = data[0].getField("Amount");
+    generatedAmount = data[0].getField("GeneratedCredit");
+    usedAmount = data[0].getField("UsedCredit");
     loadDocumentType();
     p_lines = loadLines();
     return true;
@@ -82,6 +86,10 @@
     OBContext.setAdminMode();
     try {
       for (int i = 0; i < data.length; i++) {
+        // Details refunded used credit are excluded as the entry will be created using the credit
+        // used
+        if (paymentDetails.get(i).isRefund() && paymentDetails.get(i).isPrepayment())
+          continue;
         data[i] = new FieldProviderFactory(new HashMap());
         FieldProviderFactory.setField(data[i], "AD_Client_ID", paymentDetails.get(i).getClient()
             .getId());
@@ -115,6 +123,8 @@
     if (data == null || data.length == 0)
       return null;
     for (int i = 0; i < data.length; i++) {
+      if (data[i] == null)
+        continue;
       String Line_ID = data[i].getField("FIN_Payment_Detail_ID");
       DocLine_FINPayment docLine = new DocLine_FINPayment(DocumentType, Record_ID, Line_ID);
       docLine.loadAttributes(data[i], this);
@@ -185,7 +195,7 @@
 
         String bpAmount = line.getAmount();
         if (line.WriteOffAmt != null && !line.WriteOffAmt.equals("")
-            && !line.WriteOffAmt.equals("0")) {
+            && new BigDecimal(line.WriteOffAmt).compareTo(ZERO) != 0) {
           fact.createLine(line, getAccount(AcctServer.ACCTTYPE_WriteOffDefault, as, conn),
               C_Currency_ID, (isReceipt ? line.WriteOffAmt : ""), (isReceipt ? ""
                   : line.WriteOffAmt), Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn);
@@ -205,10 +215,20 @@
               : bpAmount), (isReceipt ? bpAmount : ""), Fact_Acct_Group_ID, nextSeqNo(SeqNo),
               DocumentType, conn);
         }
-        FIN_Payment payment = OBDal.getInstance().get(FIN_Payment.class, Record_ID);
-        fact.createLine(line, getAccount(conn, payment.getPaymentMethod(), payment.getAccount(),
-            as, isReceipt), C_Currency_ID, (isReceipt ? line.getAmount() : ""), (isReceipt ? ""
-            : line.getAmount()), Fact_Acct_Group_ID, "999999", DocumentType, conn);
+      }
+      FIN_Payment payment = OBDal.getInstance().get(FIN_Payment.class, Record_ID);
+      fact.createLine(null, getAccount(conn, payment.getPaymentMethod(), payment.getAccount(), as,
+          payment.isReceipt()), C_Currency_ID, (payment.isReceipt() ? Amounts[AMTTYPE_Gross] : ""),
+          (payment.isReceipt() ? "" : Amounts[AMTTYPE_Gross]), Fact_Acct_Group_ID, "999999",
+          DocumentType, conn);
+      // Pre-payment is consumed when Used Credit Amount not equals Zero. When consuming Credit no
+      // credit is generated
+      if (new BigDecimal(usedAmount).compareTo(ZERO) != 0
+          && new BigDecimal(generatedAmount).compareTo(ZERO) == 0) {
+        fact.createLine(null,
+            getAccountBPartner(C_BPartner_ID, as, payment.isReceipt(), true, conn), C_Currency_ID,
+            (payment.isReceipt() ? usedAmount : ""), (payment.isReceipt() ? "" : usedAmount),
+            Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn);
       }
     } finally {
       OBContext.restorePreviousMode();
@@ -291,6 +311,13 @@
                 && account.getClearedPaymentAccountOUT() != null)
               confirmation = true;
           }
+          // For payments with Amount ZERO which consumes credit always create an entry for the
+          // consumption as no transaction will be created
+          if (payment.getGeneratedCredit().compareTo(ZERO) == 0
+              && payment.getUsedCredit().compareTo(ZERO) != 0
+              && payment.getAmount().compareTo(ZERO) == 0) {
+            confirmation = true;
+          }
         }
       }
     } catch (Exception e) {
@@ -323,6 +350,9 @@
     FieldProviderFactory.setField(data[0], "C_DocType_ID", payment.getDocumentType().getId());
     FieldProviderFactory.setField(data[0], "C_Currency_ID", payment.getCurrency().getId());
     FieldProviderFactory.setField(data[0], "Amount", payment.getAmount().toString());
+    FieldProviderFactory.setField(data[0], "GeneratedCredit", payment.getGeneratedCredit()
+        .toString());
+    FieldProviderFactory.setField(data[0], "UsedCredit", payment.getUsedCredit().toString());
     FieldProviderFactory.setField(data[0], "WriteOffAmt", payment.getWriteoffAmount().toString());
     FieldProviderFactory.setField(data[0], "Description", payment.getDescription());
     FieldProviderFactory.setField(data[0], "Posted", payment.getPosted());
--- a/src/org/openbravo/erpCommon/ad_forms/DocFINReconciliation.java	Mon Sep 13 20:27:46 2010 +0000
+++ b/src/org/openbravo/erpCommon/ad_forms/DocFINReconciliation.java	Wed Sep 15 18:54:59 2010 +0000
@@ -102,7 +102,7 @@
         // If payment exists the payment details are loaded, if not the GLItem info is loaded,
         // finally fee is loaded
         if (payment != null)
-          linesInfo = add(linesInfo, loadLinesPaymentDetailsFieldProvider(transaction));
+          linesInfo = add(linesInfo, loadLinesPaymentFieldProvider(transaction));
         else if (transaction.getGLItem() != null)
           linesInfo = add(linesInfo, loadLinesGLItemFieldProvider(transaction));
         else
@@ -204,6 +204,49 @@
     return data;
   }
 
+  public FieldProviderFactory[] loadLinesPaymentFieldProvider(FIN_FinaccTransaction transaction) {
+    FIN_Payment payment = OBDal.getInstance().get(FIN_Payment.class,
+        transaction.getFinPayment().getId());
+    FieldProviderFactory[] data = new FieldProviderFactory[1];
+    OBContext.setAdminMode();
+    try {
+      for (int i = 0; i < data.length; i++) {
+        data[i] = new FieldProviderFactory(new HashMap());
+        FieldProviderFactory.setField(data[i], "FIN_Reconciliation_ID", transaction
+            .getReconciliation().getId());
+        FieldProviderFactory.setField(data[i], "FIN_Finacc_Transaction_ID", transaction.getId());
+        FieldProviderFactory.setField(data[i], "AD_Client_ID", payment.getClient().getId());
+        FieldProviderFactory.setField(data[i], "AD_Org_ID", payment.getOrganization().getId());
+        FieldProviderFactory.setField(data[i], "FIN_Payment_ID", payment.getId());
+        FieldProviderFactory.setField(data[i], "DepositAmount", transaction.getDepositAmount()
+            .toString());
+        FieldProviderFactory.setField(data[i], "PaymentAmount", transaction.getPaymentAmount()
+            .toString());
+        FieldProviderFactory.setField(data[i], "Amount", payment.getAmount().toString());
+        FieldProviderFactory.setField(data[i], "WriteOffAmt", payment.getWriteoffAmount()
+            .toString());
+        FieldProviderFactory.setField(data[i], "cBpartnerId", payment.getBusinessPartner().getId());
+        FieldProviderFactory.setField(data[i], "adOrgId", transaction.getOrganization().getId());
+        FieldProviderFactory.setField(data[i], "cGlItemId",
+            transaction.getGLItem() != null ? transaction.getGLItem().getId() : data[i]
+                .getField("cGlItemId"));
+        FieldProviderFactory.setField(data[i], "description", transaction.getDescription());
+        FieldProviderFactory.setField(data[i], "cCurrencyId", transaction.getCurrency().getId());
+        if (transaction.getActivity() != null)
+          FieldProviderFactory.setField(data[i], "cActivityId", transaction.getActivity().getId());
+        if (transaction.getProject() != null)
+          FieldProviderFactory.setField(data[i], "cProjectId", transaction.getProject().getId());
+        if (transaction.getSalesCampaign() != null)
+          FieldProviderFactory.setField(data[i], "cCampaignId", transaction.getSalesCampaign()
+              .getId());
+        FieldProviderFactory.setField(data[i], "lineno", transaction.getLineNo().toString());
+      }
+    } finally {
+      OBContext.restorePreviousMode();
+    }
+    return data;
+  }
+
   public FieldProviderFactory[] loadLinesGLItemFieldProvider(FIN_FinaccTransaction transaction) {
     FieldProviderFactory[] data = new FieldProviderFactory[1];
     OBContext.setAdminMode();
@@ -354,10 +397,10 @@
         FIN_FinaccTransaction transaction = OBDal.getInstance().get(FIN_FinaccTransaction.class,
             line.getFinFinAccTransactionId());
         // 3 Scenarios: 1st Bank fee 2nd payment related transaction 3rd GL item transaction
-        if (transaction.getTransactionType().equals(TRXTYPE_BankFee))
+        if (TRXTYPE_BankFee.equals(transaction.getTransactionType()))
           fact = createFactFee(line, as, conn, fact, Fact_Acct_Group_ID);
         else if (!"".equals(line.getFinPaymentId()))
-          fact = createFactPaymentDetails(line, as, conn, fact, Fact_Acct_Group_ID);
+          fact = createFactPayment(line, as, conn, fact, Fact_Acct_Group_ID);
         else
           fact = createFactGLItem(line, as, conn, fact, Fact_Acct_Group_ID);
       }
@@ -389,6 +432,48 @@
     return fact;
   }
 
+  public Fact createFactPayment(DocLine_FINReconciliation line, AcctSchema as,
+      ConnectionProvider conn, Fact fact, String Fact_Acct_Group_ID) throws ServletException {
+    FIN_Payment payment = OBDal.getInstance().get(FIN_Payment.class, line.getFinPaymentId());
+    FIN_FinaccTransaction transaction = OBDal.getInstance().get(FIN_FinaccTransaction.class,
+        line.getFinFinAccTransactionId());
+    if (getDocumentTransactionConfirmation(transaction))
+      fact.createLine(line, getAccountTransactionPayment(conn, payment, as), C_Currency_ID,
+          !payment.isReceipt() ? line.getAmount() : "",
+          payment.isReceipt() ? line.getAmount() : "", Fact_Acct_Group_ID, nextSeqNo(SeqNo),
+          DocumentType, conn);
+    else if (!getDocumentPaymentConfirmation(payment)) {
+      FieldProviderFactory[] data = loadLinesPaymentDetailsFieldProvider(transaction);
+      for (int i = 0; i < data.length; i++) {
+        FIN_PaymentDetail paymentDetail = OBDal.getInstance().get(FIN_PaymentDetail.class,
+            data[i].getField("FIN_Payment_Detail_ID"));
+        fact = createFactPaymentDetails(line, paymentDetail, as, conn, fact, Fact_Acct_Group_ID);
+      }
+    } else {
+      fact.createLine(line, getAccountPayment(conn, payment, as), C_Currency_ID, !payment
+          .isReceipt() ? line.getAmount() : "", payment.isReceipt() ? line.getAmount() : "",
+          Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn);
+    }
+    fact.createLine(line, getAccountReconciliation(conn, payment, as), C_Currency_ID, payment
+        .isReceipt() ? line.getAmount() : "", !payment.isReceipt() ? line.getAmount() : "",
+        Fact_Acct_Group_ID, "999999", DocumentType, conn);
+    if (!getDocumentPaymentConfirmation(payment)
+        && !getDocumentTransactionConfirmation(transaction)) {
+      // Pre-payment is consumed when Used Credit Amount not equals Zero. When consuming Credit no
+      // credit is generated
+      if (payment.getUsedCredit().compareTo(ZERO) != 0
+          && payment.getGeneratedCredit().compareTo(ZERO) == 0) {
+        fact.createLine(null, getAccountBPartner(payment.getBusinessPartner().getId(), as, payment
+            .isReceipt(), true, conn), C_Currency_ID, (payment.isReceipt() ? payment
+            .getUsedCredit().toString() : ""), (payment.isReceipt() ? "" : payment.getUsedCredit()
+            .toString()), Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn);
+      }
+    }
+    SeqNo = "0";
+    return fact;
+  }
+
+  @Deprecated
   public Fact createFactPaymentDetails(DocLine_FINReconciliation line, AcctSchema as,
       ConnectionProvider conn, Fact fact, String Fact_Acct_Group_ID) throws ServletException {
     boolean isPrepayment = "Y".equals(line.getIsPrepayment());
@@ -402,26 +487,51 @@
       fact.createLine(line, getAccountTransactionPayment(conn, payment, as), C_Currency_ID,
           !isReceipt ? line.getAmount() : "", isReceipt ? line.getAmount() : "",
           Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn);
-    else if (!getDocumentPaymentConfirmation(payment))
+    else if (!getDocumentPaymentConfirmation(payment)) {
+      BigDecimal bpAmount = new BigDecimal(line.getAmount());
+      if (line.getWriteOffAmt() != null
+          && ZERO.compareTo(new BigDecimal(line.getWriteOffAmt())) != 0) {
+        fact.createLine(line, getAccount(AcctServer.ACCTTYPE_WriteOffDefault, as, conn),
+            C_Currency_ID, (isReceipt ? line.getWriteOffAmt() : ""), (isReceipt ? "" : line
+                .getWriteOffAmt()), Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn);
+        bpAmount = bpAmount.add(new BigDecimal(line.getWriteOffAmt()));
+      }
       fact.createLine(line, getAccountBPartner(
           (line.m_C_BPartner_ID == null || line.m_C_BPartner_ID.equals("")) ? this.C_BPartner_ID
               : line.m_C_BPartner_ID, as, isReceipt, isPrepayment, conn), C_Currency_ID,
           !isReceipt ? line.getAmount() : "", isReceipt ? line.getAmount() : "",
           Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn);
-    else
+    } else {
       fact.createLine(line, getAccountPayment(conn, payment, as), C_Currency_ID, !isReceipt ? line
           .getAmount() : "", isReceipt ? line.getAmount() : "", Fact_Acct_Group_ID,
           nextSeqNo(SeqNo), DocumentType, conn);
-    fact.createLine(line, getAccount(conn, payment.getAccount(), as, isReceipt), C_Currency_ID,
-        isReceipt ? line.getAmount() : "", !isReceipt ? line.getAmount() : "", Fact_Acct_Group_ID,
-        "999999", DocumentType, conn);
+    }
 
-    if (payment.getWriteoffAmount() != null
-        && payment.getWriteoffAmount().compareTo(BigDecimal.ZERO) != 0) {
+    SeqNo = "0";
+    return fact;
+  }
+
+  public Fact createFactPaymentDetails(DocLine_FINReconciliation line,
+      FIN_PaymentDetail paymentDetail, AcctSchema as, ConnectionProvider conn, Fact fact,
+      String Fact_Acct_Group_ID) throws ServletException {
+    boolean isPrepayment = paymentDetail.isPrepayment();
+    boolean isReceipt = paymentDetail.getFinPayment().isReceipt();
+    BigDecimal bpAmount = paymentDetail.getAmount();
+    if (paymentDetail.getWriteoffAmount() != null
+        && paymentDetail.getWriteoffAmount().compareTo(BigDecimal.ZERO) != 0) {
       fact.createLine(line, getAccount(AcctServer.ACCTTYPE_WriteOffDefault, as, conn),
-          C_Currency_ID, (isReceipt ? line.getWriteOffAmt() : ""), (isReceipt ? "" : line
-              .getWriteOffAmt()), Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn);
+          C_Currency_ID, (isReceipt ? paymentDetail.getWriteoffAmount().toString() : ""),
+          (isReceipt ? "" : paymentDetail.getWriteoffAmount().toString()), Fact_Acct_Group_ID,
+          nextSeqNo(SeqNo), DocumentType, conn);
+      bpAmount = bpAmount.add(paymentDetail.getWriteoffAmount());
     }
+    fact.createLine(line,
+        getAccountBPartner(
+            (line.m_C_BPartner_ID == null || line.m_C_BPartner_ID.equals("")) ? this.C_BPartner_ID
+                : line.m_C_BPartner_ID, as, isReceipt, isPrepayment, conn), C_Currency_ID,
+        !isReceipt ? bpAmount.toString() : "", isReceipt ? bpAmount.toString() : "",
+        Fact_Acct_Group_ID, nextSeqNo(SeqNo), DocumentType, conn);
+
     SeqNo = "0";
     return fact;
   }
@@ -905,4 +1015,52 @@
     return account;
   }
 
+  public Account getAccountReconciliation(ConnectionProvider conn, FIN_Payment payment,
+      AcctSchema as) throws ServletException {
+    OBContext.setAdminMode();
+    Account account = null;
+    AccountingCombination result = null;
+    try {
+      OBCriteria<FinAccPaymentMethod> obCriteria = OBDal.getInstance().createCriteria(
+          FinAccPaymentMethod.class);
+      obCriteria.add(Expression.eq(FinAccPaymentMethod.PROPERTY_ACCOUNT, payment.getAccount()));
+      obCriteria.add(Expression.eq(FinAccPaymentMethod.PROPERTY_PAYMENTMETHOD, payment
+          .getPaymentMethod()));
+      obCriteria.setFilterOnReadableClients(false);
+      obCriteria.setFilterOnReadableOrganization(false);
+      List<FinAccPaymentMethod> lines = obCriteria.list();
+      OBCriteria<FIN_FinancialAccountAccounting> accounts = OBDal.getInstance().createCriteria(
+          FIN_FinancialAccountAccounting.class);
+      accounts.add(Expression.eq(FIN_FinancialAccountAccounting.PROPERTY_ACCOUNT, payment
+          .getAccount()));
+      accounts.add(Expression.eq(FIN_FinancialAccountAccounting.PROPERTY_ACCOUNTINGSCHEMA, OBDal
+          .getInstance().get(org.openbravo.model.financialmgmt.accounting.coa.AcctSchema.class,
+              as.m_C_AcctSchema_ID)));
+      accounts.add(Expression.eq(FIN_FinancialAccountAccounting.PROPERTY_ACTIVE, true));
+      accounts.setFilterOnReadableClients(false);
+      accounts.setFilterOnReadableOrganization(false);
+      List<FIN_FinancialAccountAccounting> accountList = accounts.list();
+      if (payment.isReceipt()) {
+        if (("INT").equals(lines.get(0).getINUponClearingUse()))
+          result = accountList.get(0).getInTransitPaymentAccountIN();
+        else if (("DEP").equals(lines.get(0).getINUponClearingUse()))
+          result = accountList.get(0).getDepositAccount();
+        else if (("CLE").equals(lines.get(0).getINUponClearingUse()))
+          result = accountList.get(0).getClearedPaymentAccount();
+      } else {
+        if (("INT").equals(lines.get(0).getINUponClearingUse()))
+          result = accountList.get(0).getFINOutIntransitAcct();
+        else if (("WIT").equals(lines.get(0).getINUponClearingUse()))
+          result = accountList.get(0).getWithdrawalAccount();
+        else if (("CLE").equals(lines.get(0).getINUponClearingUse()))
+          result = accountList.get(0).getClearedPaymentAccountOUT();
+      }
+      if (result != null)
+        account = new Account(conn, result.getId());
+    } finally {
+      OBContext.restorePreviousMode();
+    }
+    return account;
+  }
+
 }
\ No newline at end of file
--- a/src/org/openbravo/erpCommon/ad_reports/ReportAcctRedirectUtility.java	Mon Sep 13 20:27:46 2010 +0000
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportAcctRedirectUtility.java	Wed Sep 15 18:54:59 2010 +0000
@@ -57,9 +57,12 @@
         String strWindowPath = Utility.getTabURL(this, data[0].adTabId, "R");
         if (strWindowPath.equals(""))
           strWindowPath = strDefaultServlet;
+        if (!"FAT".equals(strDocBaseType))
+          response.sendRedirect(strWindowPath + "?" + "Command=DIRECT&" + inputName + "="
+              + strRecordId);
+        else
+          response.sendRedirect(strWindowPath + "?" + "Command=TAB");
 
-        response.sendRedirect(strWindowPath + "?" + "Command=DIRECT&" + inputName + "="
-            + strRecordId);
       }
     } else
       pageError(response);
@@ -70,9 +73,15 @@
    * view and not directly with a table)
    */
   String convertTableException(String strTableId) {
-    if ("B1B7075C46934F0A9FD4C4D0F1457B42".equals(strTableId))
+    if ("B1B7075C46934F0A9FD4C4D0F1457B42".equals(strTableId)) {
+      // Reconciliation as tab is built through a view and not directly with a table
       return "0DFF5BACFB964FDABAA5042C8809C813";
-    else
+    } else if ("4D8C3B3C31D1410DA046140C9F024D17".equals(strTableId)) {
+      // Transactions as tab is built through a different table, Financial account, as a workaround
+      // to
+      // avoid wrong behavior
+      return "B129E53BC0E747879F7BA17F0AECEC32";
+    } else
       return strTableId;
   }
 
--- a/src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.java	Mon Sep 13 20:27:46 2010 +0000
+++ b/src/org/openbravo/erpCommon/ad_reports/ReportTrialBalance.java	Wed Sep 15 18:54:59 2010 +0000
@@ -375,9 +375,15 @@
       xmlDocument.setParameter("messageMessage", myMessage.getMessage());
     }
 
-    // Organization * is not shown
-    xmlDocument.setData("reportAD_ORGID", "liststructure", OrganizationComboData.selectCombo(this,
-        vars.getRole()));
+    try {
+      ComboTableData comboTableData = new ComboTableData(vars, this, "TABLEDIR", "AD_ORG_ID", "",
+          "", Utility.getContext(this, vars, "#AccessibleOrgTree", "ReportTrialBalance"),
+          Utility.getContext(this, vars, "#User_Client", "ReportTrialBalance"), '*');
+      comboTableData.fillParameters(null, "ReportTrialBalance", "");
+      xmlDocument.setData("reportAD_ORGID", "liststructure", comboTableData.select(false));
+    } catch (Exception ex) {
+      throw new ServletException(ex);
+    }
 
     xmlDocument.setData("reportC_ACCTSCHEMA_ID", "liststructure", AccountingSchemaMiscData
         .selectC_ACCTSCHEMA_ID(this, Utility.getContext(this, vars, "#AccessibleOrgTree",
--- a/src/org/openbravo/service/system/SystemValidationTask.java	Mon Sep 13 20:27:46 2010 +0000
+++ b/src/org/openbravo/service/system/SystemValidationTask.java	Wed Sep 15 18:54:59 2010 +0000
@@ -84,8 +84,9 @@
         Platform platform = getPlatform();
         String dbPrefix = module.getModuleDBPrefixList().get(0).getName();
 
-        String excludeobjects = "com.openbravo.db.OpenbravoExcludeFilter";
-        DBSMOBUtil.getInstance().getModules(platform, excludeobjects);
+        ExcludeFilter excludeFilter;
+        excludeFilter = DBSMOBUtil.getInstance().getExcludeFilter(getProject().getBaseDir());
+        DBSMOBUtil.getInstance().getModules(platform, excludeFilter);
         final ModuleRow row = DBSMOBUtil.getInstance().getRowFromDir(module.getJavaPackage());
         ExcludeFilter filter = row.filter;