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

Migrate Calculations to DX #2600

Open
wants to merge 54 commits into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
effe2a1
init
toropok Jul 18, 2024
00ceabe
init
toropok Jul 24, 2024
cda3d59
init
toropok Jul 29, 2024
00061c9
init
toropok Jul 29, 2024
2148b7a
init
toropok Jul 30, 2024
e423958
merge 2.x
toropok Aug 7, 2024
6de4010
update
toropok Aug 22, 2024
86232b4
Merge branch '2.x' into dx-calculations
toropok Aug 22, 2024
2ce29e6
update
toropok Aug 23, 2024
c24865c
linter warnings removed
toropok Aug 25, 2024
6b77280
Merge branch '2.x' into dx-calculations
toropok Aug 25, 2024
d4751cb
linter warnings
toropok Aug 25, 2024
18a0608
import fix
toropok Aug 25, 2024
47da0e4
updat
toropok Aug 26, 2024
53d2bc6
Merge branch '2.x' into dx-calculations
toropok Sep 9, 2024
1463ee1
fix
toropok Sep 9, 2024
35fe180
fix
toropok Sep 9, 2024
dc0b4ff
fix
toropok Sep 9, 2024
f51e57f
fix
toropok Sep 11, 2024
37cd4dc
Merge branch '2.x' into dx-calculations
toropok Sep 11, 2024
362cff4
fix
toropok Sep 11, 2024
a9aa8bc
fix
toropok Sep 16, 2024
e184710
merge 2.x
toropok Sep 27, 2024
44a5289
merge 2.x
toropok Sep 27, 2024
391c65a
fix
toropok Nov 6, 2024
f1362f3
merge 2.x
toropok Nov 6, 2024
c9b6c6b
Merge branch '2.x' into dx-calculations
toropok Nov 6, 2024
f280bd1
fix
toropok Nov 7, 2024
2f797ab
build css
toropok Nov 7, 2024
33c4888
update
toropok Nov 14, 2024
2eaf871
update
toropok Nov 15, 2024
00e4aa7
Merge branch '2.x' into dx-calculations
toropok Nov 15, 2024
e42326c
linter fixes
toropok Nov 15, 2024
eabade8
tests fix
toropok Nov 15, 2024
f0b961e
upgrade fix
toropok Nov 17, 2024
2cdecf6
test & fixes
toropok Nov 18, 2024
ec4216b
Merge branch '2.x' into dx-calculations
toropok Nov 21, 2024
9efd90d
Merge branch '2.x' into dx-calculations
toropok Nov 27, 2024
44f8570
merge 2.x
toropok Nov 27, 2024
f84bbcf
merge 2.x
toropok Nov 27, 2024
495f753
fix
toropok Dec 1, 2024
3a8d3a7
Merge branch '2.x' into dx-calculations
toropok Dec 1, 2024
447fe9e
linter
toropok Dec 1, 2024
86bc11c
fix
toropok Dec 1, 2024
04d5e91
fix
toropok Dec 2, 2024
c99bb6f
Merge branch '2.x' into dx-calculations
toropok Dec 23, 2024
30794ee
fix of generating proper dendendent services uids on migration
toropok Dec 23, 2024
f8c9d32
fix deactivation guard
toropok Dec 23, 2024
29d682f
move js to webpack
toropok Dec 26, 2024
bb2fc1a
migration iinterims fix & naming issue
toropok Dec 28, 2024
443e698
fixes
toropok Dec 29, 2024
1661d97
fix minor adapter revision
toropok Jan 4, 2025
4f2cdf4
fix dotted params substitution
toropok Jan 6, 2025
9ec3267
Merge branch '2.x' into dx-calculations
toropok Jan 6, 2025
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
4 changes: 2 additions & 2 deletions src/bika/lims/browser/analysisrequest/add2.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
from bika.lims import api
from bika.lims import bikaMessageFactory as _
from bika.lims import logger
from bika.lims.api.analysisservice import get_calculation_dependencies_for
from bika.lims.api.analysisservice import get_service_dependencies_for
from bika.lims.api.security import check_permission
from bika.lims.decorators import returns_json
from bika.lims.interfaces import IAddSampleConfirmation
Expand All @@ -52,6 +50,8 @@
from Products.Five.browser import BrowserView
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from senaite.core.api import dtime
from senaite.core.api.analysisservice import get_calculation_dependencies_for
from senaite.core.api.analysisservice import get_service_dependencies_for
from senaite.core.catalog import CONTACT_CATALOG
from senaite.core.catalog import SETUP_CATALOG
from senaite.core.p3compat import cmp
Expand Down
94 changes: 0 additions & 94 deletions src/bika/lims/controlpanel/bika_calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,8 @@
# Copyright 2018-2024 by it's authors.
# Some rights reserved, see README and LICENSE.

import collections

from bika.lims import api
from bika.lims import bikaMessageFactory as _
from bika.lims.browser.bika_listing import BikaListingView
from bika.lims.config import PROJECTNAME
from bika.lims.interfaces import ICalculations
from senaite.core.permissions import AddCalculation
from bika.lims.utils import get_link
from plone.app.folder.folder import ATFolder
from plone.app.folder.folder import ATFolderSchema
from Products.Archetypes import atapi
Expand All @@ -35,93 +28,6 @@
from zope.interface.declarations import implements


