diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_ELEMENT.xml
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_ELEMENT.xml	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_ELEMENT.xml	Thu Sep 11 12:13:21 2014 +0200
@@ -88,6 +88,20 @@
 <!--2C70D5BAFED340D68C564DA5C3F15A7E-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--2C70D5BAFED340D68C564DA5C3F15A7E--></AD_ELEMENT>
 
+<!--2CFD3BE7B8D0441BBF151920E5BC384F--><AD_ELEMENT>
+<!--2CFD3BE7B8D0441BBF151920E5BC384F-->  <AD_ELEMENT_ID><![CDATA[2CFD3BE7B8D0441BBF151920E5BC384F]]></AD_ELEMENT_ID>
+<!--2CFD3BE7B8D0441BBF151920E5BC384F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--2CFD3BE7B8D0441BBF151920E5BC384F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--2CFD3BE7B8D0441BBF151920E5BC384F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--2CFD3BE7B8D0441BBF151920E5BC384F-->  <COLUMNNAME><![CDATA[fin_financial_account_id_readonly_logic]]></COLUMNNAME>
+<!--2CFD3BE7B8D0441BBF151920E5BC384F-->  <NAME><![CDATA[Deposit To Read Only Logic]]></NAME>
+<!--2CFD3BE7B8D0441BBF151920E5BC384F-->  <PRINTNAME><![CDATA[Deposit To Read Only Logic]]></PRINTNAME>
+<!--2CFD3BE7B8D0441BBF151920E5BC384F-->  <DESCRIPTION><![CDATA[Parameter used to implement Read Only Logic on Financial Account]]></DESCRIPTION>
+<!--2CFD3BE7B8D0441BBF151920E5BC384F-->  <HELP><![CDATA[Parameter used to implement Read Only Logic on Financial Account]]></HELP>
+<!--2CFD3BE7B8D0441BBF151920E5BC384F-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--2CFD3BE7B8D0441BBF151920E5BC384F-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--2CFD3BE7B8D0441BBF151920E5BC384F--></AD_ELEMENT>
+
 <!--2D1363BA8FFD443D89B0F2C92FD2BBC4--><AD_ELEMENT>
 <!--2D1363BA8FFD443D89B0F2C92FD2BBC4-->  <AD_ELEMENT_ID><![CDATA[2D1363BA8FFD443D89B0F2C92FD2BBC4]]></AD_ELEMENT_ID>
 <!--2D1363BA8FFD443D89B0F2C92FD2BBC4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -102,6 +116,20 @@
 <!--2D1363BA8FFD443D89B0F2C92FD2BBC4-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--2D1363BA8FFD443D89B0F2C92FD2BBC4--></AD_ELEMENT>
 
+<!--349748D8346C46B1A4A652BC15F98EBB--><AD_ELEMENT>
+<!--349748D8346C46B1A4A652BC15F98EBB-->  <AD_ELEMENT_ID><![CDATA[349748D8346C46B1A4A652BC15F98EBB]]></AD_ELEMENT_ID>
+<!--349748D8346C46B1A4A652BC15F98EBB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--349748D8346C46B1A4A652BC15F98EBB-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--349748D8346C46B1A4A652BC15F98EBB-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--349748D8346C46B1A4A652BC15F98EBB-->  <COLUMNNAME><![CDATA[actual_payment_readonly_logic]]></COLUMNNAME>
+<!--349748D8346C46B1A4A652BC15F98EBB-->  <NAME><![CDATA[Actual Payment Read Only Logic]]></NAME>
+<!--349748D8346C46B1A4A652BC15F98EBB-->  <PRINTNAME><![CDATA[Actual Payment Read Only Logic]]></PRINTNAME>
+<!--349748D8346C46B1A4A652BC15F98EBB-->  <DESCRIPTION><![CDATA[Parameter used to implement Read Only Logic on Actual Payment]]></DESCRIPTION>
+<!--349748D8346C46B1A4A652BC15F98EBB-->  <HELP><![CDATA[Parameter used to implement Read Only Logic on Actual Payment]]></HELP>
+<!--349748D8346C46B1A4A652BC15F98EBB-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--349748D8346C46B1A4A652BC15F98EBB-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--349748D8346C46B1A4A652BC15F98EBB--></AD_ELEMENT>
+
 <!--36C60E53F1274EDA827ED5146A2B13D1--><AD_ELEMENT>
 <!--36C60E53F1274EDA827ED5146A2B13D1-->  <AD_ELEMENT_ID><![CDATA[36C60E53F1274EDA827ED5146A2B13D1]]></AD_ELEMENT_ID>
 <!--36C60E53F1274EDA827ED5146A2B13D1-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -156,6 +184,20 @@
 <!--429B447E4FE9420287E1EEB75DC341E9-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--429B447E4FE9420287E1EEB75DC341E9--></AD_ELEMENT>
 
+<!--458D63E9F9D541F7A06B341305ACCB66--><AD_ELEMENT>
+<!--458D63E9F9D541F7A06B341305ACCB66-->  <AD_ELEMENT_ID><![CDATA[458D63E9F9D541F7A06B341305ACCB66]]></AD_ELEMENT_ID>
+<!--458D63E9F9D541F7A06B341305ACCB66-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--458D63E9F9D541F7A06B341305ACCB66-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--458D63E9F9D541F7A06B341305ACCB66-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--458D63E9F9D541F7A06B341305ACCB66-->  <COLUMNNAME><![CDATA[payment_method_readonly_logic]]></COLUMNNAME>
+<!--458D63E9F9D541F7A06B341305ACCB66-->  <NAME><![CDATA[Payment Method Read Only Logic]]></NAME>
+<!--458D63E9F9D541F7A06B341305ACCB66-->  <PRINTNAME><![CDATA[Payment Method Read Only Logic]]></PRINTNAME>
+<!--458D63E9F9D541F7A06B341305ACCB66-->  <DESCRIPTION><![CDATA[Parameter used to implement Read Only Logic on Payment Method]]></DESCRIPTION>
+<!--458D63E9F9D541F7A06B341305ACCB66-->  <HELP><![CDATA[Parameter used to implement Read Only Logic on Payment Method]]></HELP>
+<!--458D63E9F9D541F7A06B341305ACCB66-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--458D63E9F9D541F7A06B341305ACCB66-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--458D63E9F9D541F7A06B341305ACCB66--></AD_ELEMENT>
+
 <!--4636FFBE88B64C9C990F76457F0D521E--><AD_ELEMENT>
 <!--4636FFBE88B64C9C990F76457F0D521E-->  <AD_ELEMENT_ID><![CDATA[4636FFBE88B64C9C990F76457F0D521E]]></AD_ELEMENT_ID>
 <!--4636FFBE88B64C9C990F76457F0D521E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -208,6 +250,34 @@
 <!--519F3CD67106443CBF25694F1BB6E92B-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--519F3CD67106443CBF25694F1BB6E92B--></AD_ELEMENT>
 
+<!--51F0875CB4114D90A239FBCA54B5C1AB--><AD_ELEMENT>
+<!--51F0875CB4114D90A239FBCA54B5C1AB-->  <AD_ELEMENT_ID><![CDATA[51F0875CB4114D90A239FBCA54B5C1AB]]></AD_ELEMENT_ID>
+<!--51F0875CB4114D90A239FBCA54B5C1AB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--51F0875CB4114D90A239FBCA54B5C1AB-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--51F0875CB4114D90A239FBCA54B5C1AB-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--51F0875CB4114D90A239FBCA54B5C1AB-->  <COLUMNNAME><![CDATA[overpayment_action_display_logic]]></COLUMNNAME>
+<!--51F0875CB4114D90A239FBCA54B5C1AB-->  <NAME><![CDATA[Overpayment Action Display Logic]]></NAME>
+<!--51F0875CB4114D90A239FBCA54B5C1AB-->  <PRINTNAME><![CDATA[Overpayment Action Display Logic]]></PRINTNAME>
+<!--51F0875CB4114D90A239FBCA54B5C1AB-->  <DESCRIPTION><![CDATA[Parameter used to implement Display Logic on Overpayment Action]]></DESCRIPTION>
+<!--51F0875CB4114D90A239FBCA54B5C1AB-->  <HELP><![CDATA[Parameter used to implement Display Logic on Overpayment Action]]></HELP>
+<!--51F0875CB4114D90A239FBCA54B5C1AB-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--51F0875CB4114D90A239FBCA54B5C1AB-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--51F0875CB4114D90A239FBCA54B5C1AB--></AD_ELEMENT>
+
+<!--52F85707307D4FC5923B7CA29B8D8A87--><AD_ELEMENT>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <AD_ELEMENT_ID><![CDATA[52F85707307D4FC5923B7CA29B8D8A87]]></AD_ELEMENT_ID>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <COLUMNNAME><![CDATA[c_currency_id_readonly_logic]]></COLUMNNAME>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <NAME><![CDATA[Currency Read Only Logic]]></NAME>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <PRINTNAME><![CDATA[Currency Read Only Logic]]></PRINTNAME>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <DESCRIPTION><![CDATA[Parameter used to implement Read Only Logic on Currency param]]></DESCRIPTION>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <HELP><![CDATA[Parameter used to implement Read Only Logic on Currency param]]></HELP>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--52F85707307D4FC5923B7CA29B8D8A87-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--52F85707307D4FC5923B7CA29B8D8A87--></AD_ELEMENT>
+
 <!--533E204A46FD4BB9AED3D9FC26EEC67C--><AD_ELEMENT>
 <!--533E204A46FD4BB9AED3D9FC26EEC67C-->  <AD_ELEMENT_ID><![CDATA[533E204A46FD4BB9AED3D9FC26EEC67C]]></AD_ELEMENT_ID>
 <!--533E204A46FD4BB9AED3D9FC26EEC67C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -308,6 +378,20 @@
 <!--64B01B6184B84599B2B073BC7971EA19-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--64B01B6184B84599B2B073BC7971EA19--></AD_ELEMENT>
 
+<!--6548FAC738E2475F866F132AF5CF5532--><AD_ELEMENT>
+<!--6548FAC738E2475F866F132AF5CF5532-->  <AD_ELEMENT_ID><![CDATA[6548FAC738E2475F866F132AF5CF5532]]></AD_ELEMENT_ID>
+<!--6548FAC738E2475F866F132AF5CF5532-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--6548FAC738E2475F866F132AF5CF5532-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--6548FAC738E2475F866F132AF5CF5532-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--6548FAC738E2475F866F132AF5CF5532-->  <COLUMNNAME><![CDATA[received_from_readonly_logic]]></COLUMNNAME>
+<!--6548FAC738E2475F866F132AF5CF5532-->  <NAME><![CDATA[Received From Read Only Logic]]></NAME>
+<!--6548FAC738E2475F866F132AF5CF5532-->  <PRINTNAME><![CDATA[Received From Read Only Logic]]></PRINTNAME>
+<!--6548FAC738E2475F866F132AF5CF5532-->  <DESCRIPTION><![CDATA[Parameter used to implement Read Only Logic on Business Partner]]></DESCRIPTION>
+<!--6548FAC738E2475F866F132AF5CF5532-->  <HELP><![CDATA[Parameter used to implement Read Only Logic on Business Partner]]></HELP>
+<!--6548FAC738E2475F866F132AF5CF5532-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--6548FAC738E2475F866F132AF5CF5532-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--6548FAC738E2475F866F132AF5CF5532--></AD_ELEMENT>
+
 <!--6BC644F4DC3248E2998DE88C055826B2--><AD_ELEMENT>
 <!--6BC644F4DC3248E2998DE88C055826B2-->  <AD_ELEMENT_ID><![CDATA[6BC644F4DC3248E2998DE88C055826B2]]></AD_ELEMENT_ID>
 <!--6BC644F4DC3248E2998DE88C055826B2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -322,6 +406,20 @@
 <!--6BC644F4DC3248E2998DE88C055826B2-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--6BC644F4DC3248E2998DE88C055826B2--></AD_ELEMENT>
 
+<!--6C4509E308444DE0B928E1C25A80CD74--><AD_ELEMENT>
+<!--6C4509E308444DE0B928E1C25A80CD74-->  <AD_ELEMENT_ID><![CDATA[6C4509E308444DE0B928E1C25A80CD74]]></AD_ELEMENT_ID>
+<!--6C4509E308444DE0B928E1C25A80CD74-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--6C4509E308444DE0B928E1C25A80CD74-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--6C4509E308444DE0B928E1C25A80CD74-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--6C4509E308444DE0B928E1C25A80CD74-->  <COLUMNNAME><![CDATA[payment_date_readonly_logic]]></COLUMNNAME>
+<!--6C4509E308444DE0B928E1C25A80CD74-->  <NAME><![CDATA[Payment Date Read Only Logic]]></NAME>
+<!--6C4509E308444DE0B928E1C25A80CD74-->  <PRINTNAME><![CDATA[Payment Date Read Only Logic]]></PRINTNAME>
+<!--6C4509E308444DE0B928E1C25A80CD74-->  <DESCRIPTION><![CDATA[Parameter used to implement Read Only Logic on Payment Date]]></DESCRIPTION>
+<!--6C4509E308444DE0B928E1C25A80CD74-->  <HELP><![CDATA[Parameter used to implement Read Only Logic on Payment Date]]></HELP>
+<!--6C4509E308444DE0B928E1C25A80CD74-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--6C4509E308444DE0B928E1C25A80CD74-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--6C4509E308444DE0B928E1C25A80CD74--></AD_ELEMENT>
+
 <!--6D7CB8FA9C4644E8B0AFDA576D134B6A--><AD_ELEMENT>
 <!--6D7CB8FA9C4644E8B0AFDA576D134B6A-->  <AD_ELEMENT_ID><![CDATA[6D7CB8FA9C4644E8B0AFDA576D134B6A]]></AD_ELEMENT_ID>
 <!--6D7CB8FA9C4644E8B0AFDA576D134B6A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -336,6 +434,20 @@
 <!--6D7CB8FA9C4644E8B0AFDA576D134B6A-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--6D7CB8FA9C4644E8B0AFDA576D134B6A--></AD_ELEMENT>
 
+<!--6FE34C5D44364DA7B73F2925C1C4467B--><AD_ELEMENT>
+<!--6FE34C5D44364DA7B73F2925C1C4467B-->  <AD_ELEMENT_ID><![CDATA[6FE34C5D44364DA7B73F2925C1C4467B]]></AD_ELEMENT_ID>
+<!--6FE34C5D44364DA7B73F2925C1C4467B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--6FE34C5D44364DA7B73F2925C1C4467B-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--6FE34C5D44364DA7B73F2925C1C4467B-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--6FE34C5D44364DA7B73F2925C1C4467B-->  <COLUMNNAME><![CDATA[conversion_rate_readonly_logic]]></COLUMNNAME>
+<!--6FE34C5D44364DA7B73F2925C1C4467B-->  <NAME><![CDATA[Conversion Rate Read Only Logic]]></NAME>
+<!--6FE34C5D44364DA7B73F2925C1C4467B-->  <PRINTNAME><![CDATA[Conversion Rate Read Only Logic]]></PRINTNAME>
+<!--6FE34C5D44364DA7B73F2925C1C4467B-->  <DESCRIPTION><![CDATA[Parameter used to implement Read Only Logic on Conversion Rate]]></DESCRIPTION>
+<!--6FE34C5D44364DA7B73F2925C1C4467B-->  <HELP><![CDATA[Parameter used to implement Read Only Logic on Conversion Rate]]></HELP>
+<!--6FE34C5D44364DA7B73F2925C1C4467B-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--6FE34C5D44364DA7B73F2925C1C4467B-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--6FE34C5D44364DA7B73F2925C1C4467B--></AD_ELEMENT>
+
 <!--720C4FC08FBD43419FF7EACABECA6AE3--><AD_ELEMENT>
 <!--720C4FC08FBD43419FF7EACABECA6AE3-->  <AD_ELEMENT_ID><![CDATA[720C4FC08FBD43419FF7EACABECA6AE3]]></AD_ELEMENT_ID>
 <!--720C4FC08FBD43419FF7EACABECA6AE3-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -616,6 +728,20 @@
 <!--87AA1068F10742CAE040007F010011D5-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--87AA1068F10742CAE040007F010011D5--></AD_ELEMENT>
 
+<!--8B17B525CBB345518E99800D610EB93E--><AD_ELEMENT>
+<!--8B17B525CBB345518E99800D610EB93E-->  <AD_ELEMENT_ID><![CDATA[8B17B525CBB345518E99800D610EB93E]]></AD_ELEMENT_ID>
+<!--8B17B525CBB345518E99800D610EB93E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--8B17B525CBB345518E99800D610EB93E-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--8B17B525CBB345518E99800D610EB93E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--8B17B525CBB345518E99800D610EB93E-->  <COLUMNNAME><![CDATA[trxtype]]></COLUMNNAME>
+<!--8B17B525CBB345518E99800D610EB93E-->  <NAME><![CDATA[Document]]></NAME>
+<!--8B17B525CBB345518E99800D610EB93E-->  <PRINTNAME><![CDATA[Document]]></PRINTNAME>
+<!--8B17B525CBB345518E99800D610EB93E-->  <PO_NAME><![CDATA[Document]]></PO_NAME>
+<!--8B17B525CBB345518E99800D610EB93E-->  <PO_PRINTNAME><![CDATA[Document]]></PO_PRINTNAME>
+<!--8B17B525CBB345518E99800D610EB93E-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--8B17B525CBB345518E99800D610EB93E-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--8B17B525CBB345518E99800D610EB93E--></AD_ELEMENT>
+
 <!--8B4372E6182C902CE040007F01000EB9--><AD_ELEMENT>
 <!--8B4372E6182C902CE040007F01000EB9-->  <AD_ELEMENT_ID><![CDATA[8B4372E6182C902CE040007F01000EB9]]></AD_ELEMENT_ID>
 <!--8B4372E6182C902CE040007F01000EB9-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -845,6 +971,20 @@
 <!--A37C6F84AA463F50E040007F01006E35-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--A37C6F84AA463F50E040007F01006E35--></AD_ELEMENT>
 
+<!--A62C80360F274C44AA6BF58315DF65FF--><AD_ELEMENT>
+<!--A62C80360F274C44AA6BF58315DF65FF-->  <AD_ELEMENT_ID><![CDATA[A62C80360F274C44AA6BF58315DF65FF]]></AD_ELEMENT_ID>
+<!--A62C80360F274C44AA6BF58315DF65FF-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--A62C80360F274C44AA6BF58315DF65FF-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--A62C80360F274C44AA6BF58315DF65FF-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--A62C80360F274C44AA6BF58315DF65FF-->  <COLUMNNAME><![CDATA[converted_amount_readonly_logic]]></COLUMNNAME>
+<!--A62C80360F274C44AA6BF58315DF65FF-->  <NAME><![CDATA[Converted Amount Read Only Logic]]></NAME>
+<!--A62C80360F274C44AA6BF58315DF65FF-->  <PRINTNAME><![CDATA[Converted Amount Read Only Logic]]></PRINTNAME>
+<!--A62C80360F274C44AA6BF58315DF65FF-->  <DESCRIPTION><![CDATA[Parameter used to implement Read Only Logic on Converted Amount]]></DESCRIPTION>
+<!--A62C80360F274C44AA6BF58315DF65FF-->  <HELP><![CDATA[Parameter used to implement Read Only Logic on Converted Amount]]></HELP>
+<!--A62C80360F274C44AA6BF58315DF65FF-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--A62C80360F274C44AA6BF58315DF65FF-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--A62C80360F274C44AA6BF58315DF65FF--></AD_ELEMENT>
+
 <!--AEA679FCC17546268C951135AB611F57--><AD_ELEMENT>
 <!--AEA679FCC17546268C951135AB611F57-->  <AD_ELEMENT_ID><![CDATA[AEA679FCC17546268C951135AB611F57]]></AD_ELEMENT_ID>
 <!--AEA679FCC17546268C951135AB611F57-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -911,6 +1051,20 @@
 <!--C09E18A3FCFEC058E040007F010024F4-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--C09E18A3FCFEC058E040007F010024F4--></AD_ELEMENT>
 
+<!--C128589B1E884C15B1062BC6A698A41E--><AD_ELEMENT>
+<!--C128589B1E884C15B1062BC6A698A41E-->  <AD_ELEMENT_ID><![CDATA[C128589B1E884C15B1062BC6A698A41E]]></AD_ELEMENT_ID>
+<!--C128589B1E884C15B1062BC6A698A41E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--C128589B1E884C15B1062BC6A698A41E-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--C128589B1E884C15B1062BC6A698A41E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--C128589B1E884C15B1062BC6A698A41E-->  <COLUMNNAME><![CDATA[payment_documentno_readonly_logic]]></COLUMNNAME>
+<!--C128589B1E884C15B1062BC6A698A41E-->  <NAME><![CDATA[Payment DocumentNo Read Only Logic]]></NAME>
+<!--C128589B1E884C15B1062BC6A698A41E-->  <PRINTNAME><![CDATA[Payment DocumentNo Read Only Logic]]></PRINTNAME>
+<!--C128589B1E884C15B1062BC6A698A41E-->  <DESCRIPTION><![CDATA[Parameter used to implement Read Only Logic on Payment DocumentNo]]></DESCRIPTION>
+<!--C128589B1E884C15B1062BC6A698A41E-->  <HELP><![CDATA[Parameter used to implement Read Only Logic on Payment DocumentNo]]></HELP>
+<!--C128589B1E884C15B1062BC6A698A41E-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--C128589B1E884C15B1062BC6A698A41E-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--C128589B1E884C15B1062BC6A698A41E--></AD_ELEMENT>
+
 <!--C1DA4E5EEEDE4FE5B2E9411AA411BF67--><AD_ELEMENT>
 <!--C1DA4E5EEEDE4FE5B2E9411AA411BF67-->  <AD_ELEMENT_ID><![CDATA[C1DA4E5EEEDE4FE5B2E9411AA411BF67]]></AD_ELEMENT_ID>
 <!--C1DA4E5EEEDE4FE5B2E9411AA411BF67-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -1021,6 +1175,20 @@
 <!--D42C1F18622F4773989190BB8C2C8436-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--D42C1F18622F4773989190BB8C2C8436--></AD_ELEMENT>
 
+<!--D9E7B70083344E86AF5A6272B2090755--><AD_ELEMENT>
+<!--D9E7B70083344E86AF5A6272B2090755-->  <AD_ELEMENT_ID><![CDATA[D9E7B70083344E86AF5A6272B2090755]]></AD_ELEMENT_ID>
+<!--D9E7B70083344E86AF5A6272B2090755-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--D9E7B70083344E86AF5A6272B2090755-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--D9E7B70083344E86AF5A6272B2090755-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--D9E7B70083344E86AF5A6272B2090755-->  <COLUMNNAME><![CDATA[credit_to_use_display_logic]]></COLUMNNAME>
+<!--D9E7B70083344E86AF5A6272B2090755-->  <NAME><![CDATA[Credit to Use Display Logic]]></NAME>
+<!--D9E7B70083344E86AF5A6272B2090755-->  <PRINTNAME><![CDATA[Credit to Use Display Logic]]></PRINTNAME>
+<!--D9E7B70083344E86AF5A6272B2090755-->  <DESCRIPTION><![CDATA[Parameter used to implement Display Logic on Credit to Use grid]]></DESCRIPTION>
+<!--D9E7B70083344E86AF5A6272B2090755-->  <HELP><![CDATA[Parameter used to implement Display Logic on Credit to Use grid]]></HELP>
+<!--D9E7B70083344E86AF5A6272B2090755-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--D9E7B70083344E86AF5A6272B2090755-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--D9E7B70083344E86AF5A6272B2090755--></AD_ELEMENT>
+
 <!--DABC92A3E32E4DBFB78068CF6A4FBAC7--><AD_ELEMENT>
 <!--DABC92A3E32E4DBFB78068CF6A4FBAC7-->  <AD_ELEMENT_ID><![CDATA[DABC92A3E32E4DBFB78068CF6A4FBAC7]]></AD_ELEMENT_ID>
 <!--DABC92A3E32E4DBFB78068CF6A4FBAC7-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -1107,6 +1275,20 @@
 <!--E33F3B5BAC75488DAAAC10471326EFFA-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--E33F3B5BAC75488DAAAC10471326EFFA--></AD_ELEMENT>
 
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF--><AD_ELEMENT>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <AD_ELEMENT_ID><![CDATA[E9AA03CAEC954FF8B268C2C164BA6CBF]]></AD_ELEMENT_ID>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <COLUMNNAME><![CDATA[ad_org_id_display_logic]]></COLUMNNAME>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <NAME><![CDATA[Organization Display Logic]]></NAME>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <PRINTNAME><![CDATA[Organization Display Logic]]></PRINTNAME>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <DESCRIPTION><![CDATA[Parameter used to implement Display Logic on Organization]]></DESCRIPTION>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <HELP><![CDATA[Parameter used to implement Display Logic on Organization]]></HELP>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--E9AA03CAEC954FF8B268C2C164BA6CBF--></AD_ELEMENT>
+
 <!--EDB9CF491555465382F828F48291A0C0--><AD_ELEMENT>
 <!--EDB9CF491555465382F828F48291A0C0-->  <AD_ELEMENT_ID><![CDATA[EDB9CF491555465382F828F48291A0C0]]></AD_ELEMENT_ID>
 <!--EDB9CF491555465382F828F48291A0C0-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -1147,6 +1329,20 @@
 <!--F3ABC3F6561D43CF8C08E69212487ECE-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--F3ABC3F6561D43CF8C08E69212487ECE--></AD_ELEMENT>
 
