Hi everyone, I am still quite new to Senaite so my question might seem a bit arrogant.
I am trying to modify reports
to include signatures and info of Managers and Analysts. I have tried a few things but they don’t seem to be working. I have explained more about my problem down below. Any response would be highly appreciated!
<div class="w-100">
<h1 i18n:translate="">Heads of Laboratories</h1>
<table class="table table-sm table-condensed">
<tr>
<tal:manager repeat="manager python:model.analysts">
<td style="border:none">
<img tal:condition="manager/Signature"
tal:attributes="src string:${manager/absolute_url}/Signature"
style="height:35px"
/>
</div>
<div class="font-weight-bold">
<span tal:content="manager/Salutation"></span>
<span tal:condition="manager/Salutation"> </span>
<span tal:content="manager/Fullname"></span>
</div>
<div>
<span tal:content="manager/JobTitle"></span>
</div>
<div>
<span tal:content="manager/DefaultDepartment/title|nothing">
</span>
</div>
</td>
</tal:manager>
</tr>
</table>
</div>
From the code snippet above, the line
<tal:manager repeat="manager python:model.managers">
fetches a list of manager objects successfully, therefore, generating the signature as in the attached screenshot above.
However, trying to replicate the same using:
<tal:manager repeat="manager python:model.analysts">
returns the error below:
Error: analysts
- Expression: "python:model.analysts"
- Filename: ... 0-py2.7.egg/senaite/impress/templates/reports/Default.pt
- Location: (line 603: col 41)
- Source: ... anager repeat="manager python:model.analysts">
^^^^^^^^^^^^^^^^^^^^^
...
I also tried using the model.getAnalysts()
method and it worked but not as desired:
<tal:manager repeat="manager python:model.getAnalysts()">
It only returns a
list
of usernames
of the analysts linked to this report instead of their user objects from which I can get the fullname, signature etc.
How do I get around this? Do we have a method that would return analysts in the correct format? Or is there a function that can fetch user info using just their username?