跳至内容
菜单
此问题已终结
5011 查看

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>

形象
丢弃

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"

编写者

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?

相关帖文 回复 查看 活动
1
5月 23
3733
1
9月 21
7711
1
3月 25
1132
1
1月 25
1604
0
11月 24
1385