+<!--F5888F54E21C4D59ABF5FBFE6474B229--><AD_ELEMENT>
+<!--F5888F54E21C4D59ABF5FBFE6474B229-->  <AD_ELEMENT_ID><![CDATA[F5888F54E21C4D59ABF5FBFE6474B229]]></AD_ELEMENT_ID>
+<!--F5888F54E21C4D59ABF5FBFE6474B229-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--F5888F54E21C4D59ABF5FBFE6474B229-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--F5888F54E21C4D59ABF5FBFE6474B229-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--F5888F54E21C4D59ABF5FBFE6474B229-->  <COLUMNNAME><![CDATA[trxtype_display_logic]]></COLUMNNAME>
+<!--F5888F54E21C4D59ABF5FBFE6474B229-->  <NAME><![CDATA[Document Display Logic]]></NAME>
+<!--F5888F54E21C4D59ABF5FBFE6474B229-->  <PRINTNAME><![CDATA[Document Display Logic]]></PRINTNAME>
+<!--F5888F54E21C4D59ABF5FBFE6474B229-->  <DESCRIPTION><![CDATA[Parameter used to implement Display Logic on Document]]></DESCRIPTION>
+<!--F5888F54E21C4D59ABF5FBFE6474B229-->  <HELP><![CDATA[Parameter used to implement Display Logic on Document]]></HELP>
+<!--F5888F54E21C4D59ABF5FBFE6474B229-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--F5888F54E21C4D59ABF5FBFE6474B229-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--F5888F54E21C4D59ABF5FBFE6474B229--></AD_ELEMENT>
+
 <!--F5D2D2099B7D4949838CA0D405D55BB2--><AD_ELEMENT>
 <!--F5D2D2099B7D4949838CA0D405D55BB2-->  <AD_ELEMENT_ID><![CDATA[F5D2D2099B7D4949838CA0D405D55BB2]]></AD_ELEMENT_ID>
 <!--F5D2D2099B7D4949838CA0D405D55BB2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_FIELD.xml	Thu Sep 11 12:13:21 2014 +0200
@@ -19379,7 +19379,7 @@
 <!--E40D003712A2492395ACB57BFBFE6720-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
 <!--E40D003712A2492395ACB57BFBFE6720-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
 <!--E40D003712A2492395ACB57BFBFE6720-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
-<!--E40D003712A2492395ACB57BFBFE6720-->  <DISPLAYLOGICGRID><![CDATA[@fin_payment_id@]]></DISPLAYLOGICGRID>
+<!--E40D003712A2492395ACB57BFBFE6720-->  <DISPLAYLOGICGRID><![CDATA[@fin_payment_id@ | @trxtype@!'']]></DISPLAYLOGICGRID>
 <!--E40D003712A2492395ACB57BFBFE6720-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--E40D003712A2492395ACB57BFBFE6720--></AD_FIELD>
 
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MESSAGE.xml
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MESSAGE.xml	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_MESSAGE.xml	Thu Sep 11 12:13:21 2014 +0200
@@ -817,6 +817,18 @@
 <!--9CFC61CBF0C84814B6DB7729427A2E38-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--9CFC61CBF0C84814B6DB7729427A2E38--></AD_MESSAGE>
 
+<!--A08760215EF944BABE717FA33F241FC0--><AD_MESSAGE>
+<!--A08760215EF944BABE717FA33F241FC0-->  <AD_MESSAGE_ID><![CDATA[A08760215EF944BABE717FA33F241FC0]]></AD_MESSAGE_ID>
+<!--A08760215EF944BABE717FA33F241FC0-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--A08760215EF944BABE717FA33F241FC0-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--A08760215EF944BABE717FA33F241FC0-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--A08760215EF944BABE717FA33F241FC0-->  <VALUE><![CDATA[APRM_ZEROAMOUNTPAYMENTTRANSACTION]]></VALUE>
+<!--A08760215EF944BABE717FA33F241FC0-->  <MSGTEXT><![CDATA[It is not possible to add a payment of zero amount to a transaction]]></MSGTEXT>
+<!--A08760215EF944BABE717FA33F241FC0-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--A08760215EF944BABE717FA33F241FC0-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--A08760215EF944BABE717FA33F241FC0-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--A08760215EF944BABE717FA33F241FC0--></AD_MESSAGE>
+
 <!--A0F2DD5EF309448084FB6F3F44B59798--><AD_MESSAGE>
 <!--A0F2DD5EF309448084FB6F3F44B59798-->  <AD_MESSAGE_ID><![CDATA[A0F2DD5EF309448084FB6F3F44B59798]]></AD_MESSAGE_ID>
 <!--A0F2DD5EF309448084FB6F3F44B59798-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REFERENCE.xml
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REFERENCE.xml	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_REFERENCE.xml	Thu Sep 11 12:13:21 2014 +0200
@@ -313,6 +313,18 @@
 <!--E664E415582A483DBBC91DEF256FB9E6-->  <ISVALUEDISPLAYED><![CDATA[N]]></ISVALUEDISPLAYED>
 <!--E664E415582A483DBBC91DEF256FB9E6--></AD_REFERENCE>
 
+<!--E867C99480754094BE0705D9877FF833--><AD_REFERENCE>
+<!--E867C99480754094BE0705D9877FF833-->  <AD_REFERENCE_ID><![CDATA[E867C99480754094BE0705D9877FF833]]></AD_REFERENCE_ID>
+<!--E867C99480754094BE0705D9877FF833-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--E867C99480754094BE0705D9877FF833-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--E867C99480754094BE0705D9877FF833-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--E867C99480754094BE0705D9877FF833-->  <NAME><![CDATA[Organization Selector - Transactions allowed]]></NAME>
+<!--E867C99480754094BE0705D9877FF833-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--E867C99480754094BE0705D9877FF833-->  <ISBASEREFERENCE><![CDATA[N]]></ISBASEREFERENCE>
+<!--E867C99480754094BE0705D9877FF833-->  <PARENTREFERENCE_ID><![CDATA[95E2A8B50A254B2AAE6774B8C2F28120]]></PARENTREFERENCE_ID>
+<!--E867C99480754094BE0705D9877FF833-->  <ISVALUEDISPLAYED><![CDATA[N]]></ISVALUEDISPLAYED>
+<!--E867C99480754094BE0705D9877FF833--></AD_REFERENCE>
+
 <!--E91B038ABF4F4A2280264C4A475852A4--><AD_REFERENCE>
 <!--E91B038ABF4F4A2280264C4A475852A4-->  <AD_REFERENCE_ID><![CDATA[E91B038ABF4F4A2280264C4A475852A4]]></AD_REFERENCE_ID>
 <!--E91B038ABF4F4A2280264C4A475852A4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUIAPP_PARAMETER.xml	Thu Sep 11 12:13:21 2014 +0200
@@ -49,6 +49,32 @@
 <!--0586B9F7ED4147758536007BF402F1DF-->  <DISPLAYTITLE><![CDATA[N]]></DISPLAYTITLE>
 <!--0586B9F7ED4147758536007BF402F1DF--></OBUIAPP_PARAMETER>
 
+<!--075F4BA7A03F4548A7A501BAFD073DEE--><OBUIAPP_PARAMETER>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <OBUIAPP_PARAMETER_ID><![CDATA[075F4BA7A03F4548A7A501BAFD073DEE]]></OBUIAPP_PARAMETER_ID>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <NAME><![CDATA[Payment Method Read Only Logic]]></NAME>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <DESCRIPTION><![CDATA[Parameter used to implement Read Only Logic on Payment Method]]></DESCRIPTION>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <HELP><![CDATA[Parameter used to implement Read Only Logic on Payment Method]]></HELP>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <SEQNO><![CDATA[1160]]></SEQNO>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <COLUMNNAME><![CDATA[payment_method_readonly_logic]]></COLUMNNAME>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <DEFAULTVALUE><![CDATA[OB.getFilterExpression("org.openbravo.advpaymentmngt.filterexpression.AddPaymentReadOnlyLogicsExpression")]]></DEFAULTVALUE>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <AD_ELEMENT_ID><![CDATA[458D63E9F9D541F7A06B341305ACCB66]]></AD_ELEMENT_ID>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <ISFIXED><![CDATA[N]]></ISFIXED>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <DISPLAYLOGIC><![CDATA[false]]></DISPLAYLOGIC>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
+<!--075F4BA7A03F4548A7A501BAFD073DEE-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
+<!--075F4BA7A03F4548A7A501BAFD073DEE--></OBUIAPP_PARAMETER>
+
 <!--0A9E075CCC6E4D59AAC37E3AEF1FE269--><OBUIAPP_PARAMETER>
 <!--0A9E075CCC6E4D59AAC37E3AEF1FE269-->  <OBUIAPP_PARAMETER_ID><![CDATA[0A9E075CCC6E4D59AAC37E3AEF1FE269]]></OBUIAPP_PARAMETER_ID>
 <!--0A9E075CCC6E4D59AAC37E3AEF1FE269-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -72,6 +98,32 @@
 <!--0A9E075CCC6E4D59AAC37E3AEF1FE269-->  <EM_OBKMO_WIDGET_CLASS_ID><![CDATA[FF80808133186ADD01331B3A932C000D]]></EM_OBKMO_WIDGET_CLASS_ID>
 <!--0A9E075CCC6E4D59AAC37E3AEF1FE269--></OBUIAPP_PARAMETER>
 
+<!--0B13DC2C52424F36BDAFC790A0AB5886--><OBUIAPP_PARAMETER>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <OBUIAPP_PARAMETER_ID><![CDATA[0B13DC2C52424F36BDAFC790A0AB5886]]></OBUIAPP_PARAMETER_ID>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <NAME><![CDATA[Organization Display Logic]]></NAME>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <DESCRIPTION><![CDATA[Parameter used to implement Display Logic on Organization]]></DESCRIPTION>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <HELP><![CDATA[Parameter used to implement Display Logic on Organization]]></HELP>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <SEQNO><![CDATA[1240]]></SEQNO>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <COLUMNNAME><![CDATA[ad_org_id_display_logic]]></COLUMNNAME>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <DEFAULTVALUE><![CDATA[OB.getFilterExpression("org.openbravo.advpaymentmngt.filterexpression.AddPaymentDisplayLogicsExpression")]]></DEFAULTVALUE>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <AD_ELEMENT_ID><![CDATA[E9AA03CAEC954FF8B268C2C164BA6CBF]]></AD_ELEMENT_ID>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <ISFIXED><![CDATA[N]]></ISFIXED>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <DISPLAYLOGIC><![CDATA[false]]></DISPLAYLOGIC>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
+<!--0B13DC2C52424F36BDAFC790A0AB5886-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
+<!--0B13DC2C52424F36BDAFC790A0AB5886--></OBUIAPP_PARAMETER>
+
 <!--0E081905DD9646A2AFB296F81C1AA62E--><OBUIAPP_PARAMETER>
 <!--0E081905DD9646A2AFB296F81C1AA62E-->  <OBUIAPP_PARAMETER_ID><![CDATA[0E081905DD9646A2AFB296F81C1AA62E]]></OBUIAPP_PARAMETER_ID>
 <!--0E081905DD9646A2AFB296F81C1AA62E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -93,7 +145,7 @@
 <!--0E081905DD9646A2AFB296F81C1AA62E-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
 <!--0E081905DD9646A2AFB296F81C1AA62E-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
 <!--0E081905DD9646A2AFB296F81C1AA62E-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
-<!--0E081905DD9646A2AFB296F81C1AA62E-->  <READONLYLOGIC><![CDATA[OB.PropertyStore.get('NotAllowChangeExchange', this.view.windowId) == 'Y']]></READONLYLOGIC>
+<!--0E081905DD9646A2AFB296F81C1AA62E-->  <READONLYLOGIC><![CDATA[@converted_amount_readonly_logic@ == 'Y']]></READONLYLOGIC>
 <!--0E081905DD9646A2AFB296F81C1AA62E-->  <ONCHANGEFUNCTION><![CDATA[OB.APRM.AddPayment.convertedAmountOnChange]]></ONCHANGEFUNCTION>
 <!--0E081905DD9646A2AFB296F81C1AA62E-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--0E081905DD9646A2AFB296F81C1AA62E-->  <DISPLAYTITLE><![CDATA[N]]></DISPLAYTITLE>
@@ -149,6 +201,32 @@
 <!--12F5A54CF6FA4702B147CC08BC664051-->  <ONGRIDLOADFUNCTION><![CDATA[OB.APRM.AddPayment.orderInvoiceOnLoadGrid]]></ONGRIDLOADFUNCTION>
 <!--12F5A54CF6FA4702B147CC08BC664051--></OBUIAPP_PARAMETER>
 
+<!--155F39F5EB144A648F409C115D61A489--><OBUIAPP_PARAMETER>
+<!--155F39F5EB144A648F409C115D61A489-->  <OBUIAPP_PARAMETER_ID><![CDATA[155F39F5EB144A648F409C115D61A489]]></OBUIAPP_PARAMETER_ID>
+<!--155F39F5EB144A648F409C115D61A489-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--155F39F5EB144A648F409C115D61A489-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--155F39F5EB144A648F409C115D61A489-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--155F39F5EB144A648F409C115D61A489-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--155F39F5EB144A648F409C115D61A489-->  <NAME><![CDATA[Payment Date Read Only Logic]]></NAME>
+<!--155F39F5EB144A648F409C115D61A489-->  <DESCRIPTION><![CDATA[Parameter used to implement Read Only Logic on Payment Date]]></DESCRIPTION>
+<!--155F39F5EB144A648F409C115D61A489-->  <HELP><![CDATA[Parameter used to implement Read Only Logic on Payment Date]]></HELP>
+<!--155F39F5EB144A648F409C115D61A489-->  <SEQNO><![CDATA[1190]]></SEQNO>
+<!--155F39F5EB144A648F409C115D61A489-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--155F39F5EB144A648F409C115D61A489-->  <COLUMNNAME><![CDATA[payment_date_readonly_logic]]></COLUMNNAME>
+<!--155F39F5EB144A648F409C115D61A489-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--155F39F5EB144A648F409C115D61A489-->  <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH>
+<!--155F39F5EB144A648F409C115D61A489-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--155F39F5EB144A648F409C115D61A489-->  <DEFAULTVALUE><![CDATA[OB.getFilterExpression("org.openbravo.advpaymentmngt.filterexpression.AddPaymentReadOnlyLogicsExpression")]]></DEFAULTVALUE>
+<!--155F39F5EB144A648F409C115D61A489-->  <AD_ELEMENT_ID><![CDATA[6C4509E308444DE0B928E1C25A80CD74]]></AD_ELEMENT_ID>
+<!--155F39F5EB144A648F409C115D61A489-->  <ISFIXED><![CDATA[N]]></ISFIXED>
+<!--155F39F5EB144A648F409C115D61A489-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
+<!--155F39F5EB144A648F409C115D61A489-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
+<!--155F39F5EB144A648F409C115D61A489-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--155F39F5EB144A648F409C115D61A489-->  <DISPLAYLOGIC><![CDATA[false]]></DISPLAYLOGIC>
+<!--155F39F5EB144A648F409C115D61A489-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
+<!--155F39F5EB144A648F409C115D61A489-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
+<!--155F39F5EB144A648F409C115D61A489--></OBUIAPP_PARAMETER>
+
 <!--1CB6D915777343F4BD3317532345B658--><OBUIAPP_PARAMETER>
 <!--1CB6D915777343F4BD3317532345B658-->  <OBUIAPP_PARAMETER_ID><![CDATA[1CB6D915777343F4BD3317532345B658]]></OBUIAPP_PARAMETER_ID>
 <!--1CB6D915777343F4BD3317532345B658-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -197,7 +275,7 @@
 <!--1D16F7BDCDD04F3A9AD259E84811AA41-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
 <!--1D16F7BDCDD04F3A9AD259E84811AA41-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
 <!--1D16F7BDCDD04F3A9AD259E84811AA41-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
-<!--1D16F7BDCDD04F3A9AD259E84811AA41-->  <READONLYLOGIC><![CDATA[@fin_payment_id@!undefined & @fin_paymend_id@!null]]></READONLYLOGIC>
+<!--1D16F7BDCDD04F3A9AD259E84811AA41-->  <READONLYLOGIC><![CDATA[@fin_financial_account_id_readonly_logic@ == 'Y']]></READONLYLOGIC>
 <!--1D16F7BDCDD04F3A9AD259E84811AA41-->  <ONCHANGEFUNCTION><![CDATA[OB.APRM.AddPayment.financialAccountOnChange]]></ONCHANGEFUNCTION>
 <!--1D16F7BDCDD04F3A9AD259E84811AA41-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--1D16F7BDCDD04F3A9AD259E84811AA41-->  <DISPLAYTITLE><![CDATA[N]]></DISPLAYTITLE>
@@ -251,7 +329,7 @@
 <!--200C902859B746D5BDDC773D0C91C1BB-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
 <!--200C902859B746D5BDDC773D0C91C1BB-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
 <!--200C902859B746D5BDDC773D0C91C1BB-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
-<!--200C902859B746D5BDDC773D0C91C1BB-->  <READONLYLOGIC><![CDATA[OB.PropertyStore.get('NotAllowChangeExchange', this.view.windowId) == 'Y']]></READONLYLOGIC>
+<!--200C902859B746D5BDDC773D0C91C1BB-->  <READONLYLOGIC><![CDATA[@conversion_rate_readonly_logic@ == 'Y']]></READONLYLOGIC>
 <!--200C902859B746D5BDDC773D0C91C1BB-->  <NUMCOLUMN><![CDATA[4]]></NUMCOLUMN>
 <!--200C902859B746D5BDDC773D0C91C1BB-->  <ONCHANGEFUNCTION><![CDATA[OB.APRM.AddPayment.conversionRateOnChange]]></ONCHANGEFUNCTION>
 <!--200C902859B746D5BDDC773D0C91C1BB-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
@@ -360,6 +438,32 @@
 <!--4C09892656344AB1ACF988D57D84B96B-->  <DISPLAYTITLE><![CDATA[N]]></DISPLAYTITLE>
 <!--4C09892656344AB1ACF988D57D84B96B--></OBUIAPP_PARAMETER>
 
+<!--4CDE749FE6D341B4BCC128ADDAEE6068--><OBUIAPP_PARAMETER>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <OBUIAPP_PARAMETER_ID><![CDATA[4CDE749FE6D341B4BCC128ADDAEE6068]]></OBUIAPP_PARAMETER_ID>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <NAME><![CDATA[Conversion Rate Read Only Logic]]></NAME>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <DESCRIPTION><![CDATA[Parameter used to implement Read Only Logic on Conversion Rate]]></DESCRIPTION>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <HELP><![CDATA[Parameter used to implement Read Only Logic on Conversion Rate]]></HELP>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <SEQNO><![CDATA[1210]]></SEQNO>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <COLUMNNAME><![CDATA[conversion_rate_readonly_logic]]></COLUMNNAME>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <DEFAULTVALUE><![CDATA[OB.getFilterExpression("org.openbravo.advpaymentmngt.filterexpression.AddPaymentReadOnlyLogicsExpression")]]></DEFAULTVALUE>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <AD_ELEMENT_ID><![CDATA[6FE34C5D44364DA7B73F2925C1C4467B]]></AD_ELEMENT_ID>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <ISFIXED><![CDATA[N]]></ISFIXED>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <DISPLAYLOGIC><![CDATA[false]]></DISPLAYLOGIC>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
+<!--4CDE749FE6D341B4BCC128ADDAEE6068--></OBUIAPP_PARAMETER>
+
 <!--52BD390363394BE980D0A55AFC4CDBB9--><OBUIAPP_PARAMETER>
 <!--52BD390363394BE980D0A55AFC4CDBB9-->  <OBUIAPP_PARAMETER_ID><![CDATA[52BD390363394BE980D0A55AFC4CDBB9]]></OBUIAPP_PARAMETER_ID>
 <!--52BD390363394BE980D0A55AFC4CDBB9-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -380,7 +484,7 @@
 <!--52BD390363394BE980D0A55AFC4CDBB9-->  <ISFIXED><![CDATA[N]]></ISFIXED>
 <!--52BD390363394BE980D0A55AFC4CDBB9-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
 <!--52BD390363394BE980D0A55AFC4CDBB9-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
-<!--52BD390363394BE980D0A55AFC4CDBB9-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--52BD390363394BE980D0A55AFC4CDBB9-->  <STARTINNEWLINE><![CDATA[Y]]></STARTINNEWLINE>
 <!--52BD390363394BE980D0A55AFC4CDBB9-->  <NUMCOLUMN><![CDATA[1]]></NUMCOLUMN>
 <!--52BD390363394BE980D0A55AFC4CDBB9-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--52BD390363394BE980D0A55AFC4CDBB9-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
@@ -438,6 +542,32 @@
 <!--60C455BF16B6481D8ED5336CAA3C85C7-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
 <!--60C455BF16B6481D8ED5336CAA3C85C7--></OBUIAPP_PARAMETER>
 
+<!--61059745E59240A998ED90DC83E5DA4F--><OBUIAPP_PARAMETER>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <OBUIAPP_PARAMETER_ID><![CDATA[61059745E59240A998ED90DC83E5DA4F]]></OBUIAPP_PARAMETER_ID>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <NAME><![CDATA[Credit to Use Display Logic]]></NAME>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <DESCRIPTION><![CDATA[Parameter used to implement Display Logic on Credit to Use grid]]></DESCRIPTION>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <HELP><![CDATA[Parameter used to implement Display Logic on Credit to Use grid]]></HELP>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <SEQNO><![CDATA[1140]]></SEQNO>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <COLUMNNAME><![CDATA[credit_to_use_display_logic]]></COLUMNNAME>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <DEFAULTVALUE><![CDATA[OB.getFilterExpression("org.openbravo.advpaymentmngt.filterexpression.AddPaymentDisplayLogicsExpression")]]></DEFAULTVALUE>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <AD_ELEMENT_ID><![CDATA[D9E7B70083344E86AF5A6272B2090755]]></AD_ELEMENT_ID>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <ISFIXED><![CDATA[N]]></ISFIXED>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <DISPLAYLOGIC><![CDATA[false]]></DISPLAYLOGIC>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
+<!--61059745E59240A998ED90DC83E5DA4F-->  <DISPLAYTITLE><![CDATA[N]]></DISPLAYTITLE>
+<!--61059745E59240A998ED90DC83E5DA4F--></OBUIAPP_PARAMETER>
+
 <!--6AF091FD5F1440BB9F0E0C674A168144--><OBUIAPP_PARAMETER>
 <!--6AF091FD5F1440BB9F0E0C674A168144-->  <OBUIAPP_PARAMETER_ID><![CDATA[6AF091FD5F1440BB9F0E0C674A168144]]></OBUIAPP_PARAMETER_ID>
 <!--6AF091FD5F1440BB9F0E0C674A168144-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -464,6 +594,32 @@
 <!--6AF091FD5F1440BB9F0E0C674A168144-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
 <!--6AF091FD5F1440BB9F0E0C674A168144--></OBUIAPP_PARAMETER>
 
