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

Worksheet removal results in 404 #1480

Merged
merged 1 commit into from
Nov 27, 2019
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 @@ -18,6 +18,7 @@ Changelog

**Fixed**

- #1480 Worksheet removal results in 404
- #1475 User with "Analyst" role cannot submit analyses from worksheet
- #1474 Adding Control Reference to Worksheet causes print fail
- #1473 Hidden settings of analysis services lost on Sample creation
Expand Down
12 changes: 0 additions & 12 deletions bika/lims/profiles/default/cmfformcontroller.xml

This file was deleted.

21 changes: 21 additions & 0 deletions bika/lims/setuphandlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ def setup_handler(context):
# Run after all catalogs have been setup
setup_auditlog_catalog(portal)

# Set CMF Form actions
setup_form_controller_actions(portal)

logger.info("SENAITE setup handler [DONE]")


Expand Down Expand Up @@ -533,3 +536,21 @@ def setup_auditlog_catalog(portal):
at.setCatalogsByType(portal_type, new_catalogs)
logger.info("*** Adding catalog '{}' for '{}'".format(
catalog_id, portal_type))


def setup_form_controller_actions(portal):
"""Setup custom CMF Form actions
"""
logger.info("*** Setup Form Controller custom actions ***")
fc_tool = api.get_tool("portal_form_controller")

# Redirect the user to Worksheets listing view after the "remove" action
# from inside Worksheet context is pressed
# https://github.com/senaite/senaite.core/pull/1480
fc_tool.addFormAction(
object_id="content_status_modify",
status="success",
context_type="Worksheet",
button=None,
action_type="redirect_to",
action_arg="python:object.aq_inner.aq_parent.absolute_url()")
5 changes: 5 additions & 0 deletions bika/lims/upgrade/v01_03_003.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

from bika.lims import logger
from bika.lims.config import PROJECTNAME as product
from bika.lims.setuphandlers import setup_form_controller_actions
from bika.lims.upgrade import upgradestep
from bika.lims.upgrade.utils import UpgradeUtils

Expand All @@ -46,5 +47,9 @@ def upgrade(tool):
# https://github.com/senaite/senaite.core/pull/1469
setup.runImportStepFromProfile(profile, "propertiestool")

# Redirect to worksheets folder when a Worksheet is removed
# https://github.com/senaite/senaite.core/pull/1480
setup_form_controller_actions(portal)

logger.info("{0} upgraded to version {1}".format(product, version))
return True