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

Empty worksheet remove malfunction #2622

Open
toropok opened this issue Sep 23, 2024 · 1 comment
Open

Empty worksheet remove malfunction #2622

toropok opened this issue Sep 23, 2024 · 1 comment

Comments

@toropok
Copy link
Contributor

toropok commented Sep 23, 2024

Description

If a user deletes an empty worksheet instance, the instance itself is removed after the “Transition: Remove Worksheet” call. However, it is not uncataloged properly. The index is removed from the uid_catalog, but it remains in the senaite_catalog_worksheet.

The worksheet listing form displays this defective entry, but it leads to an error when the user clicks on it.

image

There are no errors or warnings anywhere. We also found that this issue occurred sometime after the 2618 upgrade step, but we have been unable to determine what changed.

@ramonski @xispa Let me know if you’d like any further adjustments! would appreciate any hints to check

@xispa
Copy link
Member

xispa commented Sep 23, 2024

Indeed the problem seems to be that the worksheet is not uncatalogued from senaite_catalog_worksheet before being removed. So, the worksheet is still displayed in the listing (cause the query rely on brains), but return the error on click because the worksheet does no longer exists.

The deletion of the worksheet happens here, after the remove event:
https://github.com/senaite/senaite.core/blob/2.x/src/bika/lims/workflow/worksheet/events.py#L40

Note this function relies on api.delete, that in turn, calls the uncatalog_object function, that should properly unindex the worksheet from all existing catalogs as per https://github.com/senaite/senaite.core/blob/2.x/src/bika/lims/api/__init__.py#L394

I suggest to place a pdb there and see why obj.unindexObject does not work as expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants