Adding new field to sample


I want to add a new data type for samples called Turn-Around Time. I’ve followed this guide and successfully created a new column. Next, I wanted to add a field Turn-Around Time when creating the sample. To do this, I’ve added the following code into the /src/bika/lims/content/ to create a new schema:

           'Turn-Around Time',
               label=_('Turn-Around Time'),
                   'add': 'edit',

This method works (see pictures below) but I am wondering if this is the best method to achieve this. Will this method break when Senaite is updated? Is there a way that I can create this schema in an adapter instead?

Thank you for your time.



1 Like

Hello @anthony :rabbit: :wave:

Editing the files in the src/bika/lims/ directory (or ANY installed package) directly can be very useful to test functionality and try new things, but the changes will be removed next time you update Senaite. There are 2 ways around this:

  1. [Recommended] Create a Plone Add-On containing these changes, and install that Add-On into your Senaite site as a development package. You can learn about Plone Add-Ons by referencing the Mastering Plone 5 Development guide. Notably, the section on Writing Your Own Add-Ons to Customize Plone.
  1. [Optional] Maintain a Git Fork of the senaite.core add-on (and ALL other add-ons that you edit), and merge all the updates to those add-ons in through your own repository as a development packages. This is potentially easier for a very small number of changes, but will quickly become overwhelming to maintain if you are making changes across multiple modules.