+<!--6E03D970D07D4753941F7B06DAF197F3--><OBUIAPP_PARAMETER>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <OBUIAPP_PARAMETER_ID><![CDATA[6E03D970D07D4753941F7B06DAF197F3]]></OBUIAPP_PARAMETER_ID>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <NAME><![CDATA[Document]]></NAME>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <SEQNO><![CDATA[0]]></SEQNO>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <AD_REFERENCE_ID><![CDATA[17]]></AD_REFERENCE_ID>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <AD_REFERENCE_VALUE_ID><![CDATA[40B84CF78FC9435790887846CCDAE875]]></AD_REFERENCE_VALUE_ID>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <COLUMNNAME><![CDATA[trxtype]]></COLUMNNAME>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <DEFAULTVALUE><![CDATA[OB.getFilterExpression("org.openbravo.advpaymentmngt.filterexpression.AddPaymentDefaultValuesExpression")]]></DEFAULTVALUE>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <AD_ELEMENT_ID><![CDATA[8B17B525CBB345518E99800D610EB93E]]></AD_ELEMENT_ID>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <ISFIXED><![CDATA[N]]></ISFIXED>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <DISPLAYLOGIC><![CDATA[@trxtype_display_logic@='Y']]></DISPLAYLOGIC>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <ONCHANGEFUNCTION><![CDATA[OB.APRM.AddPayment.documentOnChange]]></ONCHANGEFUNCTION>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
+<!--6E03D970D07D4753941F7B06DAF197F3-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
+<!--6E03D970D07D4753941F7B06DAF197F3--></OBUIAPP_PARAMETER>
+
 <!--7783E23035DA4DBC8DD694EBBD4A1E5F--><OBUIAPP_PARAMETER>
 <!--7783E23035DA4DBC8DD694EBBD4A1E5F-->  <OBUIAPP_PARAMETER_ID><![CDATA[7783E23035DA4DBC8DD694EBBD4A1E5F]]></OBUIAPP_PARAMETER_ID>
 <!--7783E23035DA4DBC8DD694EBBD4A1E5F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -560,7 +716,7 @@
 <!--838EF92641044D038600E4C1B6F1C4CB-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
 <!--838EF92641044D038600E4C1B6F1C4CB-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
 <!--838EF92641044D038600E4C1B6F1C4CB-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
-<!--838EF92641044D038600E4C1B6F1C4CB-->  <READONLYLOGIC><![CDATA[@fin_payment_id@!undefined & @fin_paymend_id@!null]]></READONLYLOGIC>
+<!--838EF92641044D038600E4C1B6F1C4CB-->  <READONLYLOGIC><![CDATA[@payment_method_readonly_logic@ == 'Y']]></READONLYLOGIC>
 <!--838EF92641044D038600E4C1B6F1C4CB-->  <ONCHANGEFUNCTION><![CDATA[OB.APRM.AddPayment.paymentMethodOnChange]]></ONCHANGEFUNCTION>
 <!--838EF92641044D038600E4C1B6F1C4CB-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--838EF92641044D038600E4C1B6F1C4CB-->  <DISPLAYTITLE><![CDATA[N]]></DISPLAYTITLE>
@@ -612,6 +768,32 @@
 <!--854F44975FB84D20AE8E8DA02999747E-->  <DISPLAYTITLE><![CDATA[N]]></DISPLAYTITLE>
 <!--854F44975FB84D20AE8E8DA02999747E--></OBUIAPP_PARAMETER>
 
+<!--871DE320B33C4B83BDB4894EE99536E5--><OBUIAPP_PARAMETER>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <OBUIAPP_PARAMETER_ID><![CDATA[871DE320B33C4B83BDB4894EE99536E5]]></OBUIAPP_PARAMETER_ID>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <NAME><![CDATA[Deposit To Read Only Logic]]></NAME>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <DESCRIPTION><![CDATA[Parameter used to implement Read Only Logic on Financial Account]]></DESCRIPTION>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <HELP><![CDATA[Parameter used to implement Read Only Logic on Financial Account]]></HELP>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <SEQNO><![CDATA[1200]]></SEQNO>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <COLUMNNAME><![CDATA[fin_financial_account_id_readonly_logic]]></COLUMNNAME>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <DEFAULTVALUE><![CDATA[OB.getFilterExpression("org.openbravo.advpaymentmngt.filterexpression.AddPaymentReadOnlyLogicsExpression")]]></DEFAULTVALUE>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <AD_ELEMENT_ID><![CDATA[2CFD3BE7B8D0441BBF151920E5BC384F]]></AD_ELEMENT_ID>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <ISFIXED><![CDATA[N]]></ISFIXED>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <DISPLAYLOGIC><![CDATA[false]]></DISPLAYLOGIC>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
+<!--871DE320B33C4B83BDB4894EE99536E5-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
+<!--871DE320B33C4B83BDB4894EE99536E5--></OBUIAPP_PARAMETER>
+
 <!--878E7842FC524139BBEE0CAE0C1F3E17--><OBUIAPP_PARAMETER>
 <!--878E7842FC524139BBEE0CAE0C1F3E17-->  <OBUIAPP_PARAMETER_ID><![CDATA[878E7842FC524139BBEE0CAE0C1F3E17]]></OBUIAPP_PARAMETER_ID>
 <!--878E7842FC524139BBEE0CAE0C1F3E17-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -656,7 +838,7 @@
 <!--8A2B3B1A41364852ACD2804CF86A69F5-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
 <!--8A2B3B1A41364852ACD2804CF86A69F5-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
 <!--8A2B3B1A41364852ACD2804CF86A69F5-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
-<!--8A2B3B1A41364852ACD2804CF86A69F5-->  <DISPLAYLOGIC><![CDATA[@difference@ > 0]]></DISPLAYLOGIC>
+<!--8A2B3B1A41364852ACD2804CF86A69F5-->  <DISPLAYLOGIC><![CDATA[@overpayment_action_display_logic@='Y']]></DISPLAYLOGIC>
 <!--8A2B3B1A41364852ACD2804CF86A69F5-->  <NUMCOLUMN><![CDATA[2]]></NUMCOLUMN>
 <!--8A2B3B1A41364852ACD2804CF86A69F5-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--8A2B3B1A41364852ACD2804CF86A69F5-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
@@ -688,6 +870,58 @@
 <!--8B738077BBF041E88B843AB9D98B12B0-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
 <!--8B738077BBF041E88B843AB9D98B12B0--></OBUIAPP_PARAMETER>
 
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD--><OBUIAPP_PARAMETER>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <OBUIAPP_PARAMETER_ID><![CDATA[91BE9BC9D1FE44C2A4CD631AE2474EAD]]></OBUIAPP_PARAMETER_ID>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <NAME><![CDATA[Payment DocumentNo Read Only Logic]]></NAME>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <DESCRIPTION><![CDATA[Parameter used to implement Read Only Logic on Payment DocumentNo]]></DESCRIPTION>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <HELP><![CDATA[Parameter used to implement Read Only Logic on Payment DocumentNo]]></HELP>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <SEQNO><![CDATA[1150]]></SEQNO>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <COLUMNNAME><![CDATA[payment_documentno_readonly_logic]]></COLUMNNAME>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <DEFAULTVALUE><![CDATA[OB.getFilterExpression("org.openbravo.advpaymentmngt.filterexpression.AddPaymentReadOnlyLogicsExpression")]]></DEFAULTVALUE>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <AD_ELEMENT_ID><![CDATA[C128589B1E884C15B1062BC6A698A41E]]></AD_ELEMENT_ID>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <ISFIXED><![CDATA[N]]></ISFIXED>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <DISPLAYLOGIC><![CDATA[false]]></DISPLAYLOGIC>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
+<!--91BE9BC9D1FE44C2A4CD631AE2474EAD--></OBUIAPP_PARAMETER>
+
+<!--93DC15C203EB4205BDE0D87AFE185D5C--><OBUIAPP_PARAMETER>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <OBUIAPP_PARAMETER_ID><![CDATA[93DC15C203EB4205BDE0D87AFE185D5C]]></OBUIAPP_PARAMETER_ID>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <NAME><![CDATA[Overpayment Action Display Logic]]></NAME>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <DESCRIPTION><![CDATA[Parameter used to implement Display Logic on Overpayment Action]]></DESCRIPTION>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <HELP><![CDATA[Parameter used to implement Display Logic on Overpayment Action]]></HELP>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <SEQNO><![CDATA[1120]]></SEQNO>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <COLUMNNAME><![CDATA[overpayment_action_display_logic]]></COLUMNNAME>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <DEFAULTVALUE><![CDATA[OB.getFilterExpression("org.openbravo.advpaymentmngt.filterexpression.AddPaymentDisplayLogicsExpression")]]></DEFAULTVALUE>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <AD_ELEMENT_ID><![CDATA[51F0875CB4114D90A239FBCA54B5C1AB]]></AD_ELEMENT_ID>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <ISFIXED><![CDATA[N]]></ISFIXED>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <DISPLAYLOGIC><![CDATA[false]]></DISPLAYLOGIC>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
+<!--93DC15C203EB4205BDE0D87AFE185D5C-->  <DISPLAYTITLE><![CDATA[N]]></DISPLAYTITLE>
+<!--93DC15C203EB4205BDE0D87AFE185D5C--></OBUIAPP_PARAMETER>
+
 <!--94DAEE7477AF40ED9B40E3A546EACD02--><OBUIAPP_PARAMETER>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <OBUIAPP_PARAMETER_ID><![CDATA[94DAEE7477AF40ED9B40E3A546EACD02]]></OBUIAPP_PARAMETER_ID>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -697,23 +931,51 @@
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <NAME><![CDATA[Organization]]></NAME>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <DESCRIPTION><![CDATA[Organizational entity within client]]></DESCRIPTION>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <HELP><![CDATA[An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.]]></HELP>
-<!--94DAEE7477AF40ED9B40E3A546EACD02-->  <SEQNO><![CDATA[1100]]></SEQNO>
-<!--94DAEE7477AF40ED9B40E3A546EACD02-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--94DAEE7477AF40ED9B40E3A546EACD02-->  <SEQNO><![CDATA[5]]></SEQNO>
+<!--94DAEE7477AF40ED9B40E3A546EACD02-->  <AD_REFERENCE_ID><![CDATA[95E2A8B50A254B2AAE6774B8C2F28120]]></AD_REFERENCE_ID>
+<!--94DAEE7477AF40ED9B40E3A546EACD02-->  <AD_REFERENCE_VALUE_ID><![CDATA[E867C99480754094BE0705D9877FF833]]></AD_REFERENCE_VALUE_ID>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <COLUMNNAME><![CDATA[ad_org_id]]></COLUMNNAME>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH>
-<!--94DAEE7477AF40ED9B40E3A546EACD02-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--94DAEE7477AF40ED9B40E3A546EACD02-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <DEFAULTVALUE><![CDATA[OB.getFilterExpression("org.openbravo.advpaymentmngt.filterexpression.AddPaymentDefaultValuesExpression")]]></DEFAULTVALUE>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <AD_ELEMENT_ID><![CDATA[113]]></AD_ELEMENT_ID>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <ISFIXED><![CDATA[N]]></ISFIXED>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
-<!--94DAEE7477AF40ED9B40E3A546EACD02-->  <DISPLAYLOGIC><![CDATA[false]]></DISPLAYLOGIC>
+<!--94DAEE7477AF40ED9B40E3A546EACD02-->  <DISPLAYLOGIC><![CDATA[@ad_org_id_display_logic@='Y']]></DISPLAYLOGIC>
+<!--94DAEE7477AF40ED9B40E3A546EACD02-->  <ONCHANGEFUNCTION><![CDATA[OB.APRM.AddPayment.organizationOnChange]]></ONCHANGEFUNCTION>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--94DAEE7477AF40ED9B40E3A546EACD02-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
 <!--94DAEE7477AF40ED9B40E3A546EACD02--></OBUIAPP_PARAMETER>
 
+<!--967CEF7421094B06B089DEA1D1F6C37D--><OBUIAPP_PARAMETER>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <OBUIAPP_PARAMETER_ID><![CDATA[967CEF7421094B06B089DEA1D1F6C37D]]></OBUIAPP_PARAMETER_ID>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <NAME><![CDATA[Actual Payment Read Only Logic]]></NAME>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <DESCRIPTION><![CDATA[Parameter used to implement Read Only Logic on Actual Payment]]></DESCRIPTION>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <HELP><![CDATA[Parameter used to implement Read Only Logic on Actual Payment]]></HELP>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <SEQNO><![CDATA[1170]]></SEQNO>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <COLUMNNAME><![CDATA[actual_payment_readonly_logic]]></COLUMNNAME>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <DEFAULTVALUE><![CDATA[OB.getFilterExpression("org.openbravo.advpaymentmngt.filterexpression.AddPaymentReadOnlyLogicsExpression")]]></DEFAULTVALUE>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <AD_ELEMENT_ID><![CDATA[349748D8346C46B1A4A652BC15F98EBB]]></AD_ELEMENT_ID>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <ISFIXED><![CDATA[N]]></ISFIXED>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <DISPLAYLOGIC><![CDATA[false]]></DISPLAYLOGIC>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
+<!--967CEF7421094B06B089DEA1D1F6C37D-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
+<!--967CEF7421094B06B089DEA1D1F6C37D--></OBUIAPP_PARAMETER>
+
 <!--97DD674259364196944B4C02B0278305--><OBUIAPP_PARAMETER>
 <!--97DD674259364196944B4C02B0278305-->  <OBUIAPP_PARAMETER_ID><![CDATA[97DD674259364196944B4C02B0278305]]></OBUIAPP_PARAMETER_ID>
 <!--97DD674259364196944B4C02B0278305-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -740,6 +1002,32 @@
 <!--97DD674259364196944B4C02B0278305-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
 <!--97DD674259364196944B4C02B0278305--></OBUIAPP_PARAMETER>
 
+<!--9E82150797C64125965C9BA668C2D2B4--><OBUIAPP_PARAMETER>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <OBUIAPP_PARAMETER_ID><![CDATA[9E82150797C64125965C9BA668C2D2B4]]></OBUIAPP_PARAMETER_ID>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <NAME><![CDATA[Document Display Logic]]></NAME>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <DESCRIPTION><![CDATA[Parameter used to implement Display Logic on Document]]></DESCRIPTION>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <HELP><![CDATA[Parameter used to implement Display Logic on Document]]></HELP>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <SEQNO><![CDATA[1130]]></SEQNO>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <COLUMNNAME><![CDATA[trxtype_display_logic]]></COLUMNNAME>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <DEFAULTVALUE><![CDATA[OB.getFilterExpression("org.openbravo.advpaymentmngt.filterexpression.AddPaymentDisplayLogicsExpression")]]></DEFAULTVALUE>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <AD_ELEMENT_ID><![CDATA[F5888F54E21C4D59ABF5FBFE6474B229]]></AD_ELEMENT_ID>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <ISFIXED><![CDATA[N]]></ISFIXED>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <DISPLAYLOGIC><![CDATA[false]]></DISPLAYLOGIC>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
+<!--9E82150797C64125965C9BA668C2D2B4-->  <DISPLAYTITLE><![CDATA[N]]></DISPLAYTITLE>
+<!--9E82150797C64125965C9BA668C2D2B4--></OBUIAPP_PARAMETER>
+
 <!--A801DA25DEAA404A8C651626CA31B22F--><OBUIAPP_PARAMETER>
 <!--A801DA25DEAA404A8C651626CA31B22F-->  <OBUIAPP_PARAMETER_ID><![CDATA[A801DA25DEAA404A8C651626CA31B22F]]></OBUIAPP_PARAMETER_ID>
 <!--A801DA25DEAA404A8C651626CA31B22F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -761,7 +1049,7 @@
 <!--A801DA25DEAA404A8C651626CA31B22F-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
 <!--A801DA25DEAA404A8C651626CA31B22F-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
 <!--A801DA25DEAA404A8C651626CA31B22F-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
-<!--A801DA25DEAA404A8C651626CA31B22F-->  <DISPLAYLOGIC><![CDATA[@customer_credit@ > 0 & @received_from@!'' & (@issotrx@ == true | @generateCredit@ == 0)]]></DISPLAYLOGIC>
+<!--A801DA25DEAA404A8C651626CA31B22F-->  <DISPLAYLOGIC><![CDATA[@credit_to_use_display_logic@='Y']]></DISPLAYLOGIC>
 <!--A801DA25DEAA404A8C651626CA31B22F-->  <AD_FIELDGROUP_ID><![CDATA[CB265F2D7ACF439F9FB5EFBFA0B50363]]></AD_FIELDGROUP_ID>
 <!--A801DA25DEAA404A8C651626CA31B22F-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--A801DA25DEAA404A8C651626CA31B22F-->  <DISPLAYTITLE><![CDATA[N]]></DISPLAYTITLE>
@@ -789,7 +1077,7 @@
 <!--A95732C0B3794D79B2E945D50872D931-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
 <!--A95732C0B3794D79B2E945D50872D931-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
 <!--A95732C0B3794D79B2E945D50872D931-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
-<!--A95732C0B3794D79B2E945D50872D931-->  <READONLYLOGIC><![CDATA[@issotrx@=='N']]></READONLYLOGIC>
+<!--A95732C0B3794D79B2E945D50872D931-->  <READONLYLOGIC><![CDATA[@actual_payment_readonly_logic@ == 'Y']]></READONLYLOGIC>
 <!--A95732C0B3794D79B2E945D50872D931-->  <ONCHANGEFUNCTION><![CDATA[OB.APRM.AddPayment.actualPaymentOnChange]]></ONCHANGEFUNCTION>
 <!--A95732C0B3794D79B2E945D50872D931-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--A95732C0B3794D79B2E945D50872D931-->  <DISPLAYTITLE><![CDATA[N]]></DISPLAYTITLE>
@@ -848,6 +1136,58 @@
 <!--B2E975E0ADE3445C90DA81F0F492EA1C-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
 <!--B2E975E0ADE3445C90DA81F0F492EA1C--></OBUIAPP_PARAMETER>
 
+<!--B86607BED54F45B89718C80C61878093--><OBUIAPP_PARAMETER>
+<!--B86607BED54F45B89718C80C61878093-->  <OBUIAPP_PARAMETER_ID><![CDATA[B86607BED54F45B89718C80C61878093]]></OBUIAPP_PARAMETER_ID>
+<!--B86607BED54F45B89718C80C61878093-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--B86607BED54F45B89718C80C61878093-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--B86607BED54F45B89718C80C61878093-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--B86607BED54F45B89718C80C61878093-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--B86607BED54F45B89718C80C61878093-->  <NAME><![CDATA[Converted Amount Read Only Logic]]></NAME>
+<!--B86607BED54F45B89718C80C61878093-->  <DESCRIPTION><![CDATA[Parameter used to implement Read Only Logic on Converted Amount]]></DESCRIPTION>
+<!--B86607BED54F45B89718C80C61878093-->  <HELP><![CDATA[Parameter used to implement Read Only Logic on Converted Amount]]></HELP>
+<!--B86607BED54F45B89718C80C61878093-->  <SEQNO><![CDATA[1180]]></SEQNO>
+<!--B86607BED54F45B89718C80C61878093-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--B86607BED54F45B89718C80C61878093-->  <COLUMNNAME><![CDATA[converted_amount_readonly_logic]]></COLUMNNAME>
+<!--B86607BED54F45B89718C80C61878093-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--B86607BED54F45B89718C80C61878093-->  <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH>
+<!--B86607BED54F45B89718C80C61878093-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--B86607BED54F45B89718C80C61878093-->  <DEFAULTVALUE><![CDATA[OB.getFilterExpression("org.openbravo.advpaymentmngt.filterexpression.AddPaymentReadOnlyLogicsExpression")]]></DEFAULTVALUE>
+<!--B86607BED54F45B89718C80C61878093-->  <AD_ELEMENT_ID><![CDATA[A62C80360F274C44AA6BF58315DF65FF]]></AD_ELEMENT_ID>
+<!--B86607BED54F45B89718C80C61878093-->  <ISFIXED><![CDATA[N]]></ISFIXED>
+<!--B86607BED54F45B89718C80C61878093-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
+<!--B86607BED54F45B89718C80C61878093-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
+<!--B86607BED54F45B89718C80C61878093-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--B86607BED54F45B89718C80C61878093-->  <DISPLAYLOGIC><![CDATA[false]]></DISPLAYLOGIC>
+<!--B86607BED54F45B89718C80C61878093-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
+<!--B86607BED54F45B89718C80C61878093-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
+<!--B86607BED54F45B89718C80C61878093--></OBUIAPP_PARAMETER>
+
+<!--B8ECE87414564F1D8B974572A458E98A--><OBUIAPP_PARAMETER>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <OBUIAPP_PARAMETER_ID><![CDATA[B8ECE87414564F1D8B974572A458E98A]]></OBUIAPP_PARAMETER_ID>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <NAME><![CDATA[Currency Read Only Logic]]></NAME>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <DESCRIPTION><![CDATA[Parameter used to implement Read Only Logic on Currency param]]></DESCRIPTION>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <HELP><![CDATA[Parameter used to implement Read Only Logic on Currency param]]></HELP>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <SEQNO><![CDATA[1230]]></SEQNO>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <COLUMNNAME><![CDATA[c_currency_id_readonly_logic]]></COLUMNNAME>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <DEFAULTVALUE><![CDATA[OB.getFilterExpression("org.openbravo.advpaymentmngt.filterexpression.AddPaymentReadOnlyLogicsExpression")]]></DEFAULTVALUE>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <AD_ELEMENT_ID><![CDATA[52F85707307D4FC5923B7CA29B8D8A87]]></AD_ELEMENT_ID>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <ISFIXED><![CDATA[N]]></ISFIXED>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <DISPLAYLOGIC><![CDATA[false]]></DISPLAYLOGIC>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
+<!--B8ECE87414564F1D8B974572A458E98A-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
+<!--B8ECE87414564F1D8B974572A458E98A--></OBUIAPP_PARAMETER>
+
 <!--BC5E638E184C4F3AB36B9DA574E0E8BB--><OBUIAPP_PARAMETER>
 <!--BC5E638E184C4F3AB36B9DA574E0E8BB-->  <OBUIAPP_PARAMETER_ID><![CDATA[BC5E638E184C4F3AB36B9DA574E0E8BB]]></OBUIAPP_PARAMETER_ID>
 <!--BC5E638E184C4F3AB36B9DA574E0E8BB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -917,7 +1257,7 @@
 <!--E2FB4840B65A44D4B3090A7E3C95FD95-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
 <!--E2FB4840B65A44D4B3090A7E3C95FD95-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
 <!--E2FB4840B65A44D4B3090A7E3C95FD95-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
-<!--E2FB4840B65A44D4B3090A7E3C95FD95-->  <READONLYLOGIC><![CDATA[@fin_payment_id@!undefined & @fin_paymend_id@!null]]></READONLYLOGIC>
+<!--E2FB4840B65A44D4B3090A7E3C95FD95-->  <READONLYLOGIC><![CDATA[@payment_date_readonly_logic@ == 'Y']]></READONLYLOGIC>
 <!--E2FB4840B65A44D4B3090A7E3C95FD95-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--E2FB4840B65A44D4B3090A7E3C95FD95-->  <DISPLAYTITLE><![CDATA[N]]></DISPLAYTITLE>
 <!--E2FB4840B65A44D4B3090A7E3C95FD95--></OBUIAPP_PARAMETER>
@@ -971,7 +1311,8 @@
 <!--EA236C2D265845E6A3E2AE5A5A7A7AB2-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
 <!--EA236C2D265845E6A3E2AE5A5A7A7AB2-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
 <!--EA236C2D265845E6A3E2AE5A5A7A7AB2-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
