Stop including empty items in dialog multilistfields
The meaning of empty items for **multi** list fields for categories is not clear for dialogs (if user does not want to apply any filter, then the natural way would be to select nothing). This also caused issues with category fields, when the action script uses restrictedTraverse to get the uids corresponding to the category but a path is empty, like for example in https://lab.nexedi.com/nexedi/erp5/blob/d51bb0413a806b3db0c5eb69dec06065b9601322/bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountModule_getTrialBalanceReportSectionList.py#L40-48 which does this: ```python # optional GAP filter node_uid = [] gap_uid_list = [] for gap in request.get('gap_list', ()): gap_uid_list.append(portal.portal_categories.gap.restrictedTraverse(gap).getUid()) if gap_uid_list: node_uid = [x.uid for x in portal.portal_catalog( portal_type='Account', default_gap_uid=gap_uid_list)] or -1 ``` If an empty item is selected, then `gap_uid_list` will contain an entry for `portal.portal_categories.gap.restrictedTraverse('').getUid()` which will be the uid of the gap base category. Searching with a base category uid nowadays does not match any document, but before 95e3eaec (CMFCategory: Do not index any Base Category as a related document., 2016-12-21), it was matching all documents having a relation from this base category and in the case of this trial balance report it was matching all accounts. This was a problem for old instances with accounts created before 95e3eaec, because when they were first indexed, they had the record in category table, so they were matched, but once they get re-indexed, they no longer had the record, so the result of this report when selecting the empty item became different, because accounts were no longer included. Looking back at this, maybe when updating to get 95e3eaec, we should have ran a migration to delete all these records (re-indexing every document in the background should be enough) so that if there's a problem, the problem happens right now and not after a few months after accounts are modified and re-indexed. When looking at this from end user level, theses empty items not only cause this problem, but also does not have a clear behaviour and are not needed, so the changes here are about removing these empty items. In accounting reports, there was a multi listfield showing all gap categories, "grouped" by chart of account - but the name of the chart of account was not displayed. This change to use a None item, which is rendered as disabled to display the chart of account name, but to do this we had to fix a bug in Formulator, these disabled items were only working properly for single item widgets, not multiple items widgets. See merge request !1572
Status | Job ID | Name | Coverage | ||||||
---|---|---|---|---|---|---|---|---|---|
External | |||||||||
passed |
#343281
external
|
ERP5.CodingStyleTest-Master |
00:44:39
|
||||||
passed |
#343280
external
|
ERP5.PerformanceTest-Master |
00:26:06
|
||||||
passed |
#343343
external
|
ERP5.UnitTest-Master |
01:22:22
|
||||||
failed |
#343284
external
|
ERP5.UnitTest-Master.Medusa |
01:15:13
|
||||||
passed |
#343483
external
|
SlapOS.Eggs.UnitTest-Master.Python2 |
00:22:45
|
||||||
passed |
#343495
external
|
SlapOS.Eggs.UnitTest-Master.Python3 |
01:26:16
|
||||||
passed |
#343285
external
retried
|
ERP5.UnitTest-Master |
01:08:05
|
||||||
passed |
#343252
external
retried
|
SlapOS.Eggs.UnitTest-Master.Python2 |
00:12:07
|
||||||
passed |
#343314
external
retried
|
SlapOS.Eggs.UnitTest-Master.Python2 |
00:12:04
|
||||||
passed |
#343372
external
retried
|
SlapOS.Eggs.UnitTest-Master.Python2 |
00:22:36
|
||||||
passed |
#343412
external
retried
|
SlapOS.Eggs.UnitTest-Master.Python2 |
00:14:44
|
||||||
passed |
#343455
external
retried
|
SlapOS.Eggs.UnitTest-Master.Python2 |
00:11:57
|
||||||
passed |
#343443
external
retried
|
SlapOS.Eggs.UnitTest-Master.Python3 |
00:12:57
|
||||||
passed |
#343268
external
retried
|
SlapOS.Eggs.UnitTest-Master.Python3 |
00:22:10
|
||||||
passed |
#343400
external
retried
|
SlapOS.Eggs.UnitTest-Master.Python3 |
00:13:22
|
||||||
passed |
#343327
external
retried
|
SlapOS.Eggs.UnitTest-Master.Python3 |
00:27:26
|
||||||
passed |
#343350
external
retried
|
SlapOS.Eggs.UnitTest-Master.Python3 |
00:23:22
|
||||||