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

Migrated instrument locations to Dexterity #1705

Merged
merged 20 commits into from
Dec 12, 2020

Conversation

ramonski
Copy link
Contributor

Description of the issue/feature this PR addresses

This PR converts existing AT based instrument locations to Dexterity.

Current behavior before PR

  • Instrument locations are AT based
  • Code located in bika.lims

Desired behavior after PR is merged

  • Instrument locations are DX based
  • Code located in senaite.core

--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.

@ramonski ramonski added the Version 2.0 Plone 5 Compatibility label Dec 10, 2020
@ramonski ramonski requested a review from xispa December 10, 2020 19:19
Copy link
Member

@xispa xispa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing!

obj = _createObjectByType(portal_type, container, tmp_id)
obj = _createObjectByType(portal_type, container, id)
obj.processForm()
obj.edit(title=title, **kwargs)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't be necessary to notify the modification explicitly?

notify(ObjectModifiedEvent(obj))

I recall there are some subscribers for ObjectModifiedEvent (for Contact, Batch, ...)
Probably for both ATs and DX.

Also, what if we do a noLongerProvides(IAuditLog, obj) before the edit and an alsoProvides(IAuditLog, obj) afterwards?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion this modification event was always wrong in that function, because we are creating an object and not modifying it. Therefore, I think it is better to handle that internally as just one transaction.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understand, however, we'll need to keep this in mind. I think Batch type is the only one that might be affected by this change in core, but not sure atm about the scope of this change in other add-ons (e.g. jsonapi)

"The place where the instrument is located in the laboratory"))

self.show_select_column = True
self.pagesize = 25
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't set the pagesize explicitly. I think is 50 by default, which is fine imo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pagesize is set to 25 for all of the controlpanel listings and I would like to keep them consistent for now.
Maybe we can make a setup option and refactor all of them in another PR?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds a good idea. Let's do it in another PR then

url = obj.absolute_url()

item["replace"]["Title"] = get_link(url, value=title)
item["Description"] = description
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would simplify to:

def folderitem(self, obj, item, index):
    item["replace"]["Title"] = get_link_for(obj)
    item["Description"] = api.get_description(obj)

@@ -8,11 +8,17 @@
<bindings>

<!-- Bindings to "senaite_one_state_workflow" -->
<type type_id="IstrumentLocations">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "IstrumentLocations" --> "InstrumentLocations"

@@ -54,6 +54,7 @@ Client's folder:
If the client is assigned on creation, same behavior as before:

>>> batch = api.create(portal.batches, "Batch", Client=client)
>>> modified(batch)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This wouldn't be necessary, see my previous comment

@xispa xispa merged commit 6261629 into 2.x Dec 12, 2020
@xispa xispa deleted the convert-storagelocations-to-dexterity branch December 12, 2020 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Version 2.0 Plone 5 Compatibility
Development

Successfully merging this pull request may close these issues.

2 participants