bikalabs/Bika-LIMS — pull request #1380 by pietercvdm (2014-12-09 00:57:12+00:00)
Title: Bugfix: If a sample is reused the partition variable needs to be set

You get the following error if you try to create a new AR using an existing Sample:
Traceback (most recent call last):
File \"/opt/bika/test/buildout-cache/eggs/plone.jsonapi.core-0.4-py2.7.egg/plone/jsonapi/core/browser/decorators.py\", line 23, in decorator return f(*args, **kwargs)
File \"/opt/bika/test/buildout-cache/eggs/plone.jsonapi.core-0.4-py2.7.egg/plone/jsonapi/core/browser/api.py\", line 59, in render
return self.dispatch()
File \"/opt/bika/test/buildout-cache/eggs/plone.jsonapi.core-0.4-py2.7.egg/plone/jsonapi/core/browser/api.py\", line 53, in dispatch
return router(self.context, self.request, path)
File \"/opt/bika/test/buildout-cache/eggs/plone.jsonapi.core-0.4-py2.7.egg/plone/jsonapi/core/browser/router.py\", line 137, in __call__
return self.view_functions[endpoint](context, request, **values)
File \"/opt/bika/test/zeocluster/src/bika.lims/bika/lims/jsonapi/create.py\", line 154, in create
return self._create_ar(context, request)\n File \"/opt/bika/test/zeocluster/src/bika.lims/bika/lims/jsonapi/create.py\", line 404, in _create_ar
analyses = list(part.getAnalyses())
UnboundLocalError: local variable 'part' referenced before assignment

The patch fixes the issue.