-<!--EA236C2D265845E6A3E2AE5A5A7A7AB2-->  <READONLYLOGIC><![CDATA[true]]></READONLYLOGIC>
+<!--EA236C2D265845E6A3E2AE5A5A7A7AB2-->  <READONLYLOGIC><![CDATA[@c_currency_id_readonly_logic@ == 'Y']]></READONLYLOGIC>
+<!--EA236C2D265845E6A3E2AE5A5A7A7AB2-->  <ONCHANGEFUNCTION><![CDATA[OB.APRM.AddPayment.currencyOnChange ]]></ONCHANGEFUNCTION>
 <!--EA236C2D265845E6A3E2AE5A5A7A7AB2-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--EA236C2D265845E6A3E2AE5A5A7A7AB2-->  <DISPLAYTITLE><![CDATA[N]]></DISPLAYTITLE>
 <!--EA236C2D265845E6A3E2AE5A5A7A7AB2--></OBUIAPP_PARAMETER>
@@ -998,12 +1339,39 @@
 <!--EB46162236C04DC2812C7095A88FA708-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
 <!--EB46162236C04DC2812C7095A88FA708-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
 <!--EB46162236C04DC2812C7095A88FA708-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
-<!--EB46162236C04DC2812C7095A88FA708-->  <READONLYLOGIC><![CDATA[true]]></READONLYLOGIC>
+<!--EB46162236C04DC2812C7095A88FA708-->  <READONLYLOGIC><![CDATA[@received_from_readonly_logic@ == 'Y']]></READONLYLOGIC>
 <!--EB46162236C04DC2812C7095A88FA708-->  <NUMCOLUMN><![CDATA[1]]></NUMCOLUMN>
+<!--EB46162236C04DC2812C7095A88FA708-->  <ONCHANGEFUNCTION><![CDATA[OB.APRM.AddPayment.receivedFromOnChange]]></ONCHANGEFUNCTION>
 <!--EB46162236C04DC2812C7095A88FA708-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--EB46162236C04DC2812C7095A88FA708-->  <DISPLAYTITLE><![CDATA[N]]></DISPLAYTITLE>
 <!--EB46162236C04DC2812C7095A88FA708--></OBUIAPP_PARAMETER>
 
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E--><OBUIAPP_PARAMETER>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <OBUIAPP_PARAMETER_ID><![CDATA[F1D97E6ABE584F209CFCEEF4C6FE4A3E]]></OBUIAPP_PARAMETER_ID>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <NAME><![CDATA[Received From Read Only Logic]]></NAME>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <DESCRIPTION><![CDATA[Parameter used to implement Read Only Logic on Business Partner]]></DESCRIPTION>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <HELP><![CDATA[Parameter used to implement Read Only Logic on Business Partner]]></HELP>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <SEQNO><![CDATA[1220]]></SEQNO>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <COLUMNNAME><![CDATA[received_from_readonly_logic]]></COLUMNNAME>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <FIELDLENGTH><![CDATA[0]]></FIELDLENGTH>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <DEFAULTVALUE><![CDATA[OB.getFilterExpression("org.openbravo.advpaymentmngt.filterexpression.AddPaymentReadOnlyLogicsExpression")]]></DEFAULTVALUE>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <AD_ELEMENT_ID><![CDATA[6548FAC738E2475F866F132AF5CF5532]]></AD_ELEMENT_ID>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <ISFIXED><![CDATA[N]]></ISFIXED>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <DISPLAYLOGIC><![CDATA[false]]></DISPLAYLOGIC>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E-->  <DISPLAYTITLE><![CDATA[Y]]></DISPLAYTITLE>
+<!--F1D97E6ABE584F209CFCEEF4C6FE4A3E--></OBUIAPP_PARAMETER>
+
 <!--F2C546F2C45C4AB58494B2D384E6A8E8--><OBUIAPP_PARAMETER>
 <!--F2C546F2C45C4AB58494B2D384E6A8E8-->  <OBUIAPP_PARAMETER_ID><![CDATA[F2C546F2C45C4AB58494B2D384E6A8E8]]></OBUIAPP_PARAMETER_ID>
 <!--F2C546F2C45C4AB58494B2D384E6A8E8-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -1024,8 +1392,8 @@
 <!--F2C546F2C45C4AB58494B2D384E6A8E8-->  <ISFIXED><![CDATA[N]]></ISFIXED>
 <!--F2C546F2C45C4AB58494B2D384E6A8E8-->  <EVALUATEFIXEDVALUE><![CDATA[N]]></EVALUATEFIXEDVALUE>
 <!--F2C546F2C45C4AB58494B2D384E6A8E8-->  <OBUIAPP_PROCESS_ID><![CDATA[9BED7889E1034FE68BD85D5D16857320]]></OBUIAPP_PROCESS_ID>
-<!--F2C546F2C45C4AB58494B2D384E6A8E8-->  <STARTINNEWLINE><![CDATA[N]]></STARTINNEWLINE>
-<!--F2C546F2C45C4AB58494B2D384E6A8E8-->  <READONLYLOGIC><![CDATA[@fin_payment_id@!undefined & @fin_paymend_id@!null]]></READONLYLOGIC>
+<!--F2C546F2C45C4AB58494B2D384E6A8E8-->  <STARTINNEWLINE><![CDATA[Y]]></STARTINNEWLINE>
+<!--F2C546F2C45C4AB58494B2D384E6A8E8-->  <READONLYLOGIC><![CDATA[@payment_documentno_readonly_logic@ == 'Y']]></READONLYLOGIC>
 <!--F2C546F2C45C4AB58494B2D384E6A8E8-->  <DISPLAYEDROWS><![CDATA[5]]></DISPLAYEDROWS>
 <!--F2C546F2C45C4AB58494B2D384E6A8E8-->  <DISPLAYTITLE><![CDATA[N]]></DISPLAYTITLE>
 <!--F2C546F2C45C4AB58494B2D384E6A8E8--></OBUIAPP_PARAMETER>
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUISEL_SELECTOR.xml
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUISEL_SELECTOR.xml	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUISEL_SELECTOR.xml	Thu Sep 11 12:13:21 2014 +0200
@@ -1,5 +1,21 @@
 <?xml version='1.0' encoding='UTF-8'?>
 <data>
+<!--14F59CBE3B804B8D81D29DFFF5B51467--><OBUISEL_SELECTOR>
+<!--14F59CBE3B804B8D81D29DFFF5B51467-->  <OBUISEL_SELECTOR_ID><![CDATA[14F59CBE3B804B8D81D29DFFF5B51467]]></OBUISEL_SELECTOR_ID>
+<!--14F59CBE3B804B8D81D29DFFF5B51467-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--14F59CBE3B804B8D81D29DFFF5B51467-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--14F59CBE3B804B8D81D29DFFF5B51467-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
+<!--14F59CBE3B804B8D81D29DFFF5B51467-->  <NAME><![CDATA[Organization Selector not *]]></NAME>
+<!--14F59CBE3B804B8D81D29DFFF5B51467-->  <AD_REFERENCE_ID><![CDATA[E867C99480754094BE0705D9877FF833]]></AD_REFERENCE_ID>
+<!--14F59CBE3B804B8D81D29DFFF5B51467-->  <AD_TABLE_ID><![CDATA[155]]></AD_TABLE_ID>
+<!--14F59CBE3B804B8D81D29DFFF5B51467-->  <WHERECLAUSE><![CDATA[exists (select 1 from OrganizationType ot where e.organizationType = ot and ot.transactionsAllowed = true) and e.ready = true]]></WHERECLAUSE>
+<!--14F59CBE3B804B8D81D29DFFF5B51467-->  <OBCLKER_TEMPLATE_ID><![CDATA[9314DE8599AD44E7BFC4CC50699042AB]]></OBCLKER_TEMPLATE_ID>
+<!--14F59CBE3B804B8D81D29DFFF5B51467-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--14F59CBE3B804B8D81D29DFFF5B51467-->  <SUGGESTIONTEXTMATCHSTYLE><![CDATA[startsWith]]></SUGGESTIONTEXTMATCHSTYLE>
+<!--14F59CBE3B804B8D81D29DFFF5B51467-->  <POPUPTEXTMATCHSTYLE><![CDATA[startsWith]]></POPUPTEXTMATCHSTYLE>
+<!--14F59CBE3B804B8D81D29DFFF5B51467-->  <CUSTOM_QUERY><![CDATA[N]]></CUSTOM_QUERY>
+<!--14F59CBE3B804B8D81D29DFFF5B51467--></OBUISEL_SELECTOR>
+
 <!--41B3A5EA61AB46FBAF4567E3755BA190--><OBUISEL_SELECTOR>
 <!--41B3A5EA61AB46FBAF4567E3755BA190-->  <OBUISEL_SELECTOR_ID><![CDATA[41B3A5EA61AB46FBAF4567E3755BA190]]></OBUISEL_SELECTOR_ID>
 <!--41B3A5EA61AB46FBAF4567E3755BA190-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -39,7 +55,7 @@
 <!--5D29D4DFCF4440B8BF89420419A0DBFE-->  <NAME><![CDATA[Financial Account]]></NAME>
 <!--5D29D4DFCF4440B8BF89420419A0DBFE-->  <AD_REFERENCE_ID><![CDATA[7F1A079A842545DF966D7EFD4BC5CFCE]]></AD_REFERENCE_ID>
 <!--5D29D4DFCF4440B8BF89420419A0DBFE-->  <AD_TABLE_ID><![CDATA[B129E53BC0E747879F7BA17F0AECEC32]]></AD_TABLE_ID>
-<!--5D29D4DFCF4440B8BF89420419A0DBFE-->  <WHERECLAUSE><![CDATA[@fin_paymentmethod_id@ is null or exists (select 1 from FinancialMgmtFinAccPaymentMethod fpm join fpm.account as fa where fpm.paymentMethod.id = @fin_paymentmethod_id@ and fa = e and (case when @inpissotrx@ = 'true' then fpm.payinAllow else fpm.payoutAllow end) = true and (@inpcCurrencyId@ = fa.currency.id or (case when @inpissotrx@ = 'true' then fpm.payinIsMulticurrency else fpm.payoutIsMulticurrency end) = true))]]></WHERECLAUSE>
+<!--5D29D4DFCF4440B8BF89420419A0DBFE-->  <WHERECLAUSE><![CDATA[@fin_paymentmethod_id@ is null or exists (select 1 from FinancialMgmtFinAccPaymentMethod fpm join fpm.account as fa where fpm.paymentMethod.id = @fin_paymentmethod_id@ and fa = e and (case when @issotrx@ = 'true' then fpm.payinAllow else fpm.payoutAllow end) = true and (@c_currency_id@ = fa.currency.id or (case when @issotrx@ = 'true' then fpm.payinIsMulticurrency else fpm.payoutIsMulticurrency end) = true))]]></WHERECLAUSE>
 <!--5D29D4DFCF4440B8BF89420419A0DBFE-->  <OBCLKER_TEMPLATE_ID><![CDATA[9314DE8599AD44E7BFC4CC50699042AB]]></OBCLKER_TEMPLATE_ID>
 <!--5D29D4DFCF4440B8BF89420419A0DBFE-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--5D29D4DFCF4440B8BF89420419A0DBFE-->  <SUGGESTIONTEXTMATCHSTYLE><![CDATA[startsWith]]></SUGGESTIONTEXTMATCHSTYLE>
@@ -170,7 +186,7 @@
 <!--BA4FDCB15ACB47AD81BE3985E13032EE-->  <NAME><![CDATA[Payment Method]]></NAME>
 <!--BA4FDCB15ACB47AD81BE3985E13032EE-->  <AD_REFERENCE_ID><![CDATA[E664E415582A483DBBC91DEF256FB9E6]]></AD_REFERENCE_ID>
 <!--BA4FDCB15ACB47AD81BE3985E13032EE-->  <AD_TABLE_ID><![CDATA[0B44DF7A2A854784BF34AD49C58647D7]]></AD_TABLE_ID>
-<!--BA4FDCB15ACB47AD81BE3985E13032EE-->  <WHERECLAUSE><![CDATA[exists (select 1 from FinancialMgmtFinAccPaymentMethod fpm where fpm.paymentMethod = e and case when @inpissotrx@ = 'true' then fpm.payinAllow else fpm.payoutAllow end = true)]]></WHERECLAUSE>
+<!--BA4FDCB15ACB47AD81BE3985E13032EE-->  <WHERECLAUSE><![CDATA[exists (select 1 from FinancialMgmtFinAccPaymentMethod fpm where fpm.paymentMethod = e  and  (case when @issotrx@ = 'true' then fpm.payinAllow else fpm.payoutAllow end) = true   and (fpm.account.id =  @fin_financial_account_id@ or @inpwindowId@ <> '94EAA455D2644E04AB25D93BE5157B6D'))]]></WHERECLAUSE>
 <!--BA4FDCB15ACB47AD81BE3985E13032EE-->  <OBCLKER_TEMPLATE_ID><![CDATA[9314DE8599AD44E7BFC4CC50699042AB]]></OBCLKER_TEMPLATE_ID>
 <!--BA4FDCB15ACB47AD81BE3985E13032EE-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--BA4FDCB15ACB47AD81BE3985E13032EE-->  <SUGGESTIONTEXTMATCHSTYLE><![CDATA[substring]]></SUGGESTIONTEXTMATCHSTYLE>
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUISEL_SELECTOR_FIELD.xml
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUISEL_SELECTOR_FIELD.xml	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/OBUISEL_SELECTOR_FIELD.xml	Thu Sep 11 12:13:21 2014 +0200
@@ -151,7 +151,7 @@
 <!--583F20A11FD34C65BEC1F15D5DBF70BA-->  <SORTNO><![CDATA[5]]></SORTNO>
 <!--583F20A11FD34C65BEC1F15D5DBF70BA-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--583F20A11FD34C65BEC1F15D5DBF70BA-->  <ISOUTFIELD><![CDATA[N]]></ISOUTFIELD>
-<!--583F20A11FD34C65BEC1F15D5DBF70BA-->  <DEFAULT_EXPRESSION><![CDATA[if (OB.isSalesTransaction() == false) { 'true' } else {''}]]></DEFAULT_EXPRESSION>
+<!--583F20A11FD34C65BEC1F15D5DBF70BA-->  <DEFAULT_EXPRESSION><![CDATA[OB.getFilterExpression('org.openbravo.advpaymentmngt.filterexpression.BusinessPartnerVendorFilterExpression')]]></DEFAULT_EXPRESSION>
 <!--583F20A11FD34C65BEC1F15D5DBF70BA-->  <SHOWINPICKLIST><![CDATA[N]]></SHOWINPICKLIST>
 <!--583F20A11FD34C65BEC1F15D5DBF70BA--></OBUISEL_SELECTOR_FIELD>
 
@@ -261,7 +261,7 @@
 <!--B67B839A695A44499277CF0D09FAC54F-->  <SORTNO><![CDATA[4]]></SORTNO>
 <!--B67B839A695A44499277CF0D09FAC54F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--B67B839A695A44499277CF0D09FAC54F-->  <ISOUTFIELD><![CDATA[N]]></ISOUTFIELD>
