This question has been flagged
4 Replies
7698 Views

Is there possibility to display all messages send to defined customer in customer's view, like messages history. When I send message from Messaging to customer, they does not shows in customer's details view. How I can display all messages sending to /received from customer in new tab in customer's view? I'm using OpenERP 7

Avatar
Discard
Best Answer

refer this link :https://www.odoo.com/apps/modules/10.0/partner_emails_history

Avatar
Discard
Author Best Answer

I managed to solve this problem by creating a button and the action that takes me to the list of filtered messages. Here is the code.

<record id="mail_message_partner" model="ir.actions.act_window">
        <field name="name">Messages</field>
        <field name="src_model">res.partner</field>
        <field name="res_model">mail.message</field>
        <field name="view_mode">tree,form</field>
        <field name="view_id" ref="mail.view_message_tree"/>
        <field name="search_view_id" ref="mail.view_message_search"/>
        <field name="context">{'partner_ids': active_id}</field>
        <field name="domain">['|', ('author_id', '=', active_id) ,('notified_partner_ids', '=', active_id)]</field>
    </record>

Buttons view:

<record model="ir.ui.view" id="res_partner_view_buttons">
        <field name="name">res.partner.view.buttons</field>
        <field name="model">res.partner</field>
        <field name="inherit_id" ref="base.view_partner_form" />
        <field name="priority" eval="10"/>
        <field name="arch" type="xml">
            <xpath expr="//div[@name='buttons']" position="inside">
                <button type="action"  string="Meetings"  name="%(base_calendar.action_crm_meeting)d"
                    context="{'search_default_partner_ids': active_id, 'default_partner_ids' : [active_id]}"/>
                <button type="action" string="Calls" 
                    name="%(crm.crm_case_categ_phone_incoming0)d" 
                    context="{'search_default_partner_id': active_id, 'default_duration': 1.0}" />
                <button type="action" string="Opportunities" attrs="{'invisible': [('customer', '=', False)]}"
                    name="%(crm.crm_case_category_act_oppor11)d" context="{'search_default_partner_id': active_id}"/>
        <button type="action" string="Messages" attrs="{'invisible': [('customer', '=', False)]}" 
                    name="%(mail_message_partner)d"/>
            </xpath>
        </field>
    </record>
Avatar
Discard
Author Best Answer

I managed to solve this problem by creating a button and the action that takes me to the list of filtered messages. Here is the code.

<record id="mail_message_partner" model="ir.actions.act_window"> <field name="name">Messages</field> <field name="src_model">res.partner</field> <field name="res_model">mail.message</field> <field name="view_mode">tree,form</field> <field name="view_id" ref="mail.view_message_tree"/> <field name="search_view_id" ref="mail.view_message_search"/> <field name="context">{'partner_ids': active_id}</field> <field name="domain">['|', ('author_id', '=', active_id) ,('notified_partner_ids', '=', active_id)]</field> </record>

<record model="ir.ui.view" id="res_partner_view_buttons"> <field name="name">res.partner.view.buttons</field> <field name="model">res.partner</field> <field name="inherit_id" ref="base.view_partner_form"/> <field name="priority" eval="10"/> <field name="arch" type="xml"> <xpath expr="//div[@name='buttons']" position="inside"> <button type="action" string="Meetings" name="%(base_calendar.action_crm_meeting)d" context="{'search_default_partner_ids': active_id, 'default_partner_ids' : [active_id]}"/> <button type="action" string="Calls" name="%(crm.crm_case_categ_phone_incoming0)d" context="{'search_default_partner_id': active_id, 'default_duration': 1.0}"/> <button type="action" string="Opportunities" attrs="{'invisible': [('customer', '=', False)]}" name="%(crm.crm_case_category_act_oppor11)d" context="{'search_default_partner_id': active_id}"/> <button type="action" string="Messages" attrs="{'invisible': [('customer', '=', False)]}" name="%(mail_message_partner)d"/> </xpath> </field> </record>

Avatar
Discard
Best Answer

Hi Sebastian,

Your code worked absolutely good. There are 3 types of Messages (email, comment, notification). When I logged in as admin, It is showing all the messages. But when I login as a user, it is showing only the messages with type 'Comment'. I tried changing your code a little bit in mail_message_partner from 

field name="domain">['|', ('author_id', '=', active_id) ,('notified_partner_ids', '=', active_id)]</field>

to,

field name="domain">['|', ('author_id', '=', active_id) ,('notified_partner_ids', '=', active_id),('type','in',['email','comment','notification'])]</field>

but still i am unable to get the email and notifications. Please help me with a solution. Else guide me if i need to change the access rights.

 

 

Avatar
Discard