This question has been flagged
3967 Views

I am trying to display the last message or note associated with a project in a kanban view. I have the following in a view, but there isn't a value being displayed even though I am sure there are notes on the project. Does anyone have any idea where this might be going wrong?

I removed the irrelevant portions of the xml.

<kanban class="oe_background_grey o_kanban_dashboard o_project_kanban">
     <field name="message_ids"/>
     <templates>
         <div t-if="record.message_ids &amp;&amp; record.message_ids.length &gt; 0">
             <span class="fa fa-comment-o">
                 <t t-esc="record.message_ids[-1].date"/>
            </span>
         </div>
     </templates>
</kanban>

Avatar
Discard

Lee,
At line
div t-if="record.message_ids && record.message_ids.length > 0"
you should use "and" where you are taking "&&"(if i am right, you are using it as && 'and' operator) as its totally working on python systax...
so it should be like:
div t-if="record.message_ids and record.message_ids.length > 0"

Author

Pawan, Thank you for your reply. I am getting the error; Uncaught TypeError: Cannot read property 'date' of undefined I have tried using message_ids[0].date as well. If I put message_ids.raw_value I do see the list of ids. Any ideas?