Odoo Help

1

Get and display the last message associated with a project?

By
Lee Young
on 12/1/15, 2:08 PM 717 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>

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
on 12/2/15, 5:14 AM

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?

Lee Young
on 12/2/15, 9:28 AM

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)

Stats

Asked: 12/1/15, 2:08 PM
Seen: 717 times
Last updated: 2/25/16, 1:52 AM