Odoo Help

Welcome!

This community 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.

2

Customer e-mail history

By
Sebastian Orzechowski
on 3/24/14, 10:27 AM 2,003 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

1

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>
0
emonrockz
On 7/22/14, 9:26 AM

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.

 

 

0

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>

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/24/14, 10:27 AM
Seen: 2003 times
Last updated: 3/16/15, 8:10 AM