Odoo Help

0

How to receive messages from this form (website_crm)?

By
Pascal Tremblay
on 10/25/15, 1:36 PM 883 views

Hello all,

I have installed the module website_crm.

I have put this new form on my website.contactus page.

Now, none message is received. How to receive message sent by public users on the site???

Thanks for your tip 

the outgoing mail server is configured.



EDIT #1

I have this code :

from openerp.addons.website_crm.controllers.main import contactus
class contactus_pt(contactus):
    _inherit = ['mail.thread']

    def create_lead(self, request, values, kwargs):
       """ Allow to be overrided """
       cr, context = request.cr, request.context
        self.message_post(cr, uid, [new_id], body=_("prout prout"), context=ctx)           return request.registry['crm.lead'].create(cr, SUPERUSER_ID, values, context=dict(context, mail_create_nosubscribe=True))


I get this error :

    AttributeError: 'contactus (extended by contactus_pt)' object has no attribute 'message_post'


I can understand that my code is not still right, but why do I get this error? I have well inherited the mail.thread class no? So I could use message_post? No?


1

This website form will create a Lead in back end side. If lead is not able to create at back side then there must be command line error. You need to paste it over here so I can suggest something.

If you want to get email then you have 2 options.

1. Create Lead & Get email :

In this option, let lead creation process as it is and you use server action. Please define a server action like when new lead created, your user assign as a responsible user of that lead. So when any user being a responsible, they automatically added as follower of that lead. And when you be follower of any lead, you will automatically get an email. 

2. Don't create lead and get only email :

In this option, go to website_crm >> controllers >> main.py file and override the following method,

 def create_lead(self, request, values, kwargs):
""" Allow to be overrided """
    cr, context = request.cr, request.context
    return request.registry['crm.lead'].create(cr, SUPERUSER_ID, values, context=dict(context, mail_create_nosubscribe=True))
In this method, override the create method and use message_post method to send email to particular partner.

Here I have just given the way / logic not the exact code. From your "broad" experience from Odoo forum so far, I think you are capable enough to code yourself.

All the best !

 

Thanks. Do you think we could receive a email instead of creating a lead?

Pascal Tremblay
on 10/26/15, 9:32 AM

@pascal, I have updated my answer.

Emipro Technologies Pvt. Ltd.
on 10/26/15, 10:36 AM

You are really nice. Be sure I will try it very soon. thanks 10 times.

Pascal Tremblay
on 10/26/15, 7:46 PM

The message_post method doesn't seem to send an email. This method rather write a message in the bottom social section when we edit a lead.

Pascal Tremblay
on 11/7/15, 7:45 PM

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: 10/25/15, 1:36 PM
Seen: 883 times
Last updated: 11/2/15, 11:01 PM