Odoo Help


5 Answers

Axel Mendoza

--Axel Mendoza--
| 8 8 10
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full-time employee trying to understand what to do and how

Reach me at aekroft@gmail.com

Axel Mendoza
9/9/15 04:25

Yes this could be done in a form, like this:

<div class="oe_right oe_button_box" name="buttons">
    <button class="oe_inline oe_stat_button" type="object" name="open_inbox" icon="fa-envelope" context="{'partner_id': partner_id}">
        <field string="Unread" name="unread_count" widget="statinfo"/>

With that code in your form view you will see a button that show the number of unread messages in your inbox using the field unread_count that you need to implement as a function field for return the integer number. Also you need to implement a method open_inbox that returns the action view definition, or you could directly define your button type="action" and the name="%(action_record_id)d"

This code is using ir.actions.client because that is the type of action for the inbox

def open_inbox(self, cr, uid, ids, context=None):
    mod_obj = self.pool.get('ir.model.data')
    act_obj = self.pool.get('ir.actions.client')
    res_id = mod_obj.xmlid_to_res_id(cr, uid, 'mail.action_mail_inbox_feeds', raise_if_not_found=True)
    result = act_obj.read(cr, uid, [res_id], context=context)[0]
    return result
Prasanth ks
10/9/15 03:43

Try this function:- I write this function to get the messages for my own purpose, you just make the code as your needs,

def inbox_tree_view(self, cr, uid, ids, context):

message_ids = msg_obj.search(cr, uid, [])
for message_id in message_ids:
if matter_name==matter_name_messahe:

domain = [('id','in', domain_id_list)]
res_id = ids and ids[0] or False
print"ppppppppppppppppppp", res_id
return {
'name': _('Inbox Messages'),
'domain': domain,
'res_model': 'mail.message',
'type': 'ir.actions.act_window',
'view_id': False,
'view_mode': 'tree,form',
'view_type': 'form',
'limit': 80,
'context': "{'default_res_model': '%s','default_res_id': %d}" % (self._name, res_id)

Ask a Question
Keep Informed
2 follower(s)
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.

Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now