Can't import Analysis Specifications Sheet in Senaite 2.0.0rc02

Hi everyone,

I try to import the Analysis specifications sheet but it got this error:
Traceback (innermost last):
Module ZPublisher.WSGIPublisher, line 156, in transaction_pubevents
Module ZPublisher.WSGIPublisher, line 338, in publish_module
Module ZPublisher.WSGIPublisher, line 256, in publish
Module ZPublisher.mapply, line 85, in mapply
Module ZPublisher.WSGIPublisher, line 62, in call_object
Module senaite.core.exportimport.dataimport, line 108, in call
Module senaite.core.exportimport.load_setup_data, line 119, in call
Module senaite.core.exportimport.setupdata, line 111, in call
Module senaite.core.exportimport.setupdata, line 1706, in Import
Module senaite.core.exportimport.setupdata, line 1689, in resolve_service
Module ZTUtils.Lazy, line 140, in getitem
IndexError: 0

The sheet that I use is the same as from this link : https://docs.google.com/spreadsheets/d/1m56tIL24f-cBqMoWouzgtoRAyzNBPTUgbW9GHYMFdfY/edit#gid=936537807

I think that the error is from there, but I’m not sure:
class Analysis_Specifications(WorksheetImporter):
def resolve_service(self, row):
bsc = getToolByName(self.context, “bika_setup_catalog”)
service = bsc(
portal_type=“AnalysisService”,
title=safe_unicode(row[“service”])
)
if not service:
service = bsc(
portal_type=“AnalysisService”,
getKeyword=safe_unicode(row[“service”])
)
service = service[0].getObject()
return service

I also tried to do add data manualy but in senaite I only see “sample type”, “Dynamic Analysis Specification”, "Title " and “Description” fields. So, the problem is that I don’t know how to put “sample type”, “keyword”, “minimum” and “maximum” value which is on the Analysis specifications sheet. Anyone can help me? Is there something that I have missing?

Hi elirabalison,

Does the rest of the file import or is just the analysis specifications that is broken?

I normally use the default ‘test’ import data for testing and will manually setup data through the interface for production. Last time I looked at 2.0.0rc1 it was working.

Can you check if the ‘test’ import works? If so, take a look a that import file and check how it’s different to the bika import you’re using.

What are you trying to achieve with the 2.x versions? Testing/development or production?

Cheers,
Dan

@elirabalison

The Analysis Specifications tab in “test.xlsx” looks looks very different from the bika version you are using - so the template you are using will not work.

@elirabalison As @Dan suggested, try using the xlsx file from SENAITE 2.x.

If you have a custom addon, another option is to create new data programmatically through its “setuphandler” file. Here some examples of setuphandler files:

1 Like

The test.xlsx file work perfectly thank you.
The difference for this file and the bika import that I use is the column “keyword”. More of the bika file that I use have this column. For example: Analysis specifications, Analysis Service Methods, Analysis results options, Reference definition result and more.

1 Like

Thank you, it’s very helpful.
I try using the xlsx file from Senaite 2 and it work. From now I don’t have an add on but I don’t know why the configuration file that they gave to me is different for the test. They explained to me that keyword is important so I don’t really know how to avoid the error because the file contained a lot of lines of datas. Any suggestion?