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

Disable invitation email when creating user

By
Sellem
on 5/29/15, 10:46 AM 1,295 views

Hi all,

I am setting up a self-hosted Odoo 8.0 to test some features and I activated LDAP Authentication.

LDAP is working fine but when I create a user, I have the following message :


"An invitation email containing the following subscription link has been sent:

http://odoo.mycompany.eu/web/reset_password?token=XXXXXXXXXXXXXX=XXXX"


I didn't find how to disable this invitation, someone has any idea of how to do it ?

I would like to know if it's also possible to make bulk import with LDAP, I mean just specify an OU and import all users inside this OU, any idea ?

Thanks for your help :)



Did you find any way to disable the invitation email? I'd like to do that too.

A. Person
on 8/20/15, 6:42 PM
1
Aron Lorinc
On 10/28/15, 7:55 AM

I browsed the source code and it turned out to be pretty easy. If you add  `no_reset_password` to the context, it won't send an email. You can then set the password manually (and find a way to let the user know it, obviously).

user = self.pg_user = self.env["res.users"].sudo().with_context(no_reset_password=True).create({
# user details here...
})

Hi Aron, coud you be more specific , which module do i have to change?

feriel bendimerad
on 11/2/15, 9:43 AM

Hi Feriel, The question is about how to disable email when you create it programmatically, so it assumes you already have your custom module installed. If you don't have a custom module, then create one, as it's really a bad idea to change other modules' source code, because your changes will be erased if you update that module to a newer version.

Aron Lorinc
on 11/2/15, 9:48 AM

Hi Aron , i got it , i actually have a custom module, do i have to inherit from the mail module? It has res_users.py file , if so , should i override the "create" methode only or others , please enlightened me .Thanks

feriel bendimerad
on 11/4/15, 4:17 AM

You should create your own res_users.py like this: class res_users(models.Model): _name = "res.users" _inherit = "res.users" Then override method "signup" and call the superclass method with the context parameter I mentioned in my answer. Hope it helps.

Aron Lorinc
on 11/4/15, 8:39 AM

thank you for help , but i missing something ,what should i put in user details ?

feriel bendimerad
on 11/5/15, 5:50 AM

The name, login, password, etc. of the user you want to create programmatically. This's what the original question was about. If you want to prevent Odoo from sending an invite when creating an user MANUALLY, you should just override the "signup" method in the "res.users" model like I described above.

Aron Lorinc
on 11/5/15, 5:54 AM

well , i'm creating a user using webservice API (java language) , and an email invitation is sent to him to change his password , so what do you mean by override "signup " method? changing only the context

feriel bendimerad
on 11/5/15, 6:23 AM

Can you pass context parameters via the API? If you can, I think it's enough to pass no_reset_password=True, then it won't send an email. If you can't pass context params via the webservice API, then create a new method in res.users which takes parameters about the user you want to create and creates it in the way I described in my answer.

Aron Lorinc
on 11/5/15, 6:29 AM

ps: and call that method via the API, obviously.

Aron Lorinc
on 11/5/15, 6:29 AM

@Aron thanks for your answer, it helped. Just a question, why sudo() call is necessary?

ubik
on 12/3/15, 6:35 AM

Well, it's not really necessary if the user that runs this code has rights to create users, but that was not the case in my code.

Aron Lorinc
on 12/3/15, 6:37 AM

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: 5/29/15, 10:46 AM
Seen: 1295 times
Last updated: 12/2/15, 6:43 PM