Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
5243 Lượt xem

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?


Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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 !

 

Ảnh đại diện
Huỷ bỏ
Tác giả

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

@pascal, I have updated my answer.

Tác giả

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

Tác giả

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.

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 11 15
6350
0
thg 6 25
604
1
thg 5 25
1387
2
thg 5 25
9879
3
thg 3 24
5538