Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
1 Balas
5259 Tampilan

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?


Avatar
Buang
Jawaban Terbai

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 !

 

Avatar
Buang
Penulis

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

@pascal, I have updated my answer.

Penulis

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

Penulis

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.

Post Terkait Replies Tampilan Aktivitas
1
Nov 15
6360
0
Jun 25
608
1
Mei 25
1395
2
Mei 25
9881
3
Mar 24
5540