-<!--B67B839A695A44499277CF0D09FAC54F-->  <DEFAULT_EXPRESSION><![CDATA[if (OB.isSalesTransaction() == true) { 'true' } else {''}]]></DEFAULT_EXPRESSION>
+<!--B67B839A695A44499277CF0D09FAC54F-->  <DEFAULT_EXPRESSION><![CDATA[OB.getFilterExpression('org.openbravo.advpaymentmngt.filterexpression.BusinessPartnerCustomerFilterExpression')]]></DEFAULT_EXPRESSION>
 <!--B67B839A695A44499277CF0D09FAC54F-->  <SHOWINPICKLIST><![CDATA[N]]></SHOWINPICKLIST>
 <!--B67B839A695A44499277CF0D09FAC54F--></OBUISEL_SELECTOR_FIELD>
 
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentActionHandler.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentActionHandler.java	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentActionHandler.java	Thu Sep 11 12:13:21 2014 +0200
@@ -82,13 +82,25 @@
   protected JSONObject doExecute(Map<String, Object> parameters, String content) {
     JSONObject jsonResponse = new JSONObject();
     OBContext.setAdminMode(true);
+    boolean openedFromMenu = false;
     try {
       VariablesSecureApp vars = RequestContext.get().getVariablesSecureApp();
       // Get Params
       JSONObject jsonRequest = new JSONObject(content);
       JSONObject jsonparams = jsonRequest.getJSONObject("_params");
 
-      final String strOrgId = jsonRequest.getString("inpadOrgId");
+      if (jsonRequest.has("inpwindowId") && jsonRequest.get("inpwindowId") != JSONObject.NULL) {
+        openedFromMenu = false;
+      } else {
+        openedFromMenu = "null".equals(parameters.get("windowId").toString()) ? true : false;
+      }
+
+      String strOrgId = null;
+      if (jsonRequest.has("inpadOrgId") && jsonRequest.get("inpadOrgId") != JSONObject.NULL) {
+        strOrgId = jsonRequest.getString("inpadOrgId");
+      } else if (jsonparams.has("ad_org_id") && jsonparams.get("ad_org_id") != JSONObject.NULL) {
+        strOrgId = jsonparams.getString("ad_org_id");
+      }
       Organization org = OBDal.getInstance().get(Organization.class, strOrgId);
       boolean isReceipt = jsonparams.getBoolean("issotrx");
 
@@ -153,6 +165,7 @@
           JSONObject errorMessage = new JSONObject();
           errorMessage.put("severity", "error");
           errorMessage.put("text", e.getMessage());
+          jsonResponse.put("retryExecution", openedFromMenu);
           jsonResponse.put("message", errorMessage);
           return jsonResponse;
         }
@@ -177,7 +190,20 @@
         errorMessage.put("severity", message.getType().toLowerCase());
         errorMessage.put("title", message.getTitle());
         errorMessage.put("text", message.getMessage());
+        jsonResponse.put("retryExecution", openedFromMenu);
         jsonResponse.put("message", errorMessage);
+        jsonResponse.put("refreshParent", false);
+        JSONObject setSelectorValueFromRecord = new JSONObject();
+        JSONObject record = new JSONObject();
+        JSONObject responseActions = new JSONObject();
+        record.put("value", payment.getId());
+        record.put("map", payment.getIdentifier());
+        setSelectorValueFromRecord.put("record", record);
+        responseActions.put("setSelectorValueFromRecord", setSelectorValueFromRecord);
+        if (openedFromMenu) {
+          responseActions.put("reloadParameters", setSelectorValueFromRecord);
+        }
+        jsonResponse.put("responseActions", responseActions);
       }
 
     } catch (Exception e) {
@@ -191,6 +217,7 @@
         JSONObject errorMessage = new JSONObject();
         errorMessage.put("severity", "error");
         errorMessage.put("text", message);
+        jsonResponse.put("retryExecution", openedFromMenu);
         jsonResponse.put("message", errorMessage);
 
       } catch (Exception ignore) {
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentDisplayLogicActionHandler.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentDisplayLogicActionHandler.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,114 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+package org.openbravo.advpaymentmngt.actionHandler;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.servlet.http.HttpSession;
+
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.client.application.Parameter;
+import org.openbravo.client.application.ParameterUtils;
+import org.openbravo.client.kernel.BaseActionHandler;
+import org.openbravo.client.kernel.KernelConstants;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.erpCommon.utility.OBMessageUtils;
+import org.openbravo.service.db.DbUtility;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AddPaymentDisplayLogicActionHandler extends BaseActionHandler {
+  private static Logger log = LoggerFactory.getLogger(AddPaymentDisplayLogicActionHandler.class);
+
+  @Override
+  protected final JSONObject execute(Map<String, Object> parameters, String data) {
+    JSONObject result = new JSONObject();
+    JSONObject values = new JSONObject();
+    JSONObject errorMessage = new JSONObject();
+    OBContext.setAdminMode(true);
+    try {
+      final JSONObject jsonData = new JSONObject(data);
+      final JSONArray affectedParams = jsonData.getJSONArray("affectedParams");
+      final JSONObject params = jsonData.getJSONObject("params");
+
+      Iterator<String> keys = params.keys();
+      while (keys.hasNext()) {
+        String key = keys.next();
+        Object value = params.get(key);
+        parameters.put(key, value);
+      }
+
+      for (int i = 0; i < affectedParams.length(); i++) {
+        Parameter param = OBDal.getInstance().get(Parameter.class, affectedParams.getString(i));
+        Object defaultValue = null;
+        Map<String, String> requestMap = fixRequestMap(parameters);
+        requestMap.put("currentParam", param.getDBColumnName());
+        defaultValue = ParameterUtils.getJSExpressionResult(requestMap,
+            (HttpSession) parameters.get(KernelConstants.HTTP_SESSION), param.getDefaultValue());
+        values.put(param.getDBColumnName(), defaultValue);
+      }
+      result.put("values", values);
+
+      String message = "Ok";
+      errorMessage.put("severity", "success");
+      errorMessage.put("text", message);
+      result.put("message", errorMessage);
+    } catch (Exception e) {
+      OBDal.getInstance().rollbackAndClose();
+      log.error(e.getMessage(), e);
+      try {
+        Throwable ex = DbUtility.getUnderlyingSQLException(e);
+        String message = OBMessageUtils.translateError(ex.getMessage()).getMessage();
+        errorMessage = new JSONObject();
+        errorMessage.put("severity", "error");
+        errorMessage.put("title", "Error");
+        errorMessage.put("text", message);
+        result.put("message", errorMessage);
+      } catch (Exception e2) {
+        log.error(e.getMessage(), e2);
+        // do nothing, give up
+      }
+    } finally {
+      OBContext.restorePreviousMode();
+    }
+    return result;
+  }
+
+  /*
+   * The request map is <String, Object> because includes the HTTP request and HTTP session, is not
+   * required to handle process parameters
+   */
+  protected Map<String, String> fixRequestMap(Map<String, Object> parameters) {
+    final Map<String, String> retval = new HashMap<String, String>();
+    for (Entry<String, Object> entries : parameters.entrySet()) {
+      if (entries.getKey().equals(KernelConstants.HTTP_REQUEST)
+          || entries.getKey().equals(KernelConstants.HTTP_SESSION)) {
+        continue;
+      }
+      retval.put(entries.getKey(), entries.getValue().toString());
+    }
+    return retval;
+  }
+}
\ No newline at end of file
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentDocumentNoActionHandler.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentDocumentNoActionHandler.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,52 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+package org.openbravo.advpaymentmngt.actionHandler;
+
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.advpaymentmngt.utility.FIN_Utility;
+import org.openbravo.base.exception.OBException;
+import org.openbravo.client.kernel.BaseActionHandler;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.model.common.enterprise.Organization;
+
+public class AddPaymentDocumentNoActionHandler extends BaseActionHandler {
+
+  @Override
+  protected JSONObject execute(Map<String, Object> parameters, String data) {
+    try {
+      final JSONObject jsonData = new JSONObject(data);
+      JSONObject result = new JSONObject();
+      String strDocNo = null;
+      final String strOrganization = jsonData.getString("organization");
+      if (StringUtils.isNotEmpty(strOrganization)) {
+        Organization organization = OBDal.getInstance().get(Organization.class, strOrganization);
+        strDocNo = FIN_Utility.getDocumentNo(organization, jsonData.getString("issotrx").toString()
+            .equals("true") ? "ARR" : "APP", "FIN_Payment", false);
+      }
+      result.put("payment_documentno", "<" + strDocNo + ">");
+      return result;
+    } catch (Exception e) {
+      throw new OBException(e);
+    }
+  }
+}
\ No newline at end of file
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentOrganizationActionHandler.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentOrganizationActionHandler.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,54 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+package org.openbravo.advpaymentmngt.actionHandler;
+
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.base.exception.OBException;
+import org.openbravo.client.kernel.BaseActionHandler;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.model.common.currency.Currency;
+import org.openbravo.model.common.enterprise.Organization;
+
+public class AddPaymentOrganizationActionHandler extends BaseActionHandler {
+
+  @Override
+  protected JSONObject execute(Map<String, Object> parameters, String data) {
+    try {
+      final JSONObject jsonData = new JSONObject(data);
+      JSONObject result = new JSONObject();
+      Currency currency = null;
+      final String strOrganization = jsonData.getString("organization");
+      if (StringUtils.isNotEmpty(strOrganization)) {
+        Organization organization = OBDal.getInstance().get(Organization.class, strOrganization);
+        currency = OBContext.getOBContext().getOrganizationStructureProvider()
+            .getLegalEntity(organization).getCurrency();
+      }
+      result.put("currency", currency.getId());
+      result.put("currencyIdIdentifier", currency.getIdentifier());
+      return result;
+    } catch (Exception e) {
+      throw new OBException(e);
+    }
+  }
+}
\ No newline at end of file
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentReloadLabelsActionHandler.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/AddPaymentReloadLabelsActionHandler.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,124 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+package org.openbravo.advpaymentmngt.actionHandler;
+
+import java.util.List;
+import java.util.Map;
+
+import org.codehaus.jettison.json.JSONObject;
+import org.hibernate.criterion.Restrictions;
+import org.openbravo.client.application.Parameter;
+import org.openbravo.client.kernel.BaseActionHandler;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBCriteria;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.erpCommon.utility.OBMessageUtils;
+import org.openbravo.model.ad.system.Language;
+import org.openbravo.model.ad.ui.ElementTrl;
+import org.openbravo.service.db.DbUtility;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AddPaymentReloadLabelsActionHandler extends BaseActionHandler {
+  private static Logger log = LoggerFactory.getLogger(AddPaymentReloadLabelsActionHandler.class);
+
+  @Override
+  protected JSONObject execute(Map<String, Object> parameters, String data) {
+    JSONObject result = new JSONObject();
+    JSONObject values = new JSONObject();
+    JSONObject errorMessage = new JSONObject();
+    OBContext.setAdminMode(true);
+    try {
+      final String strBusinessPartner = (String) parameters.get("businessPartner");
+      final String strFinancialAccount = (String) parameters.get("financialAccount");
+      final String strIssotrx = (String) parameters.get("issotrx");
+      boolean issotrx = "true".equals(strIssotrx) ? true : false;
+      final Parameter businessPartner = OBDal.getInstance()
+          .get(Parameter.class, strBusinessPartner);
+      final Parameter financialAccount = OBDal.getInstance().get(Parameter.class,
+          strFinancialAccount);
+      final Language language = OBContext.getOBContext().getLanguage();
+
+      final OBCriteria<ElementTrl> obcBP = OBDal.getInstance().createCriteria(ElementTrl.class);
+      obcBP.add(Restrictions.eq(ElementTrl.PROPERTY_ID, businessPartner.getApplicationElement()
+          .getId()));
+      obcBP.add(Restrictions.eq(ElementTrl.PROPERTY_LANGUAGE, language));
+      final List<ElementTrl> obcListBP = obcBP.list();
+      if (obcListBP.size() > 0) {
+        if (issotrx) {
+          values.put("businessPartner", obcListBP.get(0).getName());
+        } else {
+          values.put("businessPartner", obcListBP.get(0).getPurchaseOrderName());
+        }
+      } else {
+        if (issotrx) {
+          values.put("businessPartner", businessPartner.getApplicationElement().getName());
+        } else {
+          values.put("businessPartner", businessPartner.getApplicationElement()
+              .getPurchaseOrderName());
+        }
+      }
+
+      final OBCriteria<ElementTrl> obcFA = OBDal.getInstance().createCriteria(ElementTrl.class);
+      obcFA.add(Restrictions.eq(ElementTrl.PROPERTY_ID, financialAccount.getApplicationElement()
+          .getId()));
+      obcFA.add(Restrictions.eq(ElementTrl.PROPERTY_LANGUAGE, language));
+      final List<ElementTrl> obcListFA = obcFA.list();
+      if (obcListFA.size() > 0) {
+        if (issotrx) {
+          values.put("financialAccount", obcListFA.get(0).getName());
+        } else {
+          values.put("financialAccount", obcListFA.get(0).getPurchaseOrderName());
+        }
+      } else {
+        if (issotrx) {
+          values.put("financialAccount", financialAccount.getApplicationElement().getName());
+        } else {
+          values.put("financialAccount", financialAccount.getApplicationElement()
+              .getPurchaseOrderName());
+        }
+      }
+
+      String message = "Ok";
+      errorMessage.put("severity", "success");
+      errorMessage.put("text", message);
+      result.put("values", values);
+      result.put("message", errorMessage);
+    } catch (Exception e) {
+      OBDal.getInstance().rollbackAndClose();
+      log.error(e.getMessage(), e);
+      try {
+        Throwable ex = DbUtility.getUnderlyingSQLException(e);
+        String message = OBMessageUtils.translateError(ex.getMessage()).getMessage();
+        errorMessage = new JSONObject();
+        errorMessage.put("severity", "error");
+        errorMessage.put("title", "Error");
+        errorMessage.put("text", message);
+        result.put("message", errorMessage);
+      } catch (Exception e2) {
+        log.error(e.getMessage(), e2);
+        // do nothing, give up
+      }
+    } finally {
+      OBContext.restorePreviousMode();
+    }
+    return result;
+  }
+}
\ No newline at end of file
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/PaymentMethodMulticurrencyActionHandler.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/PaymentMethodMulticurrencyActionHandler.java	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/PaymentMethodMulticurrencyActionHandler.java	Thu Sep 11 12:13:21 2014 +0200
@@ -46,14 +46,24 @@
       final String paymentMethodId = jsonData.getString("paymentMethodId");
       final String financialAccountId = jsonData.getString("financialAccountId");
       final boolean isSOTrx = jsonData.getBoolean("isSOTrx");
-      final String currencyId = jsonData.getString("currencyId");
+      String currencyId = jsonData.getString("currencyId");
       final String strPaymentDate = jsonData.getString("paymentDate");
       Date paymentDate = JsonUtils.createDateFormat().parse(strPaymentDate);
       final String strOrgId = jsonData.getString("orgId");
 
+      JSONObject result = new JSONObject();
+
+      if ("null".equals(currencyId) && !"null".equals(financialAccountId)
+          && !"".equals(financialAccountId)) {
+        FIN_FinancialAccount financialAccount = OBDal.getInstance().get(FIN_FinancialAccount.class,
+            financialAccountId);
+        currencyId = financialAccount.getCurrency().getId();
+        result.put("currencyIdIdentifier", financialAccount.getCurrency().getIdentifier());
+        result.put("currencyId", currencyId);
+      }
+
       final FinAccPaymentMethod finAccPaymentMethod = getFinancialAccountPaymentMethod(
           paymentMethodId, financialAccountId);
-      JSONObject result = new JSONObject();
       if (finAccPaymentMethod != null) {
         result.put("isPayIsMulticurrency", isSOTrx ? finAccPaymentMethod.isPayinIsMulticurrency()
             : finAccPaymentMethod.isPayoutIsMulticurrency());
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/ReceivedFromPaymentMethodActionHandler.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/actionHandler/ReceivedFromPaymentMethodActionHandler.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,77 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+package org.openbravo.advpaymentmngt.actionHandler;
+
+import java.util.Map;
+
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.base.exception.OBException;
+import org.openbravo.client.kernel.BaseActionHandler;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.model.common.businesspartner.BusinessPartner;
+import org.openbravo.model.financialmgmt.payment.FIN_FinancialAccount;
+import org.openbravo.model.financialmgmt.payment.FIN_PaymentMethod;
+import org.openbravo.model.financialmgmt.payment.FinAccPaymentMethod;
+
+public class ReceivedFromPaymentMethodActionHandler extends BaseActionHandler {
+
+  @Override
+  protected JSONObject execute(Map<String, Object> parameters, String data) {
+    try {
+      final JSONObject jsonData = new JSONObject(data);
+      JSONObject result = new JSONObject();
+      FIN_FinancialAccount financialAccount = OBDal.getInstance().get(FIN_FinancialAccount.class,
+          jsonData.getString("financialAccount"));
+      boolean contains = false;
+      String paymentMethod = null;
+
+      if (financialAccount != null) {
+        if (jsonData.has("receivedFrom") && jsonData.get("receivedFrom") != JSONObject.NULL) {
+          final String receivedFrom = jsonData.getString("receivedFrom");
+          BusinessPartner businessPartner = OBDal.getInstance().get(BusinessPartner.class,
+              receivedFrom);
+          if (jsonData.getString("isSOTrx").toString().equals("true")) {
+            paymentMethod = businessPartner.getPaymentMethod().getId();
+          } else {
+            paymentMethod = businessPartner.getPOPaymentMethod().getId();
+          }
+          for (FinAccPaymentMethod finAccPaymentMethod : financialAccount
+              .getFinancialMgmtFinAccPaymentMethodList()) {
+            if (finAccPaymentMethod.getPaymentMethod().equals(
+                OBDal.getInstance().get(FIN_PaymentMethod.class, paymentMethod))) {
+              contains = true;
+            } else {
+              contains = false;
+            }
+          }
+        }
+      } else {
+        contains = false;
+      }
+      if (!contains) {
+        paymentMethod = "";
+      }
+      result.put("paymentMethodId", paymentMethod);
+      return result;
+    } catch (Exception e) {
+      throw new OBException(e);
+    }
+  }
+}
\ No newline at end of file
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddOrderOrInvoiceFilterExpressionHandler.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddOrderOrInvoiceFilterExpressionHandler.java	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddOrderOrInvoiceFilterExpressionHandler.java	Thu Sep 11 12:13:21 2014 +0200
@@ -48,6 +48,14 @@
 
   protected abstract long getSeq();
 
+  /**
+   * This method gets called to obtain the default filtering values for the grid. It can be
+   * overwritten using Injections.
+   * 
+   * @param requestMap
+   * @return String containing the value for the filter expression
+   * @throws JSONException
+   */
   String getFilterExpression(Map<String, String> requestMap) throws JSONException {
     return getDefaultPaymentMethod(requestMap);
   }
@@ -76,8 +84,8 @@
     final String strWindowId = context.getString(OBBindingsConstants.WINDOW_ID_PARAM);
     AddPaymentDefaultValuesHandler handler = getDefaultsHandler(strWindowId);
     String paymentMethodId = handler.getDefaultPaymentMethod(requestMap);
-    if (context.has("inpfinPaymentId") && context.get("inpfinPaymentId") != null
-        && StringUtils.isNotBlank((String) context.get("inpfinPaymentId"))) {
+    if (context.has("inpfinPaymentId") && context.get("inpfinPaymentId") != JSONObject.NULL
+        && StringUtils.isNotBlank((String) context.getString("inpfinPaymentId"))) {
       if (hasDetailsWithDifferentPaymentMethods((String) context.get("inpfinPaymentId"))) {
         return "";
       } else {
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesExpression.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesExpression.java	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesExpression.java	Thu Sep 11 12:13:21 2014 +0200
@@ -102,6 +102,8 @@
           return handler.getDefaultCurrency(requestMap);
         case Organization:
           return handler.getOrganization(requestMap);
+        case Document:
+          return handler.getDefaultDocument(requestMap);
         }
       } catch (Exception e) {
         log.error("Error trying to get default value of " + strCurrentParam + " " + e.getMessage(),
@@ -118,8 +120,13 @@
 
   private String getWindowId(Map<String, String> requestMap) throws JSONException {
     final String strContext = requestMap.get("context");
-    JSONObject context = new JSONObject(strContext);
-    return context.getString(OBBindingsConstants.WINDOW_ID_PARAM);
+    if (strContext != null) {
+      JSONObject context = new JSONObject(strContext);
+      if (context != null && context.has(OBBindingsConstants.WINDOW_ID_PARAM)) {
+        return context.getString(OBBindingsConstants.WINDOW_ID_PARAM);
+      }
+    }
+    return "NULLWINDOWID";
   }
 
   private AddPaymentDefaultValuesHandler getHandler(String strWindowId) {
@@ -147,7 +154,7 @@
         "customer_credit"), IsSOTrx("issotrx"), Payment("fin_payment_id"), Invoice("c_invoice_id"), Order(
         "c_order_id"), ConversionRate("conversion_rate"), ConvertedAmount("converted_amount"), StandardPrecision(
         "StdPrecision"), GenerateCredit("generateCredit"), DocumentCategory("DOCBASETYPE"), ReferenceNo(
-        "reference_no"), Currency("c_currency_id"), Organization("ad_org_id");
+        "reference_no"), Currency("c_currency_id"), Organization("ad_org_id"), Document("trxtype");
 
     private String columnname;
 
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesHandler.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesHandler.java	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDefaultValuesHandler.java	Thu Sep 11 12:13:21 2014 +0200
@@ -40,40 +40,53 @@
 import org.openbravo.model.financialmgmt.payment.FIN_PaymentScheduleDetail;
 
 @RequestScoped
-abstract class AddPaymentDefaultValuesHandler {
+public abstract class AddPaymentDefaultValuesHandler {
 
-  abstract String getDefaultExpectedAmount(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultExpectedAmount(Map<String, String> requestMap)
+      throws JSONException;
 
-  abstract String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultActualAmount(Map<String, String> requestMap)
+      throws JSONException;
 
-  abstract String getDefaultIsSOTrx(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultIsSOTrx(Map<String, String> requestMap) throws JSONException;
 
-  abstract String getDefaultTransactionType(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultTransactionType(Map<String, String> requestMap)
+      throws JSONException;
 
-  abstract String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException;
 
-  abstract String getDefaultOrderType(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultOrderType(Map<String, String> requestMap) throws JSONException;
 
-  abstract String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException;
 
-  abstract String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultConversionRate(Map<String, String> requestMap)
+      throws JSONException;
 
-  abstract String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultConvertedAmount(Map<String, String> requestMap)
+      throws JSONException;
 
-  abstract String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultReceivedFrom(Map<String, String> requestMap)
+      throws JSONException;
 
-  abstract String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultStandardPrecision(Map<String, String> requestMap)
+      throws JSONException;
 
-  abstract String getDefaultCurrency(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultCurrency(Map<String, String> requestMap) throws JSONException;
 
-  abstract String getOrganization(Map<String, String> requestMap) throws JSONException;
+  public abstract String getOrganization(Map<String, String> requestMap) throws JSONException;
 
-  abstract String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException;
+  public abstract String getDefaultDocument(Map<String, String> requestMap) throws JSONException;
+
+  public abstract String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException;
 
   protected abstract long getSeq();
 
-  String getDefaultCurrencyTo(Map<String, String> requestMap) throws JSONException {
-    JSONObject context = new JSONObject(requestMap.get("context"));
+  public String getDefaultCurrencyTo(Map<String, String> requestMap) throws JSONException {
+    String strContext = requestMap.get("context");
+    if (strContext == null) {
+      return "";
+    }
+    JSONObject context = new JSONObject(strContext);
     if (context.has("inpfinFinancialAccountId")
         && context.get("inpfinFinancialAccountId") != JSONObject.NULL
         && StringUtils.isNotEmpty(context.getString("inpfinFinancialAccountId"))) {
@@ -96,7 +109,7 @@
     return null;
   }
 
-  String getDefaultCustomerCredit(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultCustomerCredit(Map<String, String> requestMap) throws JSONException {
     String strBusinessPartnerId = getDefaultReceivedFrom(requestMap);
     String strOrgId = getOrganization(requestMap);
     String strReceipt = getDefaultIsSOTrx(requestMap);
@@ -111,10 +124,14 @@
 
   }
 
-  String getDefaultDocumentNo(Map<String, String> requestMap) throws JSONException {
-    JSONObject context = new JSONObject(requestMap.get("context"));
+  public String getDefaultDocumentNo(Map<String, String> requestMap) throws JSONException {
+    String strContext = requestMap.get("context");
+    String strOrgId = getOrganization(requestMap);
+    if (strContext == null) {
+      return "";
+    }
 
-    Organization org = OBDal.getInstance().get(Organization.class, context.get("inpadOrgId"));
+    Organization org = OBDal.getInstance().get(Organization.class, strOrgId);
     boolean isReceipt = "Y".equals(getDefaultIsSOTrx(requestMap));
 
     String strDocNo = FIN_Utility.getDocumentNo(org, isReceipt ? "ARR" : "APP", "FIN_Payment",
@@ -124,11 +141,19 @@
   }
 
   public String getDefaultFinancialAccount(Map<String, String> requestMap) throws JSONException {
-    JSONObject context = new JSONObject(requestMap.get("context"));
+    String strContext = requestMap.get("context");
+    if (strContext == null) {
+      return "";
+    }
+    JSONObject context = new JSONObject(strContext);
     if (context.has("inpfinFinancialAccountId")
         && context.get("inpfinFinancialAccountId") != JSONObject.NULL
         && StringUtils.isNotEmpty(context.getString("inpfinFinancialAccountId"))) {
       return context.getString("inpfinFinancialAccountId");
+    } else if (context.has("Fin_Financial_Account_ID")
+        && context.get("Fin_Financial_Account_ID") != JSONObject.NULL
+        && StringUtils.isNotEmpty(context.getString("Fin_Financial_Account_ID"))) {
+      return context.getString("Fin_Financial_Account_ID");
     }
     String strBPartnerId = getDefaultReceivedFrom(requestMap);
 
@@ -160,8 +185,12 @@
     return null;
   }
 
-  String getDefaultPaymentMethod(Map<String, String> requestMap) throws JSONException {
-    JSONObject context = new JSONObject(requestMap.get("context"));
+  public String getDefaultPaymentMethod(Map<String, String> requestMap) throws JSONException {
+    String strContext = requestMap.get("context");
+    if (strContext == null) {
+      return "";
+    }
+    JSONObject context = new JSONObject(strContext);
     if (context.has("inpfinPaymentmethodId")
         && context.get("inpfinPaymentmethodId") != JSONObject.NULL
         && StringUtils.isNotEmpty(context.getString("inpfinPaymentmethodId"))) {
@@ -181,7 +210,7 @@
     return null;
   }
 
-  BigDecimal getPendingAmt(List<FIN_PaymentSchedule> pslist) {
+  public BigDecimal getPendingAmt(List<FIN_PaymentSchedule> pslist) {
     BigDecimal pendingAmt = BigDecimal.ZERO;
     for (FIN_PaymentSchedule ps : pslist) {
       List<FIN_PaymentScheduleDetail> psds = null;
@@ -199,12 +228,12 @@
     return pendingAmt;
   }
 
-  String getDefaultGeneratedCredit(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultGeneratedCredit(Map<String, String> requestMap) throws JSONException {
     BigDecimal generateCredit = BigDecimal.ZERO;
     return generateCredit.toPlainString();
   }
 
-  String getDefaultDocumentCategory(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultDocumentCategory(Map<String, String> requestMap) throws JSONException {
     boolean isSOTrx = "Y".equals(getDefaultIsSOTrx(requestMap));
     if (isSOTrx) {
       return "ARR";
@@ -215,7 +244,11 @@
   }
 
   public String getDefaultReferenceNo(Map<String, String> requestMap) throws JSONException {
-    JSONObject context = new JSONObject(requestMap.get("context"));
+    String strContext = requestMap.get("context");
+    if (strContext == null) {
+      return "";
+    }
+    JSONObject context = new JSONObject(strContext);
     if (!context.has("inpfinPaymentId")) {
       return null;
     }
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDisplayLogicsExpression.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDisplayLogicsExpression.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,135 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+package org.openbravo.advpaymentmngt.filterexpression;
+
+import java.util.Map;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.base.exception.OBException;
+import org.openbravo.client.application.FilterExpression;
+import org.openbravo.client.application.OBBindingsConstants;
+import org.openbravo.client.kernel.ComponentProvider;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.erpCommon.utility.OBMessageUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AddPaymentDisplayLogicsExpression implements FilterExpression {
+  private static final Logger log = LoggerFactory
+      .getLogger(AddPaymentDisplayLogicsExpression.class);
+  @Inject
+  @Any
+  private Instance<AddPaymentDisplayLogicsHandler> addPaymentFilterExpressionHandlers;
+
+  @Override
+  public String getExpression(Map<String, String> requestMap) {
+    String strCurrentParam = "";
+    try {
+      OBContext.setAdminMode(true);
+      final String strWindowId = getWindowId(requestMap);
+
+      AddPaymentDisplayLogicsHandler handler = getHandler(strWindowId);
+      if (handler == null) {
+        throw new OBException(String.format(OBMessageUtils.messageBD("APRM_NOHANDLER")));
+      }
+      strCurrentParam = requestMap.get("currentParam");
+      Parameters param = Parameters.getParameter(strCurrentParam);
+      try {
+        switch (param) {
+        case Organization:
+          return handler.getOrganizationDisplayLogic(requestMap) ? "Y" : "N";
+        case Document:
+          return handler.getDocumentDisplayLogic(requestMap) ? "Y" : "N";
+        case CreditToUse:
+          return handler.getCreditToUseDisplayLogic(requestMap) ? "Y" : "N";
+        case OverpaymentAction:
+          return handler.getOverpaymentActionDisplayLogic(requestMap) ? "Y" : "N";
+        }
+      } catch (Exception e) {
+        log.error("Error trying to get default value of " + strCurrentParam + " " + e.getMessage(),
+            e);
+        return null;
+      }
+    } catch (JSONException ignore) {
+    } finally {
+      OBContext.restorePreviousMode();
+    }
+    log.error("No default value found for param: " + strCurrentParam);
+    return null;
+  }
+
+  private String getWindowId(Map<String, String> requestMap) throws JSONException {
+    final String strContext = requestMap.get("context");
+    if (strContext != null) {
+      JSONObject context = new JSONObject(strContext);
+      if (context != null && context.has(OBBindingsConstants.WINDOW_ID_PARAM)) {
+        return context.getString(OBBindingsConstants.WINDOW_ID_PARAM);
+      }
+    }
+    return "NULLWINDOWID";
+  }
+
+  private AddPaymentDisplayLogicsHandler getHandler(String strWindowId) {
+    AddPaymentDisplayLogicsHandler handler = null;
+    for (AddPaymentDisplayLogicsHandler nextHandler : addPaymentFilterExpressionHandlers
+        .select(new ComponentProvider.Selector(strWindowId))) {
+      if (handler == null) {
+        handler = nextHandler;
+      } else if (nextHandler.getSeq() < handler.getSeq()) {
+        handler = nextHandler;
+      } else if (nextHandler.getSeq() == handler.getSeq()) {
+        log.warn(
+            "Trying to get handler for window with id {}, there are more than one instance with the same sequence",
+            strWindowId);
+      }
+    }
+    return handler;
+  }
+
+  private enum Parameters {
+    Organization("ad_org_id_display_logic"), Document("trxtype_display_logic"), CreditToUse(
+        "credit_to_use_display_logic"), OverpaymentAction("overpayment_action_display_logic");
+
+    private String columnname;
+
+    Parameters(String columnname) {
+      this.columnname = columnname;
+    }
+
+    public String getColumnName() {
+      return this.columnname;
+    }
+
+    static Parameters getParameter(String strColumnName) {
+      for (Parameters parameter : Parameters.values()) {
+        if (strColumnName.equals(parameter.getColumnName())) {
+          return parameter;
+        }
+      }
+      return null;
+    }
+  }
+
+}
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDisplayLogicsHandler.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentDisplayLogicsHandler.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,63 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.advpaymentmngt.filterexpression;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+import javax.enterprise.context.RequestScoped;
+
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+
+@RequestScoped
+public abstract class AddPaymentDisplayLogicsHandler {
+
+  public abstract boolean getOrganizationDisplayLogic(Map<String, String> requestMap)
+      throws JSONException;
+
+  public abstract boolean getDocumentDisplayLogic(Map<String, String> requestMap)
+      throws JSONException;
+
+  public abstract boolean getCreditToUseDisplayLogic(Map<String, String> requestMap)
+      throws JSONException;
+
+  protected abstract long getSeq();
+
+  public boolean getOverpaymentActionDisplayLogic(Map<String, String> requestMap)
+      throws JSONException {
+    String strContext = requestMap.get("context");
+    if (strContext == null) {
+      return false;
+    }
+    JSONObject context = new JSONObject(strContext);
+    if (context.has("difference")) {
+      double diff = context.getDouble("difference");
+      BigDecimal difference = new BigDecimal(diff);
+      if (difference.signum() > 0) {
+        return true;
+      } else {
+        return false;
+      }
+    } else {
+      return false;
+    }
+
+  }
+}
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentReadOnlyLogicsExpression.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentReadOnlyLogicsExpression.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,148 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+package org.openbravo.advpaymentmngt.filterexpression;
+
+import java.util.Map;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.base.exception.OBException;
+import org.openbravo.client.application.FilterExpression;
+import org.openbravo.client.application.OBBindingsConstants;
+import org.openbravo.client.kernel.ComponentProvider;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.erpCommon.utility.OBMessageUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AddPaymentReadOnlyLogicsExpression implements FilterExpression {
+  private static final Logger log = LoggerFactory
+      .getLogger(AddPaymentReadOnlyLogicsExpression.class);
+  @Inject
+  @Any
+  private Instance<AddPaymentReadOnlyLogicsHandler> addPaymentFilterExpressionHandlers;
+
+  @Override
+  public String getExpression(Map<String, String> requestMap) {
+    String strCurrentParam = "";
+    try {
+      OBContext.setAdminMode(true);
+      final String strWindowId = getWindowId(requestMap);
+
+      AddPaymentReadOnlyLogicsHandler handler = getHandler(strWindowId);
+      if (handler == null) {
+        throw new OBException(String.format(OBMessageUtils.messageBD("APRM_NOHANDLER")));
+      }
+      strCurrentParam = requestMap.get("currentParam");
+      Parameters param = Parameters.getParameter(strCurrentParam);
+      try {
+        switch (param) {
+        case PaymentDocumentNo:
+          return handler.getPaymentDocumentNoReadOnlyLogic(requestMap) ? "Y" : "N";
+        case ReceivedFrom:
+          return handler.getReceivedFromReadOnlyLogic(requestMap) ? "Y" : "N";
+        case PaymentMethod:
+          return handler.getPaymentMethodReadOnlyLogic(requestMap) ? "Y" : "N";
+        case ActualPayment:
+          return handler.getActualPaymentReadOnlyLogic(requestMap) ? "Y" : "N";
+        case ConvertedAmount:
+          return handler.getConvertedAmountReadOnlyLogic(requestMap) ? "Y" : "N";
+        case PaymentDate:
+          return handler.getPaymentDateReadOnlyLogic(requestMap) ? "Y" : "N";
+        case FinancialAccount:
+          return handler.getFinancialAccountReadOnlyLogic(requestMap) ? "Y" : "N";
+        case ConversionRate:
+          return handler.getConversionRateReadOnlyLogic(requestMap) ? "Y" : "N";
+        case Currency:
+          return handler.getCurrencyReadOnlyLogic(requestMap) ? "Y" : "N";
+        }
+      } catch (Exception e) {
+        log.error("Error trying to get default value of " + strCurrentParam + " " + e.getMessage(),
+            e);
+        return null;
+      }
+    } catch (JSONException ignore) {
+    } finally {
+      OBContext.restorePreviousMode();
+    }
+    log.error("No default value found for param: " + strCurrentParam);
+    return null;
+  }
+
+  private String getWindowId(Map<String, String> requestMap) throws JSONException {
+    final String strContext = requestMap.get("context");
+    if (strContext != null) {
+      JSONObject context = new JSONObject(strContext);
+      if (context != null && context.has(OBBindingsConstants.WINDOW_ID_PARAM)) {
+        return context.getString(OBBindingsConstants.WINDOW_ID_PARAM);
+      }
+    }
+    return "NULLWINDOWID";
+  }
+
+  private AddPaymentReadOnlyLogicsHandler getHandler(String strWindowId) {
+    AddPaymentReadOnlyLogicsHandler handler = null;
+    for (AddPaymentReadOnlyLogicsHandler nextHandler : addPaymentFilterExpressionHandlers
+        .select(new ComponentProvider.Selector(strWindowId))) {
+      if (handler == null) {
+        handler = nextHandler;
+      } else if (nextHandler.getSeq() < handler.getSeq()) {
+        handler = nextHandler;
+      } else if (nextHandler.getSeq() == handler.getSeq()) {
+        log.warn(
+            "Trying to get handler for window with id {}, there are more than one instance with the same sequence",
+            strWindowId);
+      }
+    }
+    return handler;
+  }
+
+  private enum Parameters {
+    PaymentDocumentNo("payment_documentno_readonly_logic"), ReceivedFrom(
+        "received_from_readonly_logic"), PaymentMethod("payment_method_readonly_logic"), ActualPayment(
+        "actual_payment_readonly_logic"), ConvertedAmount("converted_amount_readonly_logic"), PaymentDate(
+        "payment_date_readonly_logic"), FinancialAccount("fin_financial_account_id_readonly_logic"), ConversionRate(
+        "conversion_rate_readonly_logic"), Currency("c_currency_id_readonly_logic");
+
+    private String columnname;
+
+    Parameters(String columnname) {
+      this.columnname = columnname;
+    }
+
+    public String getColumnName() {
+      return this.columnname;
+    }
+
+    static Parameters getParameter(String strColumnName) {
+      for (Parameters parameter : Parameters.values()) {
+        if (strColumnName.equals(parameter.getColumnName())) {
+          return parameter;
+        }
+      }
+      return null;
+    }
+  }
+
+}
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentReadOnlyLogicsHandler.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/AddPaymentReadOnlyLogicsHandler.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,126 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.advpaymentmngt.filterexpression;
+
+import java.util.Map;
+
+import javax.enterprise.context.RequestScoped;
+
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.erpCommon.utility.PropertyException;
+import org.openbravo.erpCommon.utility.PropertyNotFoundException;
+import org.openbravo.model.ad.ui.Window;
+import org.openbravo.scheduling.ProcessLogger;
+
+@RequestScoped
+public abstract class AddPaymentReadOnlyLogicsHandler {
+
+  private static ProcessLogger logger;
+
+  public abstract boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException;
+
+  public abstract boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException;
+
+  public abstract boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException;
+
+  public abstract boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException;
+
+  public abstract boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException;
+
+  public abstract boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException;
+
+  public abstract boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException;
+
+  protected abstract long getSeq();
+
+  public boolean getConvertedAmountReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
+    String strContext = requestMap.get("context");
+    if (strContext == null) {
+      return false;
+    }
+    OBContext.setAdminMode();
+    JSONObject context = new JSONObject(strContext);
+    String strWindow = context.getString("inpwindowId");
+    Window window = OBDal.getInstance().get(Window.class, strWindow == null ? "" : strWindow);
+
+    try {
+      String value = org.openbravo.erpCommon.businessUtility.Preferences.getPreferenceValue(
+          "NotAllowChangeExchange", true, OBContext.getOBContext().getCurrentClient(), OBContext
+              .getOBContext().getCurrentOrganization(), OBContext.getOBContext().getUser(),
+          OBContext.getOBContext().getRole(), window);
+      if ("Y".equals(value)) {
+        return true;
+      } else {
+        return false;
+      }
+    } catch (PropertyNotFoundException e) {
+      // logger.log("Property not found \n");
+      return false;
+    } catch (PropertyException e) {
+      // logger.log("PropertyException, there is a conflict for NotAllowChangeExchange property\n");
+      return false;
+    } finally {
+      OBContext.restorePreviousMode();
+    }
+  }
+
+  public boolean getConversionRateReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
+    String strContext = requestMap.get("context");
+    if (strContext == null) {
+      return false;
+    }
+    OBContext.setAdminMode();
+    JSONObject context = new JSONObject(strContext);
+    String strWindow = context.getString("inpwindowId");
+    Window window = OBDal.getInstance().get(Window.class, strWindow == null ? "" : strWindow);
+
+    try {
+      String value = org.openbravo.erpCommon.businessUtility.Preferences.getPreferenceValue(
+          "NotAllowChangeExchange", true, OBContext.getOBContext().getCurrentClient(), OBContext
+              .getOBContext().getCurrentOrganization(), OBContext.getOBContext().getUser(),
+          OBContext.getOBContext().getRole(), window);
+      if ("Y".equals(value)) {
+        return true;
+      } else {
+        return false;
+      }
+    } catch (PropertyNotFoundException e) {
+      // logger.log("Property not found \n");
+      return false;
+    } catch (PropertyException e) {
+      // logger.log("PropertyException, there is a conflict for NotAllowChangeExchange property\n");
+      return false;
+    } finally {
+      OBContext.restorePreviousMode();
+    }
+  }
+
+}
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/BusinessPartnerCustomerFilterExpression.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/BusinessPartnerCustomerFilterExpression.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,52 @@
+package org.openbravo.advpaymentmngt.filterexpression;
+
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.openbravo.client.application.FilterExpression;
+import org.openbravo.client.application.OBBindingsConstants;
+import org.openbravo.client.application.ParameterUtils;
+import org.openbravo.client.kernel.RequestContext;
+
+public class BusinessPartnerCustomerFilterExpression implements FilterExpression {
+  private Logger log = Logger.getLogger(BusinessPartnerCustomerFilterExpression.class);
+  private Map<String, String> requestMap;
+  private String windowId;
+  private String financialAccountWindowId = "94EAA455D2644E04AB25D93BE5157B6D";
+  private String issotrx = null;
+  String result = null;
+
+  @Override
+  public String getExpression(Map<String, String> _requestMap) {
+    requestMap = _requestMap;
+    windowId = requestMap.get(OBBindingsConstants.WINDOW_ID_PARAM);
+    if (requestMap.get("issotrx") != null
+        && (financialAccountWindowId.equals(windowId) || windowId == null)) {
+      issotrx = requestMap.get("issotrx");
+      if ("true".equals(issotrx)) {
+        return "true";
+      } else {
+        return "";
+      }
+    } else if (requestMap.get("IsSOTrx") != null && financialAccountWindowId.equals(windowId)) {
+      issotrx = requestMap.get("IsSOTrx");
+      if ("Y".equals(issotrx)) {
+        return "true";
+      } else {
+        return "";
+      }
+    } else {
+      try {
+        result = (String) ParameterUtils.getJSExpressionResult(_requestMap, RequestContext.get()
+            .getSession(), "if (OB.isSalesTransaction() == true) { 'true' } else {''}");
+        return result;
+      } catch (Exception e) {
+        log.error(
+            "Error evaluating filter expression: if (OB.isSalesTransaction() == false) { 'true' } else {''}",
+            e);
+      }
+      return "";
+    }
+  }
+
+}
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/BusinessPartnerVendorFilterExpression.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/BusinessPartnerVendorFilterExpression.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,52 @@
+package org.openbravo.advpaymentmngt.filterexpression;
+
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.openbravo.client.application.FilterExpression;
+import org.openbravo.client.application.OBBindingsConstants;
+import org.openbravo.client.application.ParameterUtils;
+import org.openbravo.client.kernel.RequestContext;
+
+public class BusinessPartnerVendorFilterExpression implements FilterExpression {
+  private Logger log = Logger.getLogger(BusinessPartnerVendorFilterExpression.class);
+  private Map<String, String> requestMap;
+  private String windowId;
+  private String financialAccountWindowId = "94EAA455D2644E04AB25D93BE5157B6D";
+  private String issotrx = null;
+  String result = null;
+
+  @Override
+  public String getExpression(Map<String, String> _requestMap) {
+    requestMap = _requestMap;
+    windowId = requestMap.get(OBBindingsConstants.WINDOW_ID_PARAM);
+    if (requestMap.get("issotrx") != null
+        && (financialAccountWindowId.equals(windowId) || windowId == null)) {
+      issotrx = requestMap.get("issotrx");
+      if ("false".equals(issotrx)) {
+        return "true";
+      } else {
+        return "";
+      }
+    } else if (requestMap.get("IsSOTrx") != null && financialAccountWindowId.equals(windowId)) {
+      issotrx = requestMap.get("IsSOTrx");
+      if ("N".equals(issotrx)) {
+        return "true";
+      } else {
+        return "";
+      }
+    } else {
+      try {
+        result = (String) ParameterUtils.getJSExpressionResult(_requestMap, RequestContext.get()
+            .getSession(), "if (OB.isSalesTransaction() == false) { 'true' } else {''}");
+        return result;
+      } catch (Exception e) {
+        log.error(
+            "Error evaluating filter expression: if (OB.isSalesTransaction() == false) { 'true' } else {''}",
+            e);
+        return "";
+      }
+    }
+  }
+
+}
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentInAddPaymentDefaultValues.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentInAddPaymentDefaultValues.java	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentInAddPaymentDefaultValues.java	Thu Sep 11 12:13:21 2014 +0200
@@ -39,47 +39,47 @@
   }
 
   @Override
-  String getDefaultExpectedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultExpectedAmount(Map<String, String> requestMap) throws JSONException {
     // Expected amount is the amount on the editing payment
     BigDecimal pendingAmt = getPayment(requestMap).getAmount();
     return pendingAmt.toPlainString();
   }
 
   @Override
-  String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
     // Actual amount is the amount on the editing payment
     BigDecimal pendingAmt = getPayment(requestMap).getAmount();
     return pendingAmt.toPlainString();
   }
 
   @Override
-  String getDefaultIsSOTrx(Map<String, String> requestMap) {
+  public String getDefaultIsSOTrx(Map<String, String> requestMap) {
     return "Y";
   }
 
   @Override
-  String getDefaultTransactionType(Map<String, String> requestMap) {
+  public String getDefaultTransactionType(Map<String, String> requestMap) {
     return "I";
   }
 
   @Override
-  String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     return context.getString("inpfinPaymentId");
   }
 
   @Override
-  String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultDocumentNo(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultDocumentNo(Map<String, String> requestMap) throws JSONException {
     // Document Number of the current Payment
     FIN_Payment payment = getPayment(requestMap);
     return payment.getDocumentNo();
@@ -100,21 +100,21 @@
   }
 
   @Override
-  String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
     // Conversion Rate of the current Payment
     FIN_Payment payment = getPayment(requestMap);
     return payment.getFinancialTransactionConvertRate().toPlainString();
   }
 
   @Override
-  String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
     // Converted Amount of the current Payment
     FIN_Payment payment = getPayment(requestMap);
     return payment.getFinancialTransactionAmount().toPlainString();
   }
 
   @Override
-  String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
     // Business Partner of the current Payment
     FIN_Payment payment = getPayment(requestMap);
     if (payment.getBusinessPartner() != null) {
@@ -125,29 +125,35 @@
   }
 
   @Override
-  String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
     // Standard Precision of the currency
     FIN_Payment payment = getPayment(requestMap);
     return payment.getCurrency().getStandardPrecision().toString();
   }
 
   @Override
-  String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
     // Currency of the current Payment
     FIN_Payment payment = getPayment(requestMap);
     return payment.getCurrency().getId();
   }
 
   @Override
-  String getOrganization(Map<String, String> requestMap) throws JSONException {
+  public String getOrganization(Map<String, String> requestMap) throws JSONException {
     // Organization of the current Payment
     return getPayment(requestMap).getOrganization().getId();
   }
 
   @Override
-  String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
     // Payment Date of the current payment
     return OBDateUtils.formatDate(getPayment(requestMap).getPaymentDate());
   }
 
+  @Override
+  public String getDefaultDocument(Map<String, String> requestMap) throws JSONException {
+    // Document Type
+    return "";
+  }
+
 }
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentInAddPaymentDisplayLogics.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentInAddPaymentDisplayLogics.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,87 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.advpaymentmngt.filterexpression;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.advpaymentmngt.dao.AdvPaymentMngtDao;
+import org.openbravo.advpaymentmngt.utility.APRMConstants;
+import org.openbravo.client.kernel.ComponentProvider;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.model.common.businesspartner.BusinessPartner;
+import org.openbravo.model.common.enterprise.Organization;
+import org.openbravo.model.financialmgmt.payment.FIN_Payment;
+
+@ComponentProvider.Qualifier(APRMConstants.PAYMENT_IN_WINDOW_ID)
+public class PaymentInAddPaymentDisplayLogics extends AddPaymentDisplayLogicsHandler {
+
+  private static final long SEQUENCE = 100l;
+
+  protected long getSeq() {
+    return SEQUENCE;
+  }
+
+  @Override
+  public boolean getOrganizationDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // Organization
+    return false;
+  }
+
+  @Override
+  public boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // Document Type
+    return false;
+  }
+
+  @Override
+  public boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // "@customer_credit@ > 0 & @received_from@!'' & (@issotrx@ == true | @generateCredit@ == 0)";
+    FIN_Payment paymentIn = getPayment(requestMap);
+    BusinessPartner bpartner = paymentIn.getBusinessPartner();
+    if (bpartner != null) {
+      Organization org = paymentIn.getOrganization();
+      BigDecimal customerCredit = new AdvPaymentMngtDao().getCustomerCredit(bpartner, true, org);
+      if (customerCredit.signum() > 0) {
+        return true;
+      } else {
+        return false;
+      }
+    } else {
+      return false;
+    }
+  }
+
+  private FIN_Payment getPayment(Map<String, String> requestMap) throws JSONException {
+    // Current Payment
+    JSONObject context = new JSONObject(requestMap.get("context"));
+    String strFinPaymentId = "";
+    if (context.has("inpfinPaymentId") && !context.isNull("inpfinPaymentId")) {
+      strFinPaymentId = context.getString("inpfinPaymentId");
+    }
+    if (context.has("Fin_Payment_ID") && !context.isNull("Fin_Payment_ID")) {
+      strFinPaymentId = context.getString("Fin_Payment_ID");
+    }
+    FIN_Payment payment = OBDal.getInstance().get(FIN_Payment.class, strFinPaymentId);
+    return payment;
+  }
+
+}
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentInAddPaymentReadOnlyLogics.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentInAddPaymentReadOnlyLogics.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,72 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.advpaymentmngt.filterexpression;
+
+import java.util.Map;
+
+import org.codehaus.jettison.json.JSONException;
+import org.openbravo.advpaymentmngt.utility.APRMConstants;
+import org.openbravo.client.kernel.ComponentProvider;
+
+@ComponentProvider.Qualifier(APRMConstants.PAYMENT_IN_WINDOW_ID)
+public class PaymentInAddPaymentReadOnlyLogics extends AddPaymentReadOnlyLogicsHandler {
+
+  private static final long SEQUENCE = 100l;
+
+  protected long getSeq() {
+    return SEQUENCE;
+  }
+
+  @Override
+  public boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
+    return true;
+  }
+
+  @Override
+  public boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
+  @Override
+  public boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
+  @Override
+  public boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return false;
+  }
+
+  @Override
+  public boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
+  @Override
+  public boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
+    return true;
+  }
+
+  @Override
+  public boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+}
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentOutAddPaymentDefaultValues.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentOutAddPaymentDefaultValues.java	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentOutAddPaymentDefaultValues.java	Thu Sep 11 12:13:21 2014 +0200
@@ -39,21 +39,21 @@
   }
 
   @Override
-  String getDefaultExpectedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultExpectedAmount(Map<String, String> requestMap) throws JSONException {
     // Expected amount is the amount on the editing payment
     BigDecimal pendingAmt = getPayment(requestMap).getAmount();
     return pendingAmt.toPlainString();
   }
 
   @Override
-  String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
     // Actual amount is the amount on the editing payment
     BigDecimal pendingAmt = getPayment(requestMap).getAmount();
     return pendingAmt.toPlainString();
   }
 
   @Override
-  String getDefaultGeneratedCredit(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultGeneratedCredit(Map<String, String> requestMap) throws JSONException {
     // Generated Credit of the current Payment
     BigDecimal generateCredit = getPayment(requestMap).getGeneratedCredit();
     if (generateCredit == null) {
@@ -64,33 +64,33 @@
   }
 
   @Override
-  String getDefaultIsSOTrx(Map<String, String> requestMap) {
+  public String getDefaultIsSOTrx(Map<String, String> requestMap) {
     return "N";
   }
 
   @Override
-  String getDefaultTransactionType(Map<String, String> requestMap) {
+  public String getDefaultTransactionType(Map<String, String> requestMap) {
     return "I";
   }
 
   @Override
-  String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     return context.getString("inpfinPaymentId");
   }
 
   @Override
-  String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultDocumentNo(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultDocumentNo(Map<String, String> requestMap) throws JSONException {
     // Document Number of the current Payment
     FIN_Payment payment = getPayment(requestMap);
     return payment.getDocumentNo();
@@ -111,21 +111,21 @@
   }
 
   @Override
-  String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
     // Conversion Rate of the current Payment
     FIN_Payment payment = getPayment(requestMap);
     return payment.getFinancialTransactionConvertRate().toPlainString();
   }
 
   @Override
-  String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
     // Converted Amount of the current Payment
     FIN_Payment payment = getPayment(requestMap);
     return payment.getFinancialTransactionAmount().toPlainString();
   }
 
   @Override
-  String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
     // Business Partner of the current Payment
     FIN_Payment payment = getPayment(requestMap);
     if (payment.getBusinessPartner() != null) {
@@ -136,29 +136,35 @@
   }
 
   @Override
-  String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
     // Standard Precision of the currency
     FIN_Payment payment = getPayment(requestMap);
     return payment.getCurrency().getStandardPrecision().toString();
   }
 
   @Override
-  String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
     // Currency of the current Payment
     FIN_Payment payment = getPayment(requestMap);
     return payment.getCurrency().getId();
   }
 
   @Override
-  String getOrganization(Map<String, String> requestMap) throws JSONException {
+  public String getOrganization(Map<String, String> requestMap) throws JSONException {
     // Organization of the current Payment
     return getPayment(requestMap).getOrganization().getId();
   }
 
   @Override
-  String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
     // Payment Date of the current payment
     return OBDateUtils.formatDate(getPayment(requestMap).getPaymentDate());
   }
 
+  @Override
+  public String getDefaultDocument(Map<String, String> requestMap) throws JSONException {
+    // Document Type
+    return "";
+  }
+
 }
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentOutAddPaymentDisplayLogics.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentOutAddPaymentDisplayLogics.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,95 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.advpaymentmngt.filterexpression;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.advpaymentmngt.dao.AdvPaymentMngtDao;
+import org.openbravo.advpaymentmngt.utility.APRMConstants;
+import org.openbravo.client.kernel.ComponentProvider;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.model.common.businesspartner.BusinessPartner;
+import org.openbravo.model.common.enterprise.Organization;
+import org.openbravo.model.financialmgmt.payment.FIN_Payment;
+
+@ComponentProvider.Qualifier(APRMConstants.PAYMENT_OUT_WINDOW_ID)
+public class PaymentOutAddPaymentDisplayLogics extends AddPaymentDisplayLogicsHandler {
+
+  private static final long SEQUENCE = 100l;
+
+  protected long getSeq() {
+    return SEQUENCE;
+  }
+
+  @Override
+  public boolean getOrganizationDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // Organization
+    return false;
+  }
+
+  @Override
+  public boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // Document Type
+    return false;
+  }
+
+  @Override
+  public boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    FIN_Payment paymentOut = getPayment(requestMap);
+    if (getGeneratedCredit(requestMap).signum() == 0) {
+      BusinessPartner bpartner = paymentOut.getBusinessPartner();
+      if (bpartner != null) {
+        Organization org = paymentOut.getOrganization();
+        BigDecimal customerCredit = new AdvPaymentMngtDao().getCustomerCredit(bpartner, false, org);
+        if (customerCredit.signum() > 0) {
+          return true;
+        } else {
+          return false;
+        }
+      } else {
+        return false;
+      }
+    } else {
+      return false;
+    }
+  }
+
+  private FIN_Payment getPayment(Map<String, String> requestMap) throws JSONException {
+    // Current Payment
+    JSONObject context = new JSONObject(requestMap.get("context"));
+    String strFinPaymentId = "";
+    if (context.has("inpfinPaymentId") && !context.isNull("inpfinPaymentId")) {
+      strFinPaymentId = context.getString("inpfinPaymentId");
+    }
+    if (context.has("Fin_Payment_ID") && !context.isNull("Fin_Payment_ID")) {
+      strFinPaymentId = context.getString("Fin_Payment_ID");
+    }
+    FIN_Payment payment = OBDal.getInstance().get(FIN_Payment.class, strFinPaymentId);
+    return payment;
+  }
+
+  BigDecimal getGeneratedCredit(Map<String, String> requestMap) throws JSONException {
+    // Generated Credit of the current Payment
+    return getPayment(requestMap).getGeneratedCredit();
+  }
+
+}
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentOutAddPaymentReadOnlyLogics.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PaymentOutAddPaymentReadOnlyLogics.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,73 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.advpaymentmngt.filterexpression;
+
+import java.util.Map;
+
+import org.codehaus.jettison.json.JSONException;
+import org.openbravo.advpaymentmngt.utility.APRMConstants;
+import org.openbravo.client.kernel.ComponentProvider;
+
+@ComponentProvider.Qualifier(APRMConstants.PAYMENT_OUT_WINDOW_ID)
+public class PaymentOutAddPaymentReadOnlyLogics extends AddPaymentReadOnlyLogicsHandler {
+
+  private static final long SEQUENCE = 100l;
+
+  protected long getSeq() {
+    return SEQUENCE;
+  }
+
+  @Override
+  public boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
+    return true;
+  }
+
+  @Override
+  public boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
+  @Override
+  public boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
+  @Override
+  public boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
+  @Override
+  public boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
+  @Override
+  public boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
+    return true;
+  }
+
+  @Override
+  public boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
+}
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseInvoiceAddPaymentDefaultValues.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseInvoiceAddPaymentDefaultValues.java	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseInvoiceAddPaymentDefaultValues.java	Thu Sep 11 12:13:21 2014 +0200
@@ -47,7 +47,7 @@
   }
 
   @Override
-  String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
     // Actual amount is the amount on the editing Purchase Invoice
     BigDecimal pendingAmt = getPendingAmount(requestMap);
     return pendingAmt.toPlainString();
@@ -60,43 +60,43 @@
   }
 
   @Override
-  String getDefaultIsSOTrx(Map<String, String> requestMap) {
+  public String getDefaultIsSOTrx(Map<String, String> requestMap) {
     return "N";
   }
 
   @Override
-  String getDefaultTransactionType(Map<String, String> requestMap) {
+  public String getDefaultTransactionType(Map<String, String> requestMap) {
     return "I";
   }
 
   @Override
-  String getDefaultPaymentType(Map<String, String> requestMap) {
+  public String getDefaultPaymentType(Map<String, String> requestMap) {
     return "";
   }
 
   @Override
-  String getDefaultOrderType(Map<String, String> requestMap) {
+  public String getDefaultOrderType(Map<String, String> requestMap) {
     return "";
   }
 
   @Override
-  String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     return context.getString("inpcInvoiceId");
   }
 
   @Override
-  String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
     // Business Partner of the current Purchase Invoice
     JSONObject context = new JSONObject(requestMap.get("context"));
     Invoice invoice = getInvoice(context);
@@ -104,7 +104,7 @@
   }
 
   @Override
-  String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
     // Standard Precision of the currency
     JSONObject context = new JSONObject(requestMap.get("context"));
     Invoice invoice = getInvoice(context);
@@ -112,7 +112,7 @@
   }
 
   @Override
-  String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
     // Currency of the current Purchase Invoice
     JSONObject context = new JSONObject(requestMap.get("context"));
     Invoice invoice = getInvoice(context);
@@ -120,17 +120,23 @@
   }
 
   @Override
-  String getOrganization(Map<String, String> requestMap) throws JSONException {
+  public String getOrganization(Map<String, String> requestMap) throws JSONException {
     // Currency of the current Purchase Invoice
     return getInvoice(new JSONObject(requestMap.get("context"))).getOrganization().getId();
   }
 
+  @Override
+  public String getDefaultDocument(Map<String, String> requestMap) throws JSONException {
+    // Document Type
+    return "";
+  }
+
   Invoice getInvoice(JSONObject context) throws JSONException {
     return OBDal.getInstance().get(Invoice.class, context.getString("inpcInvoiceId"));
   }
 
   @Override
-  String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
     return OBDateUtils.formatDate(new Date());
   }
 
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseInvoiceAddPaymentDisplayLogics.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseInvoiceAddPaymentDisplayLogics.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,85 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.advpaymentmngt.filterexpression;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.advpaymentmngt.dao.AdvPaymentMngtDao;
+import org.openbravo.advpaymentmngt.utility.APRMConstants;
+import org.openbravo.client.kernel.ComponentProvider;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.model.common.businesspartner.BusinessPartner;
+import org.openbravo.model.common.enterprise.Organization;
+import org.openbravo.model.common.invoice.Invoice;
+
+@ComponentProvider.Qualifier(APRMConstants.PURCHASE_INVOICE_WINDOW_ID)
+public class PurchaseInvoiceAddPaymentDisplayLogics extends AddPaymentDisplayLogicsHandler {
+
+  private static final long SEQUENCE = 100l;
+
+  protected long getSeq() {
+    return SEQUENCE;
+  }
+
+  @Override
+  public boolean getOrganizationDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // Organization
+    return false;
+  }
+
+  @Override
+  public boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // Document Type
+    return false;
+  }
+
+  @Override
+  public boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    JSONObject context = new JSONObject(requestMap.get("context"));
+    Invoice invoice = getInvoice(context);
+    if (getDefaultGeneratedCredit(requestMap).signum() == 0) {
+      BusinessPartner bpartner = invoice.getBusinessPartner();
+      if (bpartner != null) {
+        Organization org = invoice.getOrganization();
+        BigDecimal customerCredit = new AdvPaymentMngtDao().getCustomerCredit(bpartner, false, org);
+        if (customerCredit.signum() > 0) {
+          return true;
+        } else {
+          return false;
+        }
+      } else {
+        return false;
+      }
+    } else {
+      return false;
+    }
+  }
+
+  Invoice getInvoice(JSONObject context) throws JSONException {
+    return OBDal.getInstance().get(Invoice.class, context.getString("inpcInvoiceId"));
+  }
+
+  BigDecimal getDefaultGeneratedCredit(Map<String, String> requestMap) throws JSONException {
+    return BigDecimal.ZERO;
+  }
+
+}
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseInvoiceAddPaymentReadOnlyLogics.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseInvoiceAddPaymentReadOnlyLogics.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,73 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.advpaymentmngt.filterexpression;
+
+import java.util.Map;
+
+import org.codehaus.jettison.json.JSONException;
+import org.openbravo.advpaymentmngt.utility.APRMConstants;
+import org.openbravo.client.kernel.ComponentProvider;
+
+@ComponentProvider.Qualifier(APRMConstants.PURCHASE_INVOICE_WINDOW_ID)
+public class PurchaseInvoiceAddPaymentReadOnlyLogics extends AddPaymentReadOnlyLogicsHandler {
+
+  private static final long SEQUENCE = 100l;
+
+  protected long getSeq() {
+    return SEQUENCE;
+  }
+
+  @Override
+  public boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
+    return false;
+  }
+
+  @Override
+  public boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
+  @Override
+  public boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return false;
+  }
+
+  @Override
+  public boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
+  @Override
+  public boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return false;
+  }
+
+  @Override
+  public boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
+    return false;
+  }
+
+  @Override
+  public boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
+}
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseOrderAddPaymentDefaultValues.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseOrderAddPaymentDefaultValues.java	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseOrderAddPaymentDefaultValues.java	Thu Sep 11 12:13:21 2014 +0200
@@ -40,7 +40,7 @@
   }
 
   @Override
