--- /opt/OpenbravoERP-3.0/Openbravo-3.0MP29.1/src-db/database/sourcedata/AD_COLUMN.xml
+++ /opt/OpenbravoERP-3.0/flopec/src-db/database/sourcedata/AD_COLUMN.xml
@@ -220488,7 +220488,8 @@
-
+
+
@@ -275515,7 +275516,7 @@
-
+
@@ -275551,7 +275552,7 @@
-
+
@@ -281177,7 +281178,8 @@
-
+
+
--- /opt/OpenbravoERP-3.0/Openbravo-3.0MP29.1/src-db/database/sourcedata/AD_REFERENCE.xml
+++ /opt/OpenbravoERP-3.0/flopec/src-db/database/sourcedata/AD_REFERENCE.xml
@@ -4947,6 +4947,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
--- /opt/OpenbravoERP-3.0/Openbravo-3.0MP29.1/src-db/database/sourcedata/AD_REF_TABLE.xml
+++ /opt/OpenbravoERP-3.0/flopec/src-db/database/sourcedata/AD_REF_TABLE.xml
@@ -1206,6 +1206,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
--- /opt/OpenbravoERP-3.0/Openbravo-3.0MP29.1/src/org/openbravo/erpCommon/ad_callouts/SE_PaymentMethod_FinAccount.java
+++ /opt/OpenbravoERP-3.0/flopec/src/org/openbravo/erpCommon/ad_callouts/SE_PaymentMethod_FinAccount.java
@@ -36,77 +36,47 @@
@Override
protected void execute(CalloutInfo info) throws ServletException {
- String srtPaymentMethodId = info.getStringParameter("inpfinPaymentmethodId",
- IsIDFilter.instance);
- String srtPOPaymentMethodId = info.getStringParameter("inppoPaymentmethodId",
- IsIDFilter.instance);
-
String tabId = info.getTabId();
boolean isVendorTab = "224".equals(tabId);
String finIsReceipt = info.getStringParameter("inpisreceipt", null);
boolean isPaymentOut = isVendorTab || "N".equals(finIsReceipt);
- String srtOrgId = info.getStringParameter("inpadOrgId", IsIDFilter.instance);
+ String strOrgId = info.getStringParameter("inpadOrgId", IsIDFilter.instance);
+
+ String strSelectedPaymentMethod = info.getStringParameter(isVendorTab ? "inppoPaymentmethodId"
+ : "inpfinPaymentmethodId", IsIDFilter.instance);
FIN_PaymentMethod paymentMethod = OBDal.getInstance().get(FIN_PaymentMethod.class,
- isVendorTab ? srtPOPaymentMethodId : srtPaymentMethodId);
+ strSelectedPaymentMethod);
- info.addSelect(isVendorTab ? "inppoFinancialAccountId" : "inpfinFinancialAccountId");
- String srtSelectedFinancialAccount = info.getStringParameter(
+ String strSelectedFinancialAccount = info.getStringParameter(
isVendorTab ? "inppoFinancialAccountId" : "inpfinFinancialAccountId", IsIDFilter.instance);
- boolean isSelected = true;
+ FIN_FinancialAccount financialAccount = OBDal.getInstance().get(FIN_FinancialAccount.class,
+ strSelectedFinancialAccount);
+
boolean isMultiCurrencyEnabled = false;
- // No Payment Method selected
- if (srtPaymentMethodId.isEmpty() && srtPOPaymentMethodId.isEmpty()) {
- OBCriteria obc = OBDal.getInstance().createCriteria(
- FIN_FinancialAccount.class);
- obc.add(Restrictions.in("organization.id", OBContext.getOBContext()
- .getOrganizationStructureProvider().getNaturalTree(srtOrgId)));
- obc.setFilterOnReadableOrganization(false);
- for (FIN_FinancialAccount acc : obc.list()) {
- info.addSelectResult(acc.getId(), acc.getIdentifier());
- }
-
- } else {
+ if (paymentMethod != null && financialAccount != null) {
OBCriteria obc = OBDal.getInstance().createCriteria(
FinAccPaymentMethod.class);
+ // (paymentmethod, financial_account) is unique
obc.add(Restrictions.eq(FinAccPaymentMethod.PROPERTY_PAYMENTMETHOD, paymentMethod));
+ obc.add(Restrictions.eq(FinAccPaymentMethod.PROPERTY_ACCOUNT, financialAccount));
obc.add(Restrictions.in("organization.id", OBContext.getOBContext()
- .getOrganizationStructureProvider().getNaturalTree(srtOrgId)));
- if (isPaymentOut) {
- obc.add(Restrictions.eq(FinAccPaymentMethod.PROPERTY_PAYOUTALLOW, true));
- } else {
- obc.add(Restrictions.eq(FinAccPaymentMethod.PROPERTY_PAYINALLOW, true));
- }
+ .getOrganizationStructureProvider().getNaturalTree(strOrgId)));
- FinAccPaymentMethod selectedPaymentMethod = null;
- for (FinAccPaymentMethod accPm : obc.list()) {
- if (accPm.getAccount().isActive()) {
- if (srtSelectedFinancialAccount.equals(accPm.getAccount().getId())) {
- isSelected = true;
- } else if (srtSelectedFinancialAccount.isEmpty()) {
- srtSelectedFinancialAccount = accPm.getAccount().getIdentifier();
- isSelected = true;
- }
- selectedPaymentMethod = accPm;
+ if (obc.count() > 0) {
+ FinAccPaymentMethod selectedAccPaymentMethod = obc.list().get(0);
- info.addSelectResult(accPm.getAccount().getId(), accPm.getAccount().getIdentifier(),
- isSelected);
- }
- isSelected = false;
- }
- if (selectedPaymentMethod != null) {
if (isPaymentOut) {
- isMultiCurrencyEnabled = selectedPaymentMethod.isPayoutAllow()
- && selectedPaymentMethod.isPayoutIsMulticurrency();
+ isMultiCurrencyEnabled = selectedAccPaymentMethod.isPayoutAllow()
+ && selectedAccPaymentMethod.isPayoutIsMulticurrency();
} else {
- isMultiCurrencyEnabled = selectedPaymentMethod.isPayinAllow()
- && selectedPaymentMethod.isPayinIsMulticurrency();
+ isMultiCurrencyEnabled = selectedAccPaymentMethod.isPayinAllow()
+ && selectedAccPaymentMethod.isPayinIsMulticurrency();
}
}
}
- info.endSelect();
info.addResult("inpismulticurrencyenabled", isMultiCurrencyEnabled ? "Y" : "N");
}
}