details: https://code.openbravo.com/erp/devel/main/rev/aa2e59b0267e changeset: 24991:aa2e59b0267e user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Fri Oct 03 13:12:58 2014 +0200 summary: Related with issue 27730: Adds missing js formatting
details: https://code.openbravo.com/erp/devel/main/rev/6da0a9d9dfd1 changeset: 24992:6da0a9d9dfd1 user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Fri Oct 03 13:46:05 2014 +0200 summary: Fixes issue 27730: Pressing enter in the last editable grid line creates record The fix [1] of this issue [2] added a check to prevent creating a new line when, in an editable grid, a value was selected from a picklist by pressing the Enter key. The fix consisted in overwriting the ha ndleKeyPress function of TextItem. The problem was that because of the way the fix was implemented, the new function was invoked but the original implementation of TextItem.handleKeyPress was never execute d. This missing code was causing a strange behaviour in how the EventHandler set the items that are object of the events, and as a result of this the current issue was being reproducible. To fix this, the issue [2] has been implemented differently. The root cause of that issue is that the keyDown event was done in a formitem (the selector) and the keyPress on another item (in this case the description column). When this was detected, the call the handleKeyPress was intercepted to prevent adding a new line. Now, the interception is done in the cellEditEnd. This has two benefits: - handleKeyPress is not overwritten, so the problems caused by the missing TextItem.handleKeyPress invocation disappear - the interception is done in a more specific point. handleKeyPress is called constantly, but the cellEditEnd is only called when the focus leaves a grid cell. [1] https://code.openbravo.com/erp/devel/pi/rev/b4ba48792e4850c804c42001d8f818f1e0575f81 [2] https://issues.openbravo.com/view.php?id=26817 details: https://code.openbravo.com/erp/devel/main/rev/5d44e36e74e2 changeset: 24993:5d44e36e74e2 user: Atul Gaware <atul.gaware <at> openbravo.com> date: Tue Oct 07 11:58:37 2014 +0530 summary: Fixes Issue 27735:Stock Reservation cannot be manually done if there exist pending purchase orders for that product query created was for orderline but code seems to be incorrect so removed wrong part which was trying to cast the result to Storage Detail details: https://code.openbravo.com/erp/devel/main/rev/f2e14fc5df5c changeset: 24994:f2e14fc5df5c user: Atul Gaware <atul.gaware <at> openbravo.com> date: Tue Oct 14 15:12:25 2014 +0530 summary: Fixes Issue 27752:Cannot ship more than the ordered quantity when Is Quantity Variable checkbox is selected for the product While processing shipment Line wise exceed check for delivered qty against ordered qty for each order line is skipped when product flag for variable quantity is set as Yes details: https://code.openbravo.com/erp/devel/main/rev/5e0f3f0dd0de changeset: 24995:5e0f3f0dd0de user: Eduardo Argal Guibert <eduardo.argal <at> openbravo.com> date: Fri Oct 03 17:48:54 2014 +0200 summary: Fixes issue 27764: Match LC Costs pick and execute is not working Some Variables were not loaded from context and the query was wring. It was as well not using namedParameters so that was reviewd as well details: https://code.openbravo.com/erp/devel/main/rev/ebaf54e6075b changeset: 24996:ebaf54e6075b user: Eduardo Argal Guibert <eduardo.argal <at> openbravo.com> date: Fri Oct 03 17:29:54 2014 +0200 summary: Fixes issue 27763: Match LC Costs always displays false It was confusing to the user. Query was hardcoded to always get false value for the column details: https://code.openbravo.com/erp/devel/main/rev/dd9845c4c805 changeset: 24997:dd9845c4c805 user: Eduardo Argal Guibert <eduardo.argal <at> openbravo.com> date: Fri Oct 03 16:26:24 2014 +0200 summary: Fixes bug 27745: Add Payment fails using Oracle versions: 11.1 y 10 Adds missing parenthesis in declaration of function which was root cause of wrong query parsing details: https://code.openbravo.com/erp/devel/main/rev/570f20689eb9 changeset: 24998:570f20689eb9 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Fri Oct 03 07:51:10 2014 +0200 summary: fixed bug 27743: ant target run.api.test.javascript is broken JavaScriptAntTest ant task was moved to src-test but the ant task in build.xml invoking it was not. Build.xml files have been changed to reflect new location. details: https://code.openbravo.com/erp/devel/main/rev/d468bfa902c9 changeset: 24999:d468bfa902c9 user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Tue Oct 07 13:16:06 2014 +0200 summary: Fixes issue 27769: Record id not shown in the filter when a new field is added When a foreign key field is being filtered using its id (i.e. by selecting a record from its drop down), its filterType property is set to 'id'. This property is then used in several places like in the getCriterion and getCriterion. The problem was that when adding/removing a field from the grid, the filter fields are rebuilt from scratch and the filterType property was being reset to its default value ('identifier'). To fix this, the list of foreign key fields being filtered by their id is stored before resetting the filter fields, and consulted when initializing the foreign key fields. Also the foreign key cache needs to be persisted in order to be able to obtain the record's identifier given its id (in the criteria only the id is stored). The getFKFilterAuxiliaryCache function has been moved from OBViewGrid to OBGrid so that it can also be used in Pick&Execute grids. This has no risk, as it did not use any code specific from OBViewGrid. details: https://code.openbravo.com/erp/devel/main/rev/9521a7aaae36 changeset: 25000:9521a7aaae36 user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Tue Oct 07 16:04:45 2014 +0200 summary: Fixes issue 27769: Record id not shown when opening link from URL In the OBGrid.setFields function, the originally named fkCache was meant to store the information needed to restore the state of the foreign key columns after resetting the fields. The scope of that auxiliary cache was setField function, that is why it is deleted from the object before leaving the function. The problem was that 'fkCache' was already being used to name another property. This property stores the id-identifier pairings of the criterias saved in direct links. As that property was being removed when the grid fields were set, if a tab was opened using a direct link the criterias on the foreign key columns showed their ids. This problem has been fixed by renaming the temporal property used in the setFields function. details: https://code.openbravo.com/erp/devel/main/rev/200a82a9ff52 changeset: 25001:200a82a9ff52 user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Wed Oct 08 12:10:58 2014 +0200 summary: Related to bug 27788: Fk filters work in StockReservationPickAndEditDataSource The StockReservationPickAndEditDataSource manual datasource did not support filtering the foreign key columns using their ids. This type of criteria is built when the user filters a foreign key by selecting a value from the filter drop down. Now, for each foreign key column, the manual datasource is able to filter them by their id and by their identifier. details: https://code.openbravo.com/erp/devel/main/rev/fb4be5ef60b3 changeset: 25002:fb4be5ef60b3 user: Inigo Sanchez <inigo.sanchez <at> openbravo.com> date: Thu Oct 09 13:53:32 2014 +0200 summary: Related to bug 27788: Fk filters not work in manual datasource. The ReturnFromCustomerPickEditLineDatasource manual datasource did not support filtering the foreign key columns using their ids. This type of criteria is built when the user filters a foreign key by selecting a value from the filter drop down. Now, for each foreign key column, ReturnFromCustomerPickEditLineDatasource manual datasource is able to filter them by their id and by their identifier. Other manual datasources like ManageVariantsDS and ReturnToVendorPickAndEditDataSource it have been reviewed and they support filtering the foreign key columns using their ids. details: https://code.openbravo.com/erp/devel/main/rev/89b59e6d389b changeset: 25003:89b59e6d389b user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Thu Oct 09 18:47:37 2014 +0200 summary: Related with issue 27788: Adds new field to obserds_datasource table The new field is a flag that controls how the foreign keys are filtered in the tables that uses a manual datasource to fetch its data. If the flag is checked, then if a foreign key field of that table is filtered by selecting a record from the filter drop down, the foreign key will be filtered using its id. That is, the criteria will be like this: {fieldName: foreign-key-name, operator: 'equals', value: record-id} If this flag is unchecked, then the criteria used will be like this: {fieldName: foreign-key-name$_identifier operator: 'iContains', value: 'identifier'} details: https://code.openbravo.com/erp/devel/main/rev/d06465772e2b changeset: 25004:d06465772e2b user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Thu Oct 09 18:49:16 2014 +0200 summary: Related with issue 27788: Updates OBSERDS_DATASOURCE source data with new value details: https://code.openbravo.com/erp/devel/main/rev/695cbd91c1a5 changeset: 25005:695cbd91c1a5 user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Fri Oct 10 11:33:59 2014 +0200 summary: Fixes issue 27788: Manual datasources can dissallow filtering by id If the Support Filtering foreign keys by their id field of a manual datasource is checked, then in their grids the foreign key columns will always be filtered using their identifier instead of their id. details: https://code.openbravo.com/erp/devel/main/rev/a758f27be591 changeset: 25006:a758f27be591 user: Augusto Mauch <augusto.mauch <at> openbravo.com> date: Fri Oct 10 11:45:06 2014 +0200 summary: Related with issue 27788: Updates the printed name of the new field details: https://code.openbravo.com/erp/devel/main/rev/1954be7c2026 changeset: 25007:1954be7c2026 user: Atul Gaware <atul.gaware <at> openbravo.com> date: Thu Oct 09 12:46:52 2014 +0530 summary: Fixes Issue 27797:Create from shipment window does not let you to click in OK if you have tried before to click it without filling mandatory field Problem: disable double click on Ok and Cancel button was done before validation. details: https://code.openbravo.com/erp/devel/main/rev/b4bbe171e1ff changeset: 25008:b4bbe171e1ff user: Sandra Huguet <sandra.huguet <at> openbravo.com> date: Thu Oct 16 17:06:50 2014 +0200 summary: [costAdj] code review update licence in some files, add descriptions, fixed initial dataset, fixed backdated functionality in closed periods, delete commented code, disable costing junit test, fixed process price difference adjustment process definition details: https://code.openbravo.com/erp/devel/main/rev/ba74b72ef3a7 changeset: 25009:ba74b72ef3a7 user: Asier Lostalé <asier.lostale <at> openbravo.com> date: Tue Oct 14 15:35:37 2014 +0200 summary: fixed 27860: "Go to previous/next record" with autosave set new state When previous/next record button is used on a non saved record and autosave is executed. The loaded record is set with new UI. The problem was the way used to determine after save if current record is new or not: it checked if ID changed, which is correct in case of triggering autosave with new button but not if it is triggered with next/back. Using now for.isNewRecord to determine the same. details: https://code.openbravo.com/erp/devel/main/rev/151c3896655d changeset: 25010:151c3896655d user: Víctor Martínez Romanos <victor.martinez <at> openbravo.com> date: Wed Oct 15 13:40:56 2014 +0200 summary: Fixed bug 27872: NPE when reactivating payment for BPartner without currency When reactivating the payment, the FIN_PaymentProcess was getting the business partner currency's ID where, in some strange circunstances, it may not be defined yet. Moreover, getting the BP currency ID at this point is not needed at all, so these lines have been removed. Finally, in another part of the code, we have done a trivial refactor to use Currency objects instead of Strings to have a better control over NPE. diffstat: modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java | 15 +- modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/APRMApplicationInitializer.java | 4 +- modules/org.openbravo.client.application/src-db/database/sourcedata/OBSERDS_DATASOURCE.xml | 4 + modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-pick-and-execute-grid.js.ftl | 5 +- modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-grid.js.ftl | 3 + modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewGridComponent.java | 8 + modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js | 15 +- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js | 16 +- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js | 65 ++ modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-view-grid.js | 46 +- modules/org.openbravo.client.application/web/org.openbravo.client.application/js/process/ob-pick-and-execute-grid.js | 1 + modules/org.openbravo.client.querylist/src-db/database/sourcedata/OBSERDS_DATASOURCE.xml | 1 + modules/org.openbravo.service.datasource/src-db/database/model/tables/OBSERDS_DATASOURCE.xml | 5 + modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_COLUMN.xml | 36 + modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_ELEMENT.xml | 14 + modules/org.openbravo.service.datasource/src-db/database/sourcedata/AD_FIELD.xml | 29 + modules/org.openbravo.service.datasource/src-db/database/sourcedata/OBSERDS_DATASOURCE.xml | 1 + modules/org.openbravo.userinterface.selector/src-db/database/sourcedata/OBSERDS_DATASOURCE.xml | 3 + modules/org.openbravo.userinterface.smartclient/web/org.openbravo.userinterface.smartclient/js/ob-smartclient.js | 17 +- referencedata/sampledata/F_B_International_Group/AD_PROCESS_ACCESS.xml | 140 ----- referencedata/sampledata/QA_Testing/AD_PROCESS_ACCESS.xml | 42 - referencedata/standard/Initial_Setup.xml | 137 +++-- src-db/database/model/functions/M_INOUT_POST.xml | 24 +- src-db/database/model/tables/M_COSTING_RULE.xml | 4 + src-db/database/model/triggers/M_INTERNAL_CONSUMPTIONLINE_TRG.xml | 2 +- src-db/database/sourcedata/AD_AUXILIARINPUT.xml | 11 + src-db/database/sourcedata/AD_COLUMN.xml | 64 ++- src-db/database/sourcedata/AD_DATASET.xml | 2 +- src-db/database/sourcedata/AD_ELEMENT.xml | 29 + src-db/database/sourcedata/AD_FIELD.xml | 59 ++ src-db/database/sourcedata/AD_MENU.xml | 6 +- src-db/database/sourcedata/AD_MESSAGE.xml | 24 + src-db/database/sourcedata/AD_MODEL_OBJECT.xml | 12 - src-db/database/sourcedata/AD_PROCESS.xml | 21 - src-db/database/sourcedata/AD_TAB.xml | 9 + src-db/database/sourcedata/AD_TABLE.xml | 2 +- src-db/database/sourcedata/AD_WINDOW.xml | 13 +- src-db/database/sourcedata/OBSERDS_DATASOURCE.xml | 7 + src-db/database/sourcedata/OBUIAPP_PARAMETER.xml | 26 + src-db/database/sourcedata/OBUIAPP_PROCESS.xml | 30 + src-test/build.xml | 6 + src-test/src/org/openbravo/test/AllAntTaskTests.java | 7 +- src-util/modulescript/src/org/openbravo/modulescript/CreateCostAdjustmentAcctConf.java | 6 +- src-util/modulescript/src/org/openbravo/modulescript/CreateCostAdjustmentAcctConf_data.xsql | 22 +- src-util/modulescript/src/org/openbravo/modulescript/CreateLandedCostAcctConf.java | 6 +- src-util/modulescript/src/org/openbravo/modulescript/CreateLandedCostAcctConf_data.xsql | 22 +- src-util/modulescript/src/org/openbravo/modulescript/InitializeMTransCostDateacct.java | 2 +- src-util/modulescript/src/org/openbravo/modulescript/InitializeMTransCostDateacct_data.xsql | 2 +- src-util/modulescript/src/org/openbravo/modulescript/UpdateCostingRuleDateTo.java | 2 +- src-util/modulescript/src/org/openbravo/modulescript/UpdateCostingRuleDateTo_data.xsql | 2 +- src/org/openbravo/common/datasource/ReturnFromCustomerPickEditLineDatasource.java | 7 + src/org/openbravo/common/datasource/StockReservationPickAndEditDataSource.java | 169 +++--- src/org/openbravo/common/inserters/LCMatchFromInvoiceInserter.java | 31 +- src/org/openbravo/costing/AverageAlgorithm.java | 6 +- src/org/openbravo/costing/AverageCostAdjustment.java | 120 ++-- src/org/openbravo/costing/CancelCostAdjustment.java | 10 +- src/org/openbravo/costing/CostAdjustmentProcess.java | 9 - src/org/openbravo/costing/CostAdjustmentUtils.java | 246 +++++---- src/org/openbravo/costing/CostingAlgorithmAdjustmentImp.java | 18 +- src/org/openbravo/costing/CostingBackground.java | 3 - src/org/openbravo/costing/CostingMigrationProcess.java | 6 - src/org/openbravo/costing/CostingRuleProcess.java | 8 - src/org/openbravo/costing/CostingServer.java | 4 - src/org/openbravo/costing/CostingStatus.java | 2 - src/org/openbravo/costing/CostingUtils.java | 2 +- src/org/openbravo/costing/FixBackdatedTransactionsProcess.java | 183 ++++--- src/org/openbravo/costing/InventoryAmountUpdateProcess.java | 12 +- src/org/openbravo/costing/LCCostMatchFromInvoiceHandler.java | 4 +- src/org/openbravo/costing/LCMatchingProcess.java | 1 - src/org/openbravo/costing/LandedCostDistributionAlgorithm.java | 2 +- src/org/openbravo/costing/LandedCostDistributionByAmount.java | 2 - src/org/openbravo/costing/LandedCostProcess.java | 2 - src/org/openbravo/costing/PriceDifferenceByDateProcess.java | 29 +- src/org/openbravo/costing/ReactivateLandedCost.java | 5 +- src/org/openbravo/costing/StandardCostAdjustment.java | 21 +- src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_Shipment.html | 4 +- src/org/openbravo/erpCommon/ad_actionButton/CreateFrom_ShipmentPO.html | 4 +- src/org/openbravo/erpCommon/ad_callouts/SL_InvAmtUpd_AmtUnitCost.java | 2 +- src/org/openbravo/erpCommon/ad_callouts/SL_InvAmtUpd_ProductRefDate.java | 6 +- src/org/openbravo/erpCommon/ad_callouts/SL_LandedCost_InvoiceLine.java | 2 +- src/org/openbravo/erpCommon/ad_forms/DocCostAdjustment.java | 69 +- src/org/openbravo/erpCommon/ad_forms/DocCostAdjustmentTemplate.java | 13 +- src/org/openbravo/erpCommon/ad_forms/DocCostAdjustment_data.xsql | 12 +- src/org/openbravo/erpCommon/ad_forms/DocInternalConsumption.java | 9 +- src/org/openbravo/erpCommon/ad_forms/DocInternalConsumptionTemplate.java | 7 + src/org/openbravo/erpCommon/ad_forms/DocInternalConsumption_data.xsql | 30 +- src/org/openbravo/erpCommon/ad_forms/DocLCCost.java | 10 +- src/org/openbravo/erpCommon/ad_forms/DocLandedCost.java | 11 +- src/org/openbravo/erpCommon/ad_forms/DocLineInternalConsumption_data.xsql | 30 +- src/org/openbravo/erpCommon/ad_forms/DocLine_CostAdjustment.java | 3 +- src/org/openbravo/erpCommon/ad_forms/DocLine_LCCost.java | 6 +- src/org/openbravo/erpCommon/ad_forms/DocLine_LandedCost.java | 6 +- src/org/openbravo/erpCommon/utility/DimensionDisplayUtility.java | 1 + 93 files changed, 1236 insertions(+), 920 deletions(-) diffs (truncated from 4726 to 300 lines): diff -r 753d307e0769 -r 151c3896655d modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java --- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java Mon Oct 06 09:44:38 2014 +0200 +++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java Wed Oct 15 13:40:56 2014 +0200 @@ -768,12 +768,9 @@ try { BusinessPartner businessPartner = payment.getBusinessPartner(); BigDecimal paidAmount = BigDecimal.ZERO; - String fromCurrency = payment.getCurrency().getId(); - String toCurrency = ""; if (!(businessPartner == null)) { // When credit is used (consumed) we compensate so_creditused as this amount is already // included in the payment details. Credit consumed should not affect to so_creditused - toCurrency = businessPartner.getCurrency().getId(); if (payment.getGeneratedCredit().compareTo(BigDecimal.ZERO) == 0 && payment.getUsedCredit().compareTo(BigDecimal.ZERO) != 0) { if (isReceipt) { @@ -842,11 +839,13 @@ .getInvoicePaymentSchedule() != null ? paymentScheduleDetail .getInvoicePaymentSchedule().getInvoice() : null; paidAmount = BigDecimal.ZERO; - fromCurrency = payment.getCurrency().getId(); - toCurrency = ""; if (!(businessPartner == null)) { - toCurrency = businessPartner.getCurrency().getId(); - if (!fromCurrency.equals(toCurrency)) { + final Currency fromCurrency = payment.getCurrency(); + // At this point the BP must have a currency, because it is set when + // processing the payment associated to the invoice + final Currency toCurrency = businessPartner.getCurrency(); + if (fromCurrency != null && toCurrency != null + && !fromCurrency.getId().equals(toCurrency.getId())) { BigDecimal exchangeRate = BigDecimal.ZERO; // check at invoice document level List<ConversionRateDoc> conversionRateDocumentForInvoice = getConversionRateDocumentForInvoice( @@ -856,7 +855,7 @@ } else { // global exchangeRate = getConversionRate(payment.getOrganization().getId(), - fromCurrency, toCurrency, + fromCurrency.getId(), toCurrency.getId(), invoiceForConversion != null ? invoiceForConversion.getInvoiceDate() : payment.getPaymentDate()); } diff -r 753d307e0769 -r 151c3896655d modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/APRMApplicationInitializer.java --- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/APRMApplicationInitializer.java Mon Oct 06 09:44:38 2014 +0200 +++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/APRMApplicationInitializer.java Wed Oct 15 13:40:56 2014 +0200 @@ -50,9 +50,9 @@ if (is11R2orNewer()) { return "listagg(to_char(?1), ',') WITHIN GROUP (ORDER BY ?1)"; } else if (existsStrAgg()) { - return "stragg(to_char(?1)"; + return "stragg(to_char(?1))"; } else { - return "wm_concat(to_char(?1)"; + return "wm_concat(to_char(?1))"; } } else { return "array_to_string(array_agg(?1), ',')"; diff -r 753d307e0769 -r 151c3896655d modules/org.openbravo.client.application/src-db/database/sourcedata/OBSERDS_DATASOURCE.xml --- a/modules/org.openbravo.client.application/src-db/database/sourcedata/OBSERDS_DATASOURCE.xml Mon Oct 06 09:44:38 2014 +0200 +++ b/modules/org.openbravo.client.application/src-db/database/sourcedata/OBSERDS_DATASOURCE.xml Wed Oct 15 13:40:56 2014 +0200 @@ -10,6 +10,7 @@ <!--090A37D22E61FE94012E621729090048--> <OBCLKER_TEMPLATE_ID><![CDATA[2BAD445C2A0343C58E455F9BD379C690]]></OBCLKER_TEMPLATE_ID> <!--090A37D22E61FE94012E621729090048--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--090A37D22E61FE94012E621729090048--> <USEASTABLEDATAORIGIN><![CDATA[N]]></USEASTABLEDATAORIGIN> +<!--090A37D22E61FE94012E621729090048--> <IDFKFILTERING><![CDATA[Y]]></IDFKFILTERING> <!--090A37D22E61FE94012E621729090048--></OBSERDS_DATASOURCE> <!--3C1148C0AB604DE1B51B7EA4112C325F--><OBSERDS_DATASOURCE> @@ -23,6 +24,7 @@ <!--3C1148C0AB604DE1B51B7EA4112C325F--> <OBCLKER_TEMPLATE_ID><![CDATA[2BAD445C2A0343C58E455F9BD379C690]]></OBCLKER_TEMPLATE_ID> <!--3C1148C0AB604DE1B51B7EA4112C325F--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--3C1148C0AB604DE1B51B7EA4112C325F--> <USEASTABLEDATAORIGIN><![CDATA[Y]]></USEASTABLEDATAORIGIN> +<!--3C1148C0AB604DE1B51B7EA4112C325F--> <IDFKFILTERING><![CDATA[Y]]></IDFKFILTERING> <!--3C1148C0AB604DE1B51B7EA4112C325F--></OBSERDS_DATASOURCE> <!--99B9CC42FDEA4CA7A4EE35BC49D61E0E--><OBSERDS_DATASOURCE> @@ -36,6 +38,7 @@ <!--99B9CC42FDEA4CA7A4EE35BC49D61E0E--> <OBCLKER_TEMPLATE_ID><![CDATA[2BAD445C2A0343C58E455F9BD379C690]]></OBCLKER_TEMPLATE_ID> <!--99B9CC42FDEA4CA7A4EE35BC49D61E0E--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--99B9CC42FDEA4CA7A4EE35BC49D61E0E--> <USEASTABLEDATAORIGIN><![CDATA[N]]></USEASTABLEDATAORIGIN> +<!--99B9CC42FDEA4CA7A4EE35BC49D61E0E--> <IDFKFILTERING><![CDATA[Y]]></IDFKFILTERING> <!--99B9CC42FDEA4CA7A4EE35BC49D61E0E--></OBSERDS_DATASOURCE> <!--C17951F970E942FD9F3771B7BE91D049--><OBSERDS_DATASOURCE> @@ -49,6 +52,7 @@ <!--C17951F970E942FD9F3771B7BE91D049--> <OBCLKER_TEMPLATE_ID><![CDATA[2BAD445C2A0343C58E455F9BD379C690]]></OBCLKER_TEMPLATE_ID> <!--C17951F970E942FD9F3771B7BE91D049--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> <!--C17951F970E942FD9F3771B7BE91D049--> <USEASTABLEDATAORIGIN><![CDATA[N]]></USEASTABLEDATAORIGIN> +<!--C17951F970E942FD9F3771B7BE91D049--> <IDFKFILTERING><![CDATA[Y]]></IDFKFILTERING> <!--C17951F970E942FD9F3771B7BE91D049--></OBSERDS_DATASOURCE> </data> diff -r 753d307e0769 -r 151c3896655d modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-pick-and-execute-grid.js.ftl --- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-pick-and-execute-grid.js.ftl Mon Oct 06 09:44:38 2014 +0200 +++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-pick-and-execute-grid.js.ftl Wed Oct 15 13:40:56 2014 +0200 @@ -47,7 +47,10 @@ </#if> <#if data.lazyFiltering> lazyFiltering: ${data.lazyFiltering?string}, - </#if> + </#if> + <#if data.alwaysFilterFksByIdentifier> + alwaysFilterFksByIdentifier: ${data.alwaysFilterFksByIdentifier?string}, + </#if> dummy: true </@compress> } \ No newline at end of file diff -r 753d307e0769 -r 151c3896655d modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-grid.js.ftl --- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-grid.js.ftl Mon Oct 06 09:44:38 2014 +0200 +++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/templates/ob-view-grid.js.ftl Wed Oct 15 13:40:56 2014 +0200 @@ -41,6 +41,9 @@ <#if data.lazyFiltering> lazyFiltering: ${data.lazyFiltering?string}, </#if> + <#if data.alwaysFilterFksByIdentifier> + alwaysFilterFksByIdentifier: ${data.alwaysFilterFksByIdentifier?string}, + </#if> //List of properties that must be always included in this grid requiredGridProperties: [ <#list data.requiredGridProperties as property> diff -r 753d307e0769 -r 151c3896655d modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewGridComponent.java --- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewGridComponent.java Mon Oct 06 09:44:38 2014 +0200 +++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/window/OBViewGridComponent.java Wed Oct 15 13:40:56 2014 +0200 @@ -46,6 +46,7 @@ import org.openbravo.model.ad.ui.Tab; import org.openbravo.model.common.order.Order; import org.openbravo.model.common.order.OrderLine; +import org.openbravo.service.datasource.DataSource; import org.openbravo.service.db.DalConnectionProvider; import org.openbravo.service.json.JsonConstants; @@ -435,4 +436,11 @@ return false; } } + + public boolean getAlwaysFilterFksByIdentifier() { + DataSource dataSource = tab.getTable().getObserdsDatasource(); + // always filter using the identifier if the grid fetches its data from a manual datasource and + // if that datasource does not support filtering foreign keys using their ids + return (dataSource != null && !dataSource.isSupportIdFkFiltering()); + } } diff -r 753d307e0769 -r 151c3896655d modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js Mon Oct 06 09:44:38 2014 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/formitem/ob-formitem-fk-filter.js Wed Oct 15 13:40:56 2014 +0200 @@ -67,6 +67,15 @@ this.displayField = this.criteriaDisplayField || OB.Constants.IDENTIFIER; this.valueField = this.criteriaDisplayField || OB.Constants.IDENTIFIER; + // if this field was being filtered by its id before being recreated, reset its filter type an its filterAuxCache + if (this.grid && this.grid.sourceWidget && this.grid.sourceWidget.filterByIdFields && this.grid.sourceWidget.filterByIdFields.contains(this.name)) { + this.filterType = 'id'; + if (this.grid.sourceWidget.fkCacheCopy && this.grid.sourceWidget.fkCacheCopy.find('fieldName', this.name)) { + this.filterAuxCache = this.grid.sourceWidget.fkCacheCopy.find('fieldName', this.name).cache; + } + + } + this.pickListProperties = { // make sure that we send the same parameters as the grid @@ -158,7 +167,7 @@ this.multipleValueSeparator = ' or '; // if the filter by identifier has been disabled using grid configuration, set the filter type to 'id' - if (this.allowFkFilterByIdentifier === false) { + if (this.allowFkFilterByIdentifier === false && !grid.alwaysFilterFksByIdentifier) { this.filterType = 'id'; } }, @@ -385,7 +394,7 @@ crit = this.replaceCriterionOperator(crit, value, this.operator); } - if (this.allowFkFilterByIdentifier === false) { + if (this.allowFkFilterByIdentifier === false && !this.grid.view.alwaysFilterFksByIdentifier) { this.filterType = 'id'; } @@ -545,7 +554,7 @@ }, handleChanged: function (value) { - if (this._pickingValue || this.allowFkFilterByIdentifier === false) { + if (!this.grid.sourceWidget.alwaysFilterFksByIdentifier && (this._pickingValue || this.allowFkFilterByIdentifier === false)) { // if the filter text has changed because a value has been ficked from the filter drop down, use the id filter // do this also if the only filter type allowed is 'id' this.filterType = 'id'; diff -r 753d307e0769 -r 151c3896655d modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js Mon Oct 06 09:44:38 2014 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/form/ob-view-form.js Wed Oct 15 13:40:56 2014 +0200 @@ -1560,7 +1560,7 @@ callback = function (resp, data, req) { var index1, index2, view = form.view, localRecord, status = resp.status, - sessionProperties, keepSelection, gridRefreshCallback, theGrid, theId, id = form.getValue('id'); + sessionProperties, keepSelection, gridRefreshCallback, theGrid, theId, id; if (this.hasOwnProperty('previousExplicitOffline')) { isc.Offline.explicitOffline = this.previousExplicitOffline; @@ -1569,6 +1569,7 @@ // if no recordIndex then select explicitly if (recordIndex === -1) { + id = form.getValue('id'); record = view.viewGrid.data.find('id', id); if (record !== null) { recordIndex = view.viewGrid.data.indexOf(record); @@ -1657,15 +1658,10 @@ // remove any edit info in the grid view.viewGrid.discardEdits(recordIndex, null, false, isc.ListGrid.PROGRAMMATIC, true); - // Check if Id has changed - if (id === form.getValue('id')) { - // Change some labels, set isNew as false - form.setNewState(false); - } else { - // New record, set isNew as true - form.setNewState(true); - } - + // Change some labels: + // * set isNew as false if we continue editing same record or we move to an existent one + // * set isNew to true if autosaving record to start editing a new one + form.setNewState(form.isNewRecord()); view.refreshParentRecord(); diff -r 753d307e0769 -r 151c3896655d modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js --- a/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js Mon Oct 06 09:44:38 2014 +0200 +++ b/modules/org.openbravo.client.application/web/org.openbravo.client.application/js/grid/ob-grid.js Wed Oct 15 13:40:56 2014 +0200 @@ -833,6 +833,71 @@ this.checkShowFilterFunnelIcon(criteria); }, + // overwrites setFields to store the list of fk columns filtered using its id + // this info is then used when the filter field is recreated + setFields: function (newFields) { + this.filterByIdFields = this.getFilterByIdFields(); + if (this.filterByIdFields.length > 0) { + this.fkCacheCopy = this.getFKFilterAuxiliaryCache(this.getCriteria()); + } + this.Super('setFields', arguments); + delete this.fkCacheCopy; + delete this.filterByIdFields; + }, + + // returns the list of fk fields that are currently being filtered using their id + getFilterByIdFields: function () { + var fields, i, filterByIdFields = []; + if (this.filterEditor && this.filterEditor.getEditForm()) { + fields = this.filterEditor.getEditForm().getFields(); + for (i = 0; i < fields.length; i++) { + if (fields[i].filterType === 'id') { + filterByIdFields.push(fields[i].name); + } + } + } + return filterByIdFields; + }, + + // returns an object containing the foreign key filter cache of all the filter fields whose current filter type is 'id' + getFKFilterAuxiliaryCache: function (criteria) { + var filterField, criterion, filterLength = criteria.criteria.length, + fkFilterAuxCache = [], + innerCache = [], + filterEditForm, cacheElement, i; + if (!this.filterEditor || !this.filterEditor.getEditForm()) { + return fkFilterAuxCache; + } + filterEditForm = this.filterEditor.getEditForm(); + for (i = 0; i < filterLength; i++) { + criterion = criteria.criteria[i]; + filterField = filterEditForm.getField(criterion.fieldName); + innerCache = []; + if (filterField && filterField.filterType === 'id') { + if (criterion.criteria) { + for (i = 0; i < criterion.criteria.length; i++) { + cacheElement = {}; + cacheElement.fieldName = criterion.criteria[i].fieldName; + cacheElement[OB.Constants.ID] = criterion.criteria[i].value; + cacheElement[OB.Constants.IDENTIFIER] = filterField.getRecordIdentifierFromId(criterion.criteria[i].value); + innerCache.add(cacheElement); + } + } else { + cacheElement = {}; + cacheElement.fieldName = criterion.fieldName; + cacheElement[OB.Constants.ID] = criterion.value; + cacheElement[OB.Constants.IDENTIFIER] = filterField.getRecordIdentifierFromId(criterion.value); + innerCache.add(cacheElement); + } + fkFilterAuxCache.add({ + fieldName: criterion.fieldName, + cache: innerCache + }); + } + } ------------------------------------------------------------------------------ Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://p.sf.net/sfu/Zoho _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