-  String getDefaultExpectedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultExpectedAmount(Map<String, String> requestMap) throws JSONException {
     // Expected amount is the amount pending to pay on the Purchase Order
     JSONObject context = new JSONObject(requestMap.get("context"));
     String strOrderId = context.getString("inpcOrderId");
@@ -49,7 +49,7 @@
   }
 
   @Override
-  String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
     // Actual amount is the amount pending to pay on the Purchase Order
     JSONObject context = new JSONObject(requestMap.get("context"));
     String strOrderId = context.getString("inpcOrderId");
@@ -58,12 +58,12 @@
   }
 
   @Override
-  String getDefaultIsSOTrx(Map<String, String> requestMap) {
+  public String getDefaultIsSOTrx(Map<String, String> requestMap) {
     return "N";
   }
 
   @Override
-  String getDefaultTransactionType(Map<String, String> requestMap) {
+  public String getDefaultTransactionType(Map<String, String> requestMap) {
     return "O";
   }
 
@@ -74,33 +74,33 @@
   }
 
   @Override
-  String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     return context.getString("inpcOrderId");
   }
 
   @Override
-  String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
     // Business Partner of the current Purchase Order
     JSONObject context = new JSONObject(requestMap.get("context"));
     Order order = getOrder(context);
@@ -108,7 +108,7 @@
   }
 
   @Override
