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

Issue-444: Fix Sample points do not show the referenced sample types in view #453

Merged
merged 4 commits into from
Dec 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Changelog

**Fixed**

- #453 Sample points do not show the referenced sample types in view
- #470 Sort order of Analyses in WS print view wrong
- #457 Calculation referring to additional python module not triggered
- #459 Traceback in Instruments list after adding a calibration certificate
Expand Down
6 changes: 2 additions & 4 deletions bika/lims/content/samplepoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
from Products.Archetypes.public import BaseContent
from Products.Archetypes.public import BooleanField
from Products.Archetypes.public import BooleanWidget
from Products.Archetypes.public import ComputedField
from Products.Archetypes.public import ComputedWidget
from Products.Archetypes.public import DisplayList
from Products.Archetypes.public import FileWidget
from Products.Archetypes.public import ReferenceField
Expand All @@ -30,9 +28,9 @@
from bika.lims.browser.fields import DurationField
from bika.lims.browser.widgets import CoordinateWidget
from bika.lims.browser.widgets import DurationWidget
from bika.lims.browser.widgets.referencewidget import ReferenceWidget as brw
from bika.lims.config import PROJECTNAME
from bika.lims.content.bikaschema import BikaSchema
from bika.lims.browser.widgets.referencewidget import ReferenceWidget as BikaReferenceWidget


schema = BikaSchema.copy() + Schema((
Expand Down Expand Up @@ -79,7 +77,7 @@
allowed_types=('SampleType',),
vocabulary='SampleTypesVocabulary',
relationship='SamplePointSampleType',
widget=brw(
widget=BikaReferenceWidget(
label=_("Sample Types"),
description=_("The list of sample types that can be collected "
"at this sample point. If no sample types are "
Expand Down
43 changes: 31 additions & 12 deletions bika/lims/skins/bika/bika_widgets/referencewidget.pt
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,39 @@

<!-- Reference Widget -->
<metal:view_macro define-macro="view"
tal:define="kssClassesView context/@@kss_field_decorator_view;
getKssClasses nocall:kssClassesView/getKssClassesInlineEditable;">
tal:define="kssClassesView context/@@kss_field_decorator_view;
getKssClasses nocall:kssClassesView/getKssClassesInlineEditable;">

<!-- Single Valued Field -->
<tal:singlevalued tal:condition="not:field/multiValued">
<span metal:define-macro="string-field-view"
tal:define="kss_class python:getKssClasses(fieldName,
templateId='widgets/string', macro='string-field-view');
uid context/UID|nothing"
tal:attributes="class kss_class;
id string:parent-fieldname-$fieldName-$uid">
<span metal:define-slot="inside"
tal:define="value accessor;
value python: (value and hasattr(value, 'Title')) and value.Title() or '';"
tal:attributes="value python: value.strip();"
tal:content="value">reference</span>
tal:define="kss_class python:getKssClasses(fieldName,
templateId='widgets/string', macro='string-field-view');
uid context/UID|nothing"
tal:attributes="class kss_class;
id string:parent-fieldname-$fieldName-$uid">
<span metal:define-slot="inside"
tal:define="value accessor;
value python: (value and hasattr(value, 'Title')) and value.Title() or '';"
tal:attributes="value python: value.strip();"
tal:content="value">reference</span>
</span>
</tal:singlevalued>

<!-- Multi Valued Field -->
<tal:multivalued tal:condition="field/multiValued">
<ul tal:define="value accessor">
<li tal:repeat="obj value">
<a href="#"
tal:attributes="href obj/absolute_url;
class python:obj.portal_type.replace(' ', '_')"
tal:content="python:obj.Title() or obj.absolute_url(relative=1)">
Target Title
</a>
</li>
</ul>
</tal:multivalued>

</metal:view_macro>

<metal:define define-macro="edit">
Expand Down