# TODO: Separate content and view into own modules!


class CalculationsView(BikaListingView):

def __init__(self, context, request):
super(CalculationsView, self).__init__(context, request)

self.catalog = "senaite_catalog_setup"
self.contentFilter = {
"portal_type": "Calculation",
"sort_on": "sortable_title",
"sort_order": "ascending",
}

self.context_actions = {
_("Add"): {
"url": "createObject?type_name=Calculation",
"permission": AddCalculation,
"icon": "++resource++bika.lims.images/add.png"}
}

self.title = self.context.translate(_("Calculations"))
self.icon = "{}/{}".format(
self.portal_url,
"/++resource++bika.lims.images/calculation_big.png"
)

self.show_select_row = False
self.show_select_column = True
self.pagesize = 25

self.columns = collections.OrderedDict((
("Title", {
"title": _("Calculation"),
"index": "sortable_title"}),
("Description", {
"title": _("Description"),
"index": "Description",
"toggle": True}),
("Formula", {
"title": _("Formula"),
"index": "getFormula",
"toggle": True}),
))

self.review_states = [
{
"id": "default",
"title": _("Active"),
"contentFilter": {"is_active": True},
"transitions": [{"id": "deactivate"}, ],
"columns": self.columns.keys(),
}, {
"id": "inactive",
"title": _("Inactive"),
"contentFilter": {'is_active': False},
"transitions": [{"id": "activate"}, ],
"columns": self.columns.keys(),
}, {
"id": "all",
"title": _("All"),
"contentFilter": {},
"columns": self.columns.keys(),
}
]

def folderitem(self, obj, item, index):
"""Service triggered each time an item is iterated in folderitems.
The use of this service prevents the extra-loops in child objects.
:obj: the instance of the class to be foldered
:item: dict containing the properties of the object to be used by
the template
:index: current index of the item
"""
obj = api.get_object(obj)
title = obj.Title()
description = obj.Description()
url = obj.absolute_url()

item["replace"]["Title"] = get_link(url, value=title)
item["Description"] = description
item["Formula"] = obj.getMinifiedFormula()

return item


schema = ATFolderSchema.copy()


Expand Down
8 changes: 0 additions & 8 deletions src/bika/lims/controlpanel/configure.zcml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,6 @@
layer="bika.lims.interfaces.IBikaLIMS"
/>

<browser:page
for="bika.lims.interfaces.ICalculations"
name="folder_view"
class=".bika_calculations.CalculationsView"
permission="senaite.core.permissions.ManageBika"
layer="bika.lims.interfaces.IBikaLIMS"
/>

<browser:page
for="bika.lims.interfaces.IAnalysisServices"
name="folder_view"
Expand Down
1 change: 0 additions & 1 deletion src/bika/lims/profiles/default/factorytool.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<type portal_type="Attachment"/>
<type portal_type="Batch"/>
<type portal_type="BikaSetup"/>
<type portal_type="Calculation"/>
<type portal_type="Client"/>
<type portal_type="Contact"/>
<type portal_type="IdentifierType"/>
Expand Down
1 change: 0 additions & 1 deletion src/bika/lims/profiles/default/propertiestool.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
<element value="AttachmentType"/>
<element value="Batch"/>
<element value="BikaSetup"/>
<element value="Calculation"/>
<element value="Client"/>
<element value="Container"/>
<element value="ContainerType"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
auditlog,AuditLog
bika_analysisservices,AnalysisServices
bika_analysisspecs,AnalysisSpecs
bika_calculations,Calculations
bika_instruments,Instruments
bika_labcontacts,LabContacts
bika_referencedefinitions,ReferenceDefinitions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ auditlog
bika_analysisservices
bika_analysisspecs
bika_artemplates
bika_calculations
bika_instruments
bika_labcontacts
bika_referencedefinitions
Expand Down

This file was deleted.

2 changes: 0 additions & 2 deletions src/bika/lims/profiles/default/types.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
<object name="Batch" meta_type="Factory-based Type Information with dynamic views"/>
<object name="BatchFolder" meta_type="Factory-based Type Information with dynamic views"/>
<object name="BikaSetup" meta_type="Factory-based Type Information with dynamic views"/>
<object name="Calculation" meta_type="Factory-based Type Information with dynamic views"/>
<object name="Calculations" meta_type="Factory-based Type Information with dynamic views"/>
<object name="Client" meta_type="Factory-based Type Information with dynamic views"/>
<object name="ClientFolder" meta_type="Factory-based Type Information with dynamic views"/>
<object name="Contact" meta_type="Factory-based Type Information with dynamic views"/>
Expand Down
48 changes: 0 additions & 48 deletions src/bika/lims/profiles/default/types/Calculation.xml

This file was deleted.

29 changes: 0 additions & 29 deletions src/bika/lims/profiles/default/types/Calculations.xml

This file was deleted.

Loading
Loading