-  String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
     // Standard Precision of the currency
     JSONObject context = new JSONObject(requestMap.get("context"));
     Order order = getOrder(context);
@@ -116,7 +116,7 @@
   }
 
   @Override
-  String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
     // Currency of the current Purchase Order
     JSONObject context = new JSONObject(requestMap.get("context"));
     Order order = getOrder(context);
@@ -124,17 +124,23 @@
   }
 
   @Override
-  String getOrganization(Map<String, String> requestMap) throws JSONException {
+  public String getOrganization(Map<String, String> requestMap) throws JSONException {
     // Organization of the current Purchase Order
     return getOrder(new JSONObject(requestMap.get("context"))).getOrganization().getId();
   }
 
+  @Override
+  public String getDefaultDocument(Map<String, String> requestMap) throws JSONException {
+    // Document Type
+    return "";
+  }
+
   Order getOrder(JSONObject context) throws JSONException {
     return OBDal.getInstance().get(Order.class, context.getString("inpcOrderId"));
   }
 
   @Override
-  String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
     return OBDateUtils.formatDate(new Date());
   }
 
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseOrderAddPaymentDisplayLogics.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseOrderAddPaymentDisplayLogics.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,85 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.advpaymentmngt.filterexpression;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.advpaymentmngt.dao.AdvPaymentMngtDao;
+import org.openbravo.advpaymentmngt.utility.APRMConstants;
+import org.openbravo.client.kernel.ComponentProvider;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.model.common.businesspartner.BusinessPartner;
+import org.openbravo.model.common.enterprise.Organization;
+import org.openbravo.model.common.order.Order;
+
+@ComponentProvider.Qualifier(APRMConstants.PURCHASE_ORDER_WINDOW_ID)
+public class PurchaseOrderAddPaymentDisplayLogics extends AddPaymentDisplayLogicsHandler {
+
+  private static final long SEQUENCE = 100l;
+
+  protected long getSeq() {
+    return SEQUENCE;
+  }
+
+  @Override
+  public boolean getOrganizationDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // Organization
+    return false;
+  }
+
+  @Override
+  public boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // Document Type
+    return false;
+  }
+
+  @Override
+  public boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    JSONObject context = new JSONObject(requestMap.get("context"));
+    Order order = getOrder(context);
+    if (getDefaultGeneratedCredit(requestMap).signum() == 0) {
+      BusinessPartner bpartner = order.getBusinessPartner();
+      if (bpartner != null) {
+        Organization org = order.getOrganization();
+        BigDecimal customerCredit = new AdvPaymentMngtDao().getCustomerCredit(bpartner, false, org);
+        if (customerCredit.signum() > 0) {
+          return true;
+        } else {
+          return false;
+        }
+      } else {
+        return false;
+      }
+    } else {
+      return false;
+    }
+  }
+
+  private Order getOrder(JSONObject context) throws JSONException {
+    return OBDal.getInstance().get(Order.class, context.getString("inpcOrderId"));
+  }
+
+  BigDecimal getDefaultGeneratedCredit(Map<String, String> requestMap) throws JSONException {
+    return BigDecimal.ZERO;
+  }
+
+}
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseOrderAddPaymentReadOnlyLogics.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/PurchaseOrderAddPaymentReadOnlyLogics.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,73 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.advpaymentmngt.filterexpression;
+
+import java.util.Map;
+
+import org.codehaus.jettison.json.JSONException;
+import org.openbravo.advpaymentmngt.utility.APRMConstants;
+import org.openbravo.client.kernel.ComponentProvider;
+
+@ComponentProvider.Qualifier(APRMConstants.PURCHASE_ORDER_WINDOW_ID)
+public class PurchaseOrderAddPaymentReadOnlyLogics extends AddPaymentReadOnlyLogicsHandler {
+
+  private static final long SEQUENCE = 100l;
+
+  protected long getSeq() {
+    return SEQUENCE;
+  }
+
+  @Override
+  public boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
+    return false;
+  }
+
+  @Override
+  public boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
+  @Override
+  public boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return false;
+  }
+
+  @Override
+  public boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
+  @Override
+  public boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return false;
+  }
+
+  @Override
+  public boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
+    return false;
+  }
+
+  @Override
+  public boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
+}
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesInvoiceAddPaymentDefaultValues.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesInvoiceAddPaymentDefaultValues.java	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesInvoiceAddPaymentDefaultValues.java	Thu Sep 11 12:13:21 2014 +0200
@@ -47,7 +47,7 @@
   }
 
   @Override
-  String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
     // Actual amount is the amount on the editing Sales Invoice
     BigDecimal pendingAmt = getPendingAmount(requestMap);
     return pendingAmt.toPlainString();
@@ -60,43 +60,43 @@
   }
 
   @Override
-  String getDefaultIsSOTrx(Map<String, String> requestMap) {
+  public String getDefaultIsSOTrx(Map<String, String> requestMap) {
     return "Y";
   }
 
   @Override
-  String getDefaultTransactionType(Map<String, String> requestMap) {
+  public String getDefaultTransactionType(Map<String, String> requestMap) {
     return "I";
   }
 
   @Override
-  String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     return context.getString("inpcInvoiceId");
   }
 
   @Override
-  String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
     // Business Partner of the current Sales Invoice
     JSONObject context = new JSONObject(requestMap.get("context"));
     Invoice invoice = getInvoice(context);
@@ -104,7 +104,7 @@
   }
 
   @Override
-  String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
     // Standard Precision of the currency
     JSONObject context = new JSONObject(requestMap.get("context"));
     Invoice invoice = getInvoice(context);
@@ -112,7 +112,7 @@
   }
 
   @Override
-  String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
     // Currency of the current Sales Invoice
     JSONObject context = new JSONObject(requestMap.get("context"));
     Invoice invoice = getInvoice(context);
@@ -120,17 +120,23 @@
   }
 
   @Override
-  String getOrganization(Map<String, String> requestMap) throws JSONException {
+  public String getOrganization(Map<String, String> requestMap) throws JSONException {
     // Currency of the current Sales Invoice
     return getInvoice(new JSONObject(requestMap.get("context"))).getOrganization().getId();
   }
 
+  @Override
+  public String getDefaultDocument(Map<String, String> requestMap) throws JSONException {
+    // Document Type
+    return "";
+  }
+
   Invoice getInvoice(JSONObject context) throws JSONException {
     return OBDal.getInstance().get(Invoice.class, context.getString("inpcInvoiceId"));
   }
 
   @Override
-  String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
     return OBDateUtils.formatDate(new Date());
   }
 
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesInvoiceAddPaymentDisplayLogics.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesInvoiceAddPaymentDisplayLogics.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,77 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.advpaymentmngt.filterexpression;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.advpaymentmngt.dao.AdvPaymentMngtDao;
+import org.openbravo.advpaymentmngt.utility.APRMConstants;
+import org.openbravo.client.kernel.ComponentProvider;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.model.common.businesspartner.BusinessPartner;
+import org.openbravo.model.common.enterprise.Organization;
+import org.openbravo.model.common.invoice.Invoice;
+
+@ComponentProvider.Qualifier(APRMConstants.SALES_INVOICE_WINDOW_ID)
+public class SalesInvoiceAddPaymentDisplayLogics extends AddPaymentDisplayLogicsHandler {
+
+  private static final long SEQUENCE = 100l;
+
+  protected long getSeq() {
+    return SEQUENCE;
+  }
+
+  @Override
+  public boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // Document Type
+    return false;
+  }
+
+  @Override
+  public boolean getOrganizationDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // Organization
+    return false;
+  }
+
+  @Override
+  public boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    JSONObject context = new JSONObject(requestMap.get("context"));
+    Invoice invoice = getInvoice(context);
+    BusinessPartner bpartner = invoice.getBusinessPartner();
+    if (bpartner != null) {
+      Organization org = invoice.getOrganization();
+      BigDecimal customerCredit = new AdvPaymentMngtDao().getCustomerCredit(bpartner, true, org);
+      if (customerCredit.signum() > 0) {
+        return true;
+      } else {
+        return false;
+      }
+    } else {
+      return false;
+    }
+  }
+
+  Invoice getInvoice(JSONObject context) throws JSONException {
+    return OBDal.getInstance().get(Invoice.class, context.getString("inpcInvoiceId"));
+  }
+
+}
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesInvoiceAddPaymentReadOnlyLogics.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesInvoiceAddPaymentReadOnlyLogics.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,73 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.advpaymentmngt.filterexpression;
+
+import java.util.Map;
+
+import org.codehaus.jettison.json.JSONException;
+import org.openbravo.advpaymentmngt.utility.APRMConstants;
+import org.openbravo.client.kernel.ComponentProvider;
+
+@ComponentProvider.Qualifier(APRMConstants.SALES_INVOICE_WINDOW_ID)
+public class SalesInvoiceAddPaymentReadOnlyLogics extends AddPaymentReadOnlyLogicsHandler {
+
+  private static final long SEQUENCE = 100l;
+
+  protected long getSeq() {
+    return SEQUENCE;
+  }
+
+  @Override
+  public boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
+    return false;
+  }
+
+  @Override
+  public boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
+  @Override
+  public boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return false;
+  }
+
+  @Override
+  public boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return false;
+  }
+
+  @Override
+  public boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return false;
+  }
+
+  @Override
+  public boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
+    return false;
+  }
+
+  @Override
+  public boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
+}
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesOrderAddPaymentDefaultValues.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesOrderAddPaymentDefaultValues.java	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesOrderAddPaymentDefaultValues.java	Thu Sep 11 12:13:21 2014 +0200
@@ -40,7 +40,7 @@
   }
 
   @Override
-  String getDefaultExpectedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultExpectedAmount(Map<String, String> requestMap) throws JSONException {
     // Expected amount is the amount pending to pay on the Sales Order
     JSONObject context = new JSONObject(requestMap.get("context"));
     String strOrderId = context.getString("inpcOrderId");
@@ -49,7 +49,7 @@
   }
 
   @Override
-  String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultActualAmount(Map<String, String> requestMap) throws JSONException {
     // Actual amount is the amount pending to pay on the Sales Order
     JSONObject context = new JSONObject(requestMap.get("context"));
     String strOrderId = context.getString("inpcOrderId");
@@ -58,12 +58,12 @@
   }
 
   @Override
-  String getDefaultIsSOTrx(Map<String, String> requestMap) {
+  public String getDefaultIsSOTrx(Map<String, String> requestMap) {
     return "Y";
   }
 
   @Override
-  String getDefaultTransactionType(Map<String, String> requestMap) {
+  public String getDefaultTransactionType(Map<String, String> requestMap) {
     return "O";
   }
 
@@ -74,33 +74,33 @@
   }
 
   @Override
-  String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultOrderType(Map<String, String> requestMap) throws JSONException {
     JSONObject context = new JSONObject(requestMap.get("context"));
     return context.getString("inpcOrderId");
   }
 
   @Override
-  String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultInvoiceType(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConversionRate(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultConvertedAmount(Map<String, String> requestMap) throws JSONException {
     return "";
   }
 
   @Override
-  String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultReceivedFrom(Map<String, String> requestMap) throws JSONException {
     // Business Partner of the current Sales Order
     JSONObject context = new JSONObject(requestMap.get("context"));
     Order order = getOrder(context);
@@ -108,7 +108,7 @@
   }
 
   @Override
-  String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultStandardPrecision(Map<String, String> requestMap) throws JSONException {
     // Standard Precision of the currency
     JSONObject context = new JSONObject(requestMap.get("context"));
     Order order = getOrder(context);
@@ -116,7 +116,7 @@
   }
 
   @Override
-  String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultCurrency(Map<String, String> requestMap) throws JSONException {
     // Currency of the current Sales Order
     JSONObject context = new JSONObject(requestMap.get("context"));
     Order order = getOrder(context);
@@ -124,7 +124,7 @@
   }
 
   @Override
-  String getOrganization(Map<String, String> requestMap) throws JSONException {
+  public String getOrganization(Map<String, String> requestMap) throws JSONException {
     // Organization of the current Sales Order
     return getOrder(new JSONObject(requestMap.get("context"))).getOrganization().getId();
   }
@@ -134,8 +134,14 @@
   }
 
   @Override
-  String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
+  public String getDefaultPaymentDate(Map<String, String> requestMap) throws JSONException {
     return OBDateUtils.formatDate(new Date());
   }
 
+  @Override
+  public String getDefaultDocument(Map<String, String> requestMap) throws JSONException {
+    // Document Type
+    return "";
+  }
+
 }
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesOrderAddPaymentDisplayLogics.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesOrderAddPaymentDisplayLogics.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,78 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.advpaymentmngt.filterexpression;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.advpaymentmngt.dao.AdvPaymentMngtDao;
+import org.openbravo.advpaymentmngt.utility.APRMConstants;
+import org.openbravo.client.kernel.ComponentProvider;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.model.common.businesspartner.BusinessPartner;
+import org.openbravo.model.common.enterprise.Organization;
+import org.openbravo.model.common.order.Order;
+
+@ComponentProvider.Qualifier(APRMConstants.SALES_ORDER_WINDOW_ID)
+public class SalesOrderAddPaymentDisplayLogics extends AddPaymentDisplayLogicsHandler {
+
+  private static final long SEQUENCE = 100l;
+
+  protected long getSeq() {
+    return SEQUENCE;
+  }
+
+  @Override
+  public boolean getOrganizationDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // Organization
+    return false;
+  }
+
+  @Override
+  public boolean getDocumentDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // Document Type
+    return false;
+  }
+
+  @Override
+  public boolean getCreditToUseDisplayLogic(Map<String, String> requestMap) throws JSONException {
+    // "@customer_credit@ > 0 & @received_from@!'' & (@issotrx@ == true | @generateCredit@ == 0)";
+    JSONObject context = new JSONObject(requestMap.get("context"));
+    Order order = getOrder(context);
+    BusinessPartner bpartner = order.getBusinessPartner();
+    if (bpartner != null) {
+      Organization org = order.getOrganization();
+      BigDecimal customerCredit = new AdvPaymentMngtDao().getCustomerCredit(bpartner, true, org);
+      if (customerCredit.signum() > 0) {
+        return true;
+      } else {
+        return false;
+      }
+    } else {
+      return false;
+    }
+  }
+
+  private Order getOrder(JSONObject context) throws JSONException {
+    return OBDal.getInstance().get(Order.class, context.getString("inpcOrderId"));
+  }
+
+}
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesOrderAddPaymentReadOnlyLogics.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/filterexpression/SalesOrderAddPaymentReadOnlyLogics.java	Thu Sep 11 12:13:21 2014 +0200
@@ -0,0 +1,74 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2014 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.advpaymentmngt.filterexpression;
+
+import java.util.Map;
+
+import org.codehaus.jettison.json.JSONException;
+import org.openbravo.advpaymentmngt.utility.APRMConstants;
+import org.openbravo.client.kernel.ComponentProvider;
+
+@ComponentProvider.Qualifier(APRMConstants.SALES_ORDER_WINDOW_ID)
+public class SalesOrderAddPaymentReadOnlyLogics extends AddPaymentReadOnlyLogicsHandler {
+
+  private static final long SEQUENCE = 100l;
+
+  protected long getSeq() {
+    return SEQUENCE;
+  }
+
+  @Override
+  public boolean getPaymentDocumentNoReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
+    // Document Type
+    return false;
+  }
+
+  @Override
+  public boolean getReceivedFromReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
+  @Override
+  public boolean getPaymentMethodReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return false;
+  }
+
+  @Override
+  public boolean getActualPaymentReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return false;
+  }
+
+  @Override
+  public boolean getPaymentDateReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return false;
+  }
+
+  @Override
+  public boolean getFinancialAccountReadOnlyLogic(Map<String, String> requestMap)
+      throws JSONException {
+    return false;
+  }
+
+  @Override
+  public boolean getCurrencyReadOnlyLogic(Map<String, String> requestMap) throws JSONException {
+    return true;
+  }
+
+}
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/hqlinjections/AddPaymentOrderInvoicesTransformer.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/hqlinjections/AddPaymentOrderInvoicesTransformer.java	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/hqlinjections/AddPaymentOrderInvoicesTransformer.java	Thu Sep 11 12:13:21 2014 +0200
@@ -31,6 +31,7 @@
 import org.openbravo.base.model.ModelProvider;
 import org.openbravo.base.model.Property;
 import org.openbravo.client.kernel.ComponentProvider;
