We are using OpenERP 7 to manage leads within our organisation.
Leads are created by incoming emails. When assigning to a different sales person, the sales person gets an email with the original email and the from address is the original person that emailed it.
This is a problem because it looks like the customer emailed them directly and encourages the sales person to manage the lead from their email, rather than sending responses from the OpenERP system. How can I stop this email from being sent? I want to make my own template and use an automatic action to send a notification.
There is no automatic action sending this email. I believe it is somewhere in the python code.
You can check the automated actions from OpenERP in the Settings/Technical/Scheduler/Scheduled Actions menu. Look for the actions that read incoming e-mails and de-activate it.
In fact, I saw an option in the Settings / Configuration / Sales menu. At the bottom of the page, you must have a group called 'Emails Integration' and in this group, you must have a line with a checked checkbox with 'Create leads from incoming mails' as label.
Uncheck this box and click on 'Apply' button at the top of the page.
I found a hack solution which I hope someone can improve.
Basically the email comes in and adds an entry to the table mail_message. The type is set as "email" and this seems to be the issue. If I change it to "notification", the original email does not get sent to the newly assigned salesperson which is the behaviour that I want.
Create a server action on the incoming email server that executes the following python code:
cr.execute("UPDATE mail_message SET type = 'notification' WHERE model = 'crm.lead' AND res_id = %s AND type = 'email' ", (object.id, ))
Related
I have the logic for email verification, but I am not sure how to make it such that only after clicking the link on the verification email, the user is taken to the second page of the form, and only after filling the second part the user is saved.
I would say that much better idea is to save user to database anyway, but mark him as inactive (simple boolean field in model will be enough). Upon registration, before confirming email mark him as inactive and as soon as he confirms email and fills second part of your registration form that you mentioned change that boolean value to true. If you don't want to keep inactive users data in your database, you can set up for example cron, that will clean users that haven't confirmed their email for few days.
Visit the URL. I hope you get your answers. This appears to be duplicate of the below question asked on Stackoverflow itself
Check this.
I have two different steps and pass in the same variable there.
Scenario1:
Given the user lands on the page
When user enters a unique email address
Then user is redirected to checkout
Then user places the order
Scenario2:
Given the user lands on the same page
When the user enters the same email address above
Then user is presented with a modal window saying you already taken this offer
Is it possible to use the same generated unique email address to be used on the second scenario?
Why can't. You can use for any number of scenario's. As per scenario 1 steps, you already know the unique email address what you need to enter. Take this email address to the Hooks file and store it in one public static variable inside Before annotation. Later you can use same email for n number of scenario's using that public static variable.
If you need to use this email only for specific scenario's, add one tag to all scenario's which you need to use and tag it in Hooks file using Before({tags: tagName}). By this way, you can use this email address only for specific scenario's out of all.
I have built a very basic private messaging module for my Django project.
I have a Message model which consists of:
sender (Foreign key to the member model)
recipient (Foreign key to the member model)
message
date (Datetime of which the message was created)
Now my issue is i would like to create a new view which returns a list of conversations based on these messages.
I am trying to write a query which returns the latest messages but unique where sender = current user OR recipient = current user. This is so that i have a list of latest messages, which should be the equivalent of a conversation list. Have i got that bit right or am i completely over thinking things?
conversations = Message.objects.filter(Q(recipient=request.user) |
Q(sender=request.user)).annotate(max=Max('date'))
but this is returning duplicate conversations I tried this from another stack overflow post:
conversations = Message.objects.order_by('recipient', 'sender',
'date').distinct('recipient', 'sender')
but I'm receiving this error "DISTINCT ON fields is not supported by this database backend"
Any help would be greatly appreciated.
As #Grimmy stated in the comments, please post more information. Specifically, please add to your answer the query you tried (which you already have in the comments) and the result, and what is wrong with the result (you say "duplicate converstations; do you mean each conversation shows up just twice, or more than twice?)
Two options come to mind for this situation:
You could run a query on your existing model that removes/excludes duplicates.
You could create a new model called Conversation which holds information about the conversation, including members, date started, etc., and add a foreign key to each message assigning it one conversation (many-to-one from message to conversation). This would simplify your queries and would be easily extendable to accommodate "group chats" if need be (just add more members to the conversation), or things like a picture or title for the conversation itself.
When you post more information, I'll address option one in more detail if you would like. For now, I'll just say that if you are getting duplicate conversations where each conversation only shows up twice (once where the user is the sender and once where the user is the recipient), then it sounds like your query is good enough and you can just write a for loop in python that sorts through the resulting conversations and removes the older duplicates. As long as each user is in no more than over one or two hundred conversations, which sounds like the case, that shouldn't slow down performance too much.
But in any event, I recommend option two. I had to implement a similar feature in a Django project, and I went with option 2. It greatly simplifies your query to look like this:
# get the conversations the user is in
conversation_list = Message.objects.filter(conversation__participants=user).order_by('-date')
# get a list of the most recent message of each conversation
message_list = conversation_list.values('conversation').annotate(
first_msg=Max('conversation__message')
)
In order for that second line to sort messages properly, add the following to your Message model:
class Message(models.Model):
# sender field is unchanged
# date field is unchanged (maybe rename to avoid name collisions with date module)
# message field is unchanged (maybe rename to 'content' to avoid confusion)
# make recipient many-to-many because I'd recommend having both the sender and the recipient listed as recipients,
# but you don't have to do that
recipient = models.ManyToManyField(User)
# conversation foreign key
conversation = models.ForeignKey(Conversation, blank=False, null=False)
# this simplifies sorting so the "Max('conversation__message')" line
# sorts on date rather than primary key
ordering = ["-date"]
Here is the Conversation model:
class Conversation(models.Model):
participants = models.ManyToManyField(User)
# example functionality you may wish to add later
group_name = models.CharField(max_length=512, default="Group", blank=False, null=False)
profile_picture = models.FileField(upload_to='uploads/', default='uploads/GroupChatIcon.jpg')
i am using the formhub.org server to submit form data via odk collect software.
i designed the xlsform and it works correctly.
the problem is that i wanna set a username and password for form submission so everybody cant submit from until he/she knows the password.
i dont know is it possible from odk collect application or somehow in my xlsform...
type name label
----------------------------------------------------------------------
text some_text 1. What is your full name?
select_multiple company some_company 2. Which telecomunication companies do you use?
select_one company best_company 3. Which one is the best?
thanks
easily i did it from my formhub.org account.
in account setting there is an option for authentication for mobile i just checked it.
I am going to let new users register on my service. Here is the way I think it should go:
1. User enters his email in a field and clicks Register button.
2. User receives a confirmation email with a link containing a verification code.
3. User goes by that link from the email message where he sees a message that his account is activated now.
So, the main point I am to figure out how to implement is the second one. How do I better generate that code? Should I generate it when the user clicks Register button and save it in the field, say "verification_code" near the field "email" and then when he goes to the verification link, compare the values? Then, if that's fine, clear the "verification_code" field and set "user_is_active" field to "True". Or may be I don't have to keep that code in the database at all, but make a just in time verification with some algorithm? May be there are other things I should consider?
I've found it useful to put a verification code in the database and use it as you've suggested. The same field can do double duty for e.g. password reset requests.
I also use an expiry timeout field, where registrations or password resets need to be dealt with by the user in a timely fashion.
There is already a project that does exactly what you want. It's called django-registration. I suggest using this project instead of rolling your own.
If you still want to do it yourself, then look at the code for django-registration. It has really good comments and is really a perfect app to learn from.