Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix analysis categories are not sorted by sort key #2619

Merged
merged 3 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog
2.6.0 (unreleased)
------------------

- #2619 Fix analysis categories are not sorted by sort key
- #2618 Fix UnicodeDecodeError when user linked to a contact with special chars
- #2615 Add control for select/deselect all attachments when send report
- #2614 Fix autofill for simple fields when create Sample in the add form
Expand Down
2 changes: 1 addition & 1 deletion src/senaite/core/catalog/indexer/analysiscategory.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
# Copyright 2018-2024 by it's authors.
# Some rights reserved, see README and LICENSE.

from bika.lims.interfaces import IAnalysisCategory
from plone.indexer import indexer
from Products.CMFPlone.utils import safe_callable
from senaite.core.catalog.utils import sortable_sortkey_title
from senaite.core.interfaces import IAnalysisCategory


@indexer(IAnalysisCategory)
Expand Down
2 changes: 1 addition & 1 deletion src/senaite/core/profiles/default/metadata.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<metadata>
<version>2650</version>
<version>2651</version>
<dependencies>
<dependency>profile-Products.ATContentTypes:base</dependency>
<dependency>profile-Products.CMFEditions:CMFEditions</dependency>
Expand Down
10 changes: 10 additions & 0 deletions src/senaite/core/upgrade/v02_06_000.py
Original file line number Diff line number Diff line change
Expand Up @@ -2480,3 +2480,13 @@ def fix_corrupted_transitions(tool):
wapi.update_transition(transition, after_script="")

logger.info("Fixing corrupted transitions [DONE]")


def reindex_analysis_categories(tool):
logger.info("Reindexing analysis categories ...")
cat = api.get_tool(SETUP_CATALOG)
for brain in cat(portal_type="AnalysisCategory"):
obj = brain.getObject()
logger.info("Reindex analysis category: %r" % obj)
obj.reindexObject(idxs=["sortable_title"], update_metadata=False)
logger.info("Reindexing analysis categories [DONE]")
8 changes: 8 additions & 0 deletions src/senaite/core/upgrade/v02_06_000.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
i18n_domain="senaite.core">

<genericsetup:upgradeStep
title="SENAITE.CORE 2.6.0: Fix categories not sorted by sort key"
description="Reindex sortable_title for all analysis categories"
source="2650"
destination="2651"
handler=".v02_06_000.reindex_analysis_categories"
profile="senaite.core:default"/>

<genericsetup:upgradeStep
title="SENAITE.CORE 2.6.0: Fix corrupted transitions"
description="Restores the value of the property `after_script_name` from
Expand Down
Loading