+import org.openbravo.dal.security.OrganizationStructureProvider;
 import org.openbravo.dal.service.OBDal;
 import org.openbravo.model.ad.datamodel.Column;
 import org.openbravo.model.ad.datamodel.Table;
@@ -103,6 +104,8 @@
         "true".equals(requestParameters.get("issotrx")) ? true : false);
     queryNamedParameters.put("businessPartnerId", requestParameters.get("received_from"));
     queryNamedParameters.put("paymentId", requestParameters.get("fin_payment_id"));
+    queryNamedParameters.put("orgIds",
+        new OrganizationStructureProvider().getChildTree(requestParameters.get("ad_org_id"), true));
     return transformedHql;
   }
 
@@ -162,6 +165,7 @@
       Map<String, String> requestParameters, List<String> selectedPSDs) {
     String strBusinessPartnerId = requestParameters.get("received_from");
     String strFinPaymentId = requestParameters.get("fin_payment_id");
+    String strOrganizationId = requestParameters.get("ad_org_id");
 
     StringBuffer whereClause = new StringBuffer();
     // Create WhereClause
@@ -171,6 +175,9 @@
       whereClause.append(" or (fp.id = :paymentId and (ips is not null or ops is not null)) ");
     }
     whereClause.append(") ");
+    if (strOrganizationId != null) {
+      whereClause.append(" and psd.organization.id in :orgIds ");
+    }
 
     whereClause.append(" and (oinfo is null or oinfo.active = true) ");
     whereClause.append("  and ( ");
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/APRMConstants.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/APRMConstants.java	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/APRMConstants.java	Thu Sep 11 12:13:21 2014 +0200
@@ -25,5 +25,6 @@
   public final static String PURCHASE_INVOICE_WINDOW_ID = "183";
   public final static String PAYMENT_IN_WINDOW_ID = "E547CE89D4C04429B6340FFA44E70716";
   public final static String PAYMENT_OUT_WINDOW_ID = "6F8F913FA60F4CBD93DC1D3AA696E76E";
+  public final static String ADD_PAYMENT_MENU = "NULLWINDOWID";
 
 }
\ No newline at end of file
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js
--- a/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.advpaymentmngt/web/org.openbravo.advpaymentmngt/js/ob-aprm-addPayment.js	Thu Sep 11 12:13:21 2014 +0200
@@ -98,8 +98,12 @@
       creditUseGrid = form.getItem('credit_to_use').canvas.viewGrid,
       overpaymentAction = form.getItem('overpayment_action'),
       payment = form.getItem('fin_payment_id').getValue(),
-      issotrx = form.getItem('issotrx').getValue();
+      issotrx = form.getItem('issotrx').getValue(),
+      trxtype = (form.getItem('trxtype')) ? form.getItem('trxtype').getValue() : "",
+      trxtypeParam = null,
+      orgParam = null;
   OB.APRM.AddPayment.paymentMethodMulticurrency(view, view.theForm, !payment);
+  OB.APRM.AddPayment.reloadLabels(form);
   glitemGrid.fetchData();
   creditUseGrid.fetchData();
   orderInvoiceGrid.selectionChanged = OB.APRM.AddPayment.selectionChanged;
@@ -108,12 +112,20 @@
   creditUseGrid.selectionChanged = OB.APRM.AddPayment.selectionChangedCredit;
   orderInvoiceGrid.dataArrived = OB.APRM.AddPayment.ordInvDataArrived;
 
-  form.isCreditAllowed = form.getItem('received_from').getValue() !== undefined;
+  form.isCreditAllowed = form.getItem('received_from').getValue() !== undefined && form.getItem('received_from').getValue() !== null;
   OB.APRM.AddPayment.checkSingleActionAvailable(form);
   overpaymentAction.originalValueMap = isc.addProperties({}, overpaymentAction.getValueMap());
   if (issotrx) {
     form.focusInItem(form.getItem('actual_payment'));
   }
+  if (trxtype === "") {
+    trxtypeParam = form.getField(0);
+    form.removeField(0);
+    orgParam = form.getField(0);
+    form.removeField(0);
+    form.addField(trxtypeParam);
+    form.addField(orgParam);
+  }
 };
 
 OB.APRM.AddPayment.addNewGLItem = function (grid) {
@@ -130,10 +142,21 @@
       orgId = form.getItem('ad_org_id').getValue();
 
   callback = function (response, data, request) {
-    var isShown = data.isPayIsMulticurrency && currencyId !== data.currencyToId;
+    var isShown = false;
+    if (data.currencyId) {
+      if (!form.getItem('c_currency_id').valueMap) {
+        form.getItem('c_currency_id').valueMap = {};
+      }
+      form.getItem('c_currency_id').setValue(data.currencyId);
+      form.getItem('c_currency_id').valueMap[data.currencyId] = data.currencyIdIdentifier;
+    }
+    isShown = data.isPayIsMulticurrency && currencyId !== data.currencyToId && currencyId !== undefined;
     if (data.isWrongFinancialAccount) {
       form.getItem('fin_financial_account_id').setValue('');
     } else {
+      if (!form.getItem('c_currency_to_id').valueMap) {
+        form.getItem('c_currency_to_id').valueMap = {};
+      }
       form.getItem('c_currency_to_id').setValue(data.currencyToId);
       form.getItem('c_currency_to_id').valueMap[data.currencyToId] = data.currencyToIdentifier;
       if (recalcConvRate && isc.isA.Number(data.conversionrate)) {
@@ -169,13 +192,48 @@
 };
 
 OB.APRM.AddPayment.financialAccountOnChange = function (item, view, form, grid) {
+  var affectedParams = [];
   OB.APRM.AddPayment.paymentMethodMulticurrency(view, form, true);
   OB.APRM.AddPayment.checkSingleActionAvailable(form);
+  affectedParams.push(form.getField('c_currency_id_readonly_logic').paramId);
+  OB.APRM.AddPayment.recalcDisplayLogicOrReadOnlyLogic(form, view, affectedParams);
 };
 
 OB.APRM.AddPayment.paymentMethodOnChange = function (item, view, form, grid) {
+  var ordinvgrid = form.getItem('order_invoice').canvas.viewGrid,
+      defaultFilter = ordinvgrid.filterEditor.getEditForm().getValues(),
+      trxtype = (form.getItem('trxtype')) ? form.getItem('trxtype').getValue() : "",
+      affectedParams = [];
+  isc.addProperties(defaultFilter, {
+    paymentMethodName: item.getElementValue()
+  });
   OB.APRM.AddPayment.paymentMethodMulticurrency(view, form, true);
   OB.APRM.AddPayment.checkSingleActionAvailable(form);
+  if (trxtype !== "") {
+    ordinvgrid.setFilterEditorCriteria(defaultFilter);
+    ordinvgrid.filterByEditor();
+  }
+  affectedParams.push(form.getField('c_currency_id_readonly_logic').paramId);
+  OB.APRM.AddPayment.recalcDisplayLogicOrReadOnlyLogic(form, view, affectedParams);
+};
+
+OB.APRM.AddPayment.currencyOnChange = function (item, view, form, grid) {
+  var trxtype = (form.getItem('trxtype')) ? form.getItem('trxtype').getValue() : "",
+      ordinvgrid = form.getItem('order_invoice').canvas.viewGrid,
+      newCriteria;
+  if (trxtype !== "") {
+    OB.APRM.AddPayment.paymentMethodMulticurrency(view, form, true);
+
+    // fetch data after change trx type, filters should be preserved and ids of
+    // the selected records should be sent
+    newCriteria = ordinvgrid.addSelectedIDsToCriteria(ordinvgrid.getCriteria(), true);
+    newCriteria.criteria = newCriteria.criteria || [];
+    // add dummy criterion to force fetch
+    newCriteria.criteria.push(isc.OBRestDataSource.getDummyCriterion());
+    ordinvgrid.invalidateCache();
+
+    form.redraw();
+  }
 };
 
 OB.APRM.AddPayment.transactionTypeOnChangeFunction = function (item, view, form, grid) {
@@ -204,7 +262,7 @@
   newCriteria.criteria = newCriteria.criteria || [];
   // add dummy criterion to force fetch
   newCriteria.criteria.push(isc.OBRestDataSource.getDummyCriterion());
-  ordinvgrid.fetchData(newCriteria);
+  ordinvgrid.invalidateCache();
 
   form.redraw();
 };
@@ -385,7 +443,9 @@
       receivedFrom = form.getItem('received_from').getValue() || '',
       totalGLItems = new BigDecimal(String(form.getItem('amount_gl_items').getValue() || 0)),
       diffAmt = actualPayment.add(credit).subtract(total),
-      expectedDiffAmt = expectedPayment.add(credit).subtract(total).add(totalGLItems);
+      expectedDiffAmt = expectedPayment.add(credit).subtract(total).add(totalGLItems),
+      affectedParams = [],
+      displayLogicValues = {};
   differenceItem.setValue(Number(diffAmt.toString()));
   if (expectedDiffAmt.signum() === 0) {
     expectedDifferenceItem.setValue(Number(diffAmt.toString()));
@@ -395,6 +455,8 @@
   if (diffAmt.signum() !== 0) {
     OB.APRM.AddPayment.updateDifferenceActions(form);
   }
+  affectedParams.push(form.getField('overpayment_action_display_logic').paramId);
+  OB.APRM.AddPayment.recalcDisplayLogicOrReadOnlyLogic(form, null, affectedParams);
 };
 
 OB.APRM.AddPayment.updateDifferenceActions = function (form) {
@@ -402,7 +464,11 @@
       overpaymentAction = form.getItem('overpayment_action'),
       actualPayment = new BigDecimal(String(form.getItem('actual_payment').getValue() || 0)),
       newValueMap = {},
-      defaultValue = '';
+      defaultValue = '',
+      trxtype = form.getItem('trxtype').getValue();
+  if (trxtype !== "") {
+    form.isCreditAllowed = form.getItem('received_from').getValue() !== undefined && form.getItem('received_from').getValue() !== null;
+  }
   // Update difference action available values.
   if (form.isCreditAllowed) {
     newValueMap.CR = overpaymentAction.originalValueMap.CR;
@@ -730,6 +796,177 @@
   return retVal;
 };
 
+OB.APRM.AddPayment.documentOnChange = function (item, view, form, grid) {
+  var document = (form.getItem('trxtype')) ? form.getItem('trxtype').getValue() : "",
+      issotrx = form.getItem('issotrx'),
+      affectedParams = [],
+      ordinvgrid = form.getItem('order_invoice').canvas.viewGrid,
+      organization = form.getItem('ad_org_id'),
+      newCriteria, callback;
+  if (document === 'RCIN') {
+    issotrx.setValue(true);
+  } else {
+    issotrx.setValue(false);
+  }
+
+  form.getItem('fin_paymentmethod_id').setValue(null);
+  form.getItem('received_from').setValue(null);
+  if (!form.paramWindow.parentWindow) {
+    form.getItem('fin_financial_account_id').setValue(null);
+  }
+  OB.APRM.AddPayment.reloadLabels(form);
+  affectedParams.push(form.getField('credit_to_use_display_logic').paramId);
+  affectedParams.push(form.getField('actual_payment_readonly_logic').paramId);
+  OB.APRM.AddPayment.recalcDisplayLogicOrReadOnlyLogic(form, view, affectedParams);
+
+  if (document !== "") {
+    // fetch data after change trx type, filters should be preserved and ids of
+    // the selected records should be sent
+    newCriteria = ordinvgrid.addSelectedIDsToCriteria(ordinvgrid.getCriteria(), true);
+    newCriteria.criteria = newCriteria.criteria || [];
+    // add dummy criterion to force fetch
+    newCriteria.criteria.push(isc.OBRestDataSource.getDummyCriterion());
+    ordinvgrid.invalidateCache();
+    form.redraw();
+  }
+
+  callback = function (response, data, request) {
+    form.getItem('payment_documentno').setValue(data.payment_documentno);
+  };
+
+  if (document !== "") {
+    OB.RemoteCallManager.call('org.openbravo.advpaymentmngt.actionHandler.AddPaymentDocumentNoActionHandler', {
+      organization: organization.getValue(),
+      issotrx: issotrx.getValue()
+    }, {}, callback);
+  }
+};
+
+OB.APRM.AddPayment.organizationOnChange = function (item, view, form, grid) {
+	  var ordinvgrid = form.getItem('order_invoice').canvas.viewGrid,
+	  organization = (form.getItem('ad_org_id')) ? form.getItem('ad_org_id').getValue() : "",
+		      newCriteria, callback;
+	  form.getItem('fin_paymentmethod_id').setValue(null);
+	  form.getItem('received_from').setValue(null);
+    form.getItem('fin_financial_account_id').setValue(null);
+	  callback = function (response, data, request) {
+		    form.getItem('c_currency_id').setValue(data.currency);
+		    form.getItem('c_currency_id').valueMap[data.currency] = data.currencyIdIdentifier;
+		      // fetch data after change organization, filters should be preserved and ids of
+		      // the selected records should be sent
+			  newCriteria = ordinvgrid.addSelectedIDsToCriteria(ordinvgrid.getCriteria(), true);
+			  newCriteria.criteria = newCriteria.criteria || [];
+			  // add dummy criterion to force fetch
+			  newCriteria.criteria.push(isc.OBRestDataSource.getDummyCriterion());
+			  ordinvgrid.invalidateCache();
+			  form.redraw();
+    };
+
+		  if (organization !== "") {
+		    OB.RemoteCallManager.call('org.openbravo.advpaymentmngt.actionHandler.AddPaymentOrganizationActionHandler', {
+		      organization: organization
+		    }, {}, callback);
+		  }
+	};
+
+OB.APRM.AddPayment.receivedFromOnChange = function (item, view, form, grid) {
+  var affectedParams = [],
+      trxtype = (form.getItem('trxtype')) ? form.getItem('trxtype').getValue() : "",
+      callback, receivedFrom = form.getItem('received_from').getValue(),
+      isSOTrx = form.getItem('issotrx').getValue(),
+      financialAccount = form.getItem('fin_financial_account_id').getValue(),
+      ordinvgrid = form.getItem('order_invoice').canvas.viewGrid,
+      newCriteria = {};
+  affectedParams.push(form.getField('credit_to_use_display_logic').paramId);
+  OB.APRM.AddPayment.recalcDisplayLogicOrReadOnlyLogic(form, view, affectedParams);
+
+  callback = function (response, data, request) {
+    if (data.paymentMethodId !== '') {
+      form.getItem('fin_paymentmethod_id').setValue(data.paymentMethodId);
+    }
+  };
+
+  if (trxtype !== "") {
+    OB.RemoteCallManager.call('org.openbravo.advpaymentmngt.actionHandler.ReceivedFromPaymentMethodActionHandler', {
+      receivedFrom: receivedFrom,
+      isSOTrx: isSOTrx,
+      financialAccount: financialAccount
+    }, {}, callback);
+    newCriteria = ordinvgrid.addSelectedIDsToCriteria(ordinvgrid.getCriteria(), true);
+    newCriteria.criteria = newCriteria.criteria || [];
+    // add dummy criterion to force fetch
+    newCriteria.criteria.push(isc.OBRestDataSource.getDummyCriterion());
+    ordinvgrid.invalidateCache();
+
+    form.redraw();
+  }
+};
+
+OB.APRM.AddPayment.recalcDisplayLogicOrReadOnlyLogic = function (form, view, affectedParams) {
+  var callbackDisplayLogicActionHandler, params = {},
+      thisform, thisview, creditUseGrid = form.getItem('credit_to_use').canvas.viewGrid;
+  thisform = form;
+  thisview = view;
+  params.context = form.paramWindow.getContextInfo();
+  if (form.paramWindow.parentWindow && form.paramWindow.parentWindow.windowId) {
+    params.context.inpwindowId = form.paramWindow.parentWindow.windowId;
+  }
+
+  callbackDisplayLogicActionHandler = function (response, data, request) {
+    var i, field, def, values = data.values,
+        newCriteria = {};
+
+    for (i in values) {
+      if (values.hasOwnProperty(i)) {
+        def = values[i];
+        field = thisform.getItem(i);
+        if (field) {
+          if (isc.isA.Object(def)) {
+            if (def.identifier && def.value) {
+              field.valueMap = field.valueMap || {};
+              field.valueMap[def.value] = def.identifier;
+              field.setValue(def.value);
+            }
+          } else {
+            field.setValue(thisform.paramWindow.getTypeSafeValue(field.typeInstance, def));
+          }
+        }
+      }
+    }
+    if (thisview) {
+      thisview.handleReadOnlyLogic();
+    }
+    // If credit grid is now displayed fetch data
+    if (values.credit_to_use_display_logic && values.credit_to_use_display_logic === 'Y') {
+      newCriteria.criteria = [];
+      // add dummy criterion to force fetch
+      newCriteria.criteria.push(isc.OBRestDataSource.getDummyCriterion());
+      creditUseGrid.fetchData(newCriteria);
+    }
+    thisform.markForRedraw();
+  };
+
+  OB.RemoteCallManager.call('org.openbravo.advpaymentmngt.actionHandler.AddPaymentDisplayLogicActionHandler', {
+    affectedParams: affectedParams,
+    params: params
+  }, {}, callbackDisplayLogicActionHandler);
+};
+
+OB.APRM.AddPayment.reloadLabels = function (form) {
+  var callbackReloadLabelsActionHandler, params = {};
+  params.businessPartner = form.getItem('received_from').paramId;
+  params.financialAccount = form.getItem('fin_financial_account_id').paramId;
+  params.issotrx = form.getItem('issotrx').getValue();
+
+  callbackReloadLabelsActionHandler = function (response, data, request) {
+    form.getItem('received_from').title = data.values.businessPartner;
+    form.getItem('fin_financial_account_id').title = data.values.financialAccount;
+    form.markForRedraw();
+  };
+
+  OB.RemoteCallManager.call('org.openbravo.advpaymentmngt.actionHandler.AddPaymentReloadLabelsActionHandler', {}, params, callbackReloadLabelsActionHandler);
+};
+
 OB.APRM.AddPayment.onProcess = function (view, actionHandlerCall) {
   var orderInvoiceGrid = view.theForm.getItem('order_invoice').canvas.viewGrid,
       receivedFrom = view.theForm.getItem('received_from').getValue(),
@@ -740,6 +977,7 @@
       actualPayment = new BigDecimal(String(view.theForm.getItem('actual_payment').getValue() || 0)),
       overpaymentAction = view.theForm.getItem('overpayment_action').getValue(),
       creditTotalItem = new BigDecimal(String(view.theForm.getItem('used_credit').getValue() || 0)),
+      document = (view.theForm.getItem('trxtype')) ? view.theForm.getItem('trxtype').getValue() : "",
       amountField = orderInvoiceGrid.getFieldByColumnName('amount'),
       selectedRecords = orderInvoiceGrid.getSelectedRecords(),
       writeOffLimitPreference = OB.PropertyStore.get('WriteOffLimitPreference', view.windowId),
@@ -780,6 +1018,11 @@
     return false;
   }
 
+  if (document !== null && document !== '' && actualPayment.compareTo(BigDecimal.prototype.ZERO) === 0) {
+    view.messageBar.setMessage(isc.OBMessageBar.TYPE_ERROR, null, OB.I18N.getLabel('APRM_ZEROAMOUNTPAYMENTTRANSACTION'));
+    return false;
+  }
+
   callbackOnProcessActionHandler = function (response, data, request) {
     //Check if there are blocked Business Partners
     if (data.message.severity === 'error') {
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-form.js
--- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-form.js	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-parameter-window-form.js	Thu Sep 11 12:13:21 2014 +0200
@@ -67,5 +67,6 @@
       this.redraw();
     }
     this.paramWindow.okButton.setEnabled(this.paramWindow.allRequiredParametersSet());
+    item._hasChanged = false;
   }
 });
\ No newline at end of file
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/HQLDataSourceService.java
--- a/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/HQLDataSourceService.java	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.service.datasource/src/org/openbravo/service/datasource/HQLDataSourceService.java	Thu Sep 11 12:13:21 2014 +0200
@@ -296,7 +296,12 @@
       // Injection and transforms might have modified the query removing named parameters. Check
       // that key is still in the query.
       if (hqlQuery.contains(key)) {
-        query.setParameter(key, queryNamedParameters.get(key));
+        Object parameter = queryNamedParameters.get(key);
+        if (parameter instanceof Set<?>) {
+          query.setParameterList(key, (Set<String>) parameter);
+        } else {
+          query.setParameter(key, parameter);
+        }
       }
     }
 
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java
--- a/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.service.json/src/org/openbravo/service/json/AdvancedQueryBuilder.java	Thu Sep 11 12:13:21 2014 +0200
@@ -1128,6 +1128,11 @@
         }
       }
 
+      // not found, try to get the parameter directly from the request object
+      if (paramValue.equals("") && RequestContext.get().getRequestParameter(param) != null) {
+        paramValue = RequestContext.get().getRequestParameter(param);
+      }
+
       // If paramValue has not been brought form the request, select it from context
       if (paramValue.equals("")) {
         paramValue = Utility.getContext(new DalConnectionProvider(false), RequestContext.get()
@@ -1136,11 +1141,6 @@
                 .getRequestParameter("windowId") : "");
       }
 
-      // not found, try to get the parameter directly from the request object
-      if (paramValue.equals("") && RequestContext.get().getRequestParameter(param) != null) {
-        paramValue = RequestContext.get().getRequestParameter(param);
-      }
-
       localWhereClause = prefix + getTypedParameterAlias() + suffix;
       typedParameters.add(paramValue);
     }
diff -r d7d2abe0f424 -r f12e5b66c79e modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js
--- a/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Mon Aug 04 07:44:51 2014 +0000
+++ b/modules/org.openbravo.userinterface.selector/web/org.openbravo.userinterface.selector/js/ob-selector-item.js	Thu Sep 11 12:13:21 2014 +0200
@@ -928,6 +928,12 @@
       isc.addProperties(params, selector.view.sourceView.getContextInfo(false, true, null, selector.isComboReference));
     } else if (selector.grid && selector.grid.contentView && selector.grid.contentView.getContextInfo) {
       isc.addProperties(params, selector.grid.contentView.getContextInfo(false, true, null, selector.isComboReference));
+    } else if (selector.form && selector.form.paramWindow && selector.form.paramWindow.getContextInfo) {
+      isc.addProperties(params, selector.form.paramWindow.getContextInfo());
+      if (!params.inpadOrgId) {
+        // look for an ad_org_id parameter. If there is no such parameter or its value is empty, use the current user organization
+        params.inpadOrgId = params.ad_org_id || OB.User.organizationId;
+      }
     }
 
     if (selector.form && selector.form.view && selector.form.view.standardWindow) {
@@ -1157,4 +1163,4 @@
     }
     this.Super('destroy', arguments);
   }
-});
+});
\ No newline at end of file
