Odoo Help

0

Login feature in odoo

By
Anand Prasanth
on 7/5/16, 6:39 AM 722 views

I would like to create a module/app to use the login authentication. I am not sure how to proceed. But registration is necessary which I have already kept ready.

The design for the login is not a matter but How to check whether the user is registered and to give separate functionalities depending upon the type of user who logins the module/website.


And also how to carry the credentials till the users logout.

Are you talking about the backend, or a front-end website?

Michael Watchorn
on 7/5/16, 5:25 PM

@Michael Watchhorn, front end is not at all a problem right? I am talking about the backend.

Anand Prasanth
on 7/5/16, 11:25 PM
1
Axel Mendoza
On 7/5/16, 7:33 PM

I think that the solution of what you want is more simple than what you are thinking about. 

If you wanna ensure that an user is authenticated before do something you just need to do something like this into the controller of the url for that something, like the following scenario:

#making sure that the user is registered and authenticated before checkout in the shop:

from openerp import http

from openerp.http import request

from openerp.addons.website_sale.controllers.main import website_sale

class solt_website_sale(website_sale):

@http.route(['/shop/checkout'], type='http', auth="user", website=True)

def checkout(self, **post):

return super(solt_website_sale, self).checkout(**post)

For the separation of features depending of the type of users, you will need to get more familiar with Odoo security stuffs like groups, and how to use it to restrict the content that you deliver to your users


0
Annadurai
On 7/6/16, 3:17 AM

In .PY

fields-->

user_name=fields.Char(string="User name",required=True,help="This field has ADMIN authenticity, Provide valid user name and password")

password_login=fields.Char(string="Password",required=True,help="This field has ADMIN authenticity, Provide valid user name and password")

check_valid=fields.Char(compute="check_user_password",string=" Login",help="If USER NAME and PASSWORD are Matched, Then it will show you LOGIN BUTTON")

@api.one

@api.depends('user_name','password_login')

def check_user_password(self):

    if self.user_name=='vicky' and self.password_login=='vicky':

    self.check_valid=True 

AND in XML

<field name="user_name" style="width:60%%;height:5%%;font-size:15px" placeholder=" USER NAME"/>

<field name="password_login" style="width:60%%;height:5%%;font-size:15px" placeholder=" PASSWORD" password="1"/>


<field name="check_valid" />

<button name="%(customer_action_window)d" type="action"

class="oe_highlight oe_stat_info oe_right o_wow" style="background-color:#32CD32"

icon="fa-sign-in" attrs="{'invisible':[('check_valid','=',False)]}" />

 You may fetch records from db and check it for login... whenever the condition is "True", it automaticlly Shows the Button to login... Hope this will give some Idea to u...

0
Anand Prasanth
On 7/5/16, 11:29 PM

Axel Mendoza thanks for the reply. This is also required for me. But I am asking for the basic authentication. i.e., the login process itself. You are saying about the process after the login for holding up the authentication.

The login process itself is already handled by Odoo out of the box.

Ermin Trevisan
on 7/6/16, 2:31 AM

How to make a custom registration form to add users to the database then?

Anand Prasanth
on 7/6/16, 2:35 AM

@Annadurai Thank you for your reply. I have made this design already with a different scenario. But I need to check the database for the user name and the password which is in a different table. But inside the same project.

Anand Prasanth
on 7/6/16, 3:57 AM

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

2 follower(s)

Stats

Asked: 7/5/16, 6:39 AM
Seen: 722 times
Last updated: 7/6/16, 3:17 AM