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.

1

Customer Portal in Odoo9

By
Gavin Yap
on 1/26/16, 2:39 AM 686 views

Updated

I wanted to create a customized sign in page that would allow 2 type of customer to create an account with different roles.

It turns out that even when I use the inbuilt auth_signup module, the user_navbar is not visible as well. 

I then found out that you actually need to add the website.user_navbar under the group's view if using auth_signup module.

But my problem still remains that my user still cannot view the website.user_navbar and nagivate to the respective application when login. 



BR,
Gavin

0
Gavin Yap
On 1/28/16, 11:55 PM

There a 2 discoveries I made:

1) if auth_signup is ever used, you need to manually add the website.user_navbar to the view of the group that the user is created. For signup users using the auth_signup process, the user will be assigned to the  group_portal user group. So adding the nav_bar there, would allow the black navigation bar to appear, allow the user to navigate to other modules, e.g. customer portal

) The other discovery I made was either 2 accounts Hr.employee (and the rest of the groups) or user_portal (with website.navbar) will be able to see the navigation bar and navigate to the respective custom modules I create. Now if I would copy and clone either the account for my customized signup user. It would not work, and I could figure out why? As a part of my work around, my signup process includes assign the user with group_portal and then a customized group type that I intended for the customer.


    @http.route('/market/signup/customer/', auth='public', website=True)
def customer_sign_up(self, **kw):
# GET Request
if http.request.httprequest.method == 'GET':
return http.request.render('elm.customer_sign_up')
# POST Request
if http.request.httprequest.method == 'POST':
print "POST"
self.do_signup_customer(http.request.params)
return "Customer user created"
    def do_signup_customer(self, values):
# Retrieve all fields from values
email = values.get('login')
name = values.get('name')
password = values.get('password')
confirm_password = values.get('confirm_password')
# Check if password and confirmation match
assert password == confirm_password, "Passwords do not match; please retype them."
# Check login field for valid email
assert re.match(r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$", email), "%s is not a valid email address." % email
# Check if login(email) exist
count = http.request.env['res.users'].search_count([['login', '=', email]])
assert count == 0, "User already exist, please try reset password"
# create the user if all assertion passed
 
# Get the reference of customer group and portal group
customer = http.request.env.ref('elm.group_customer')
portal = http.request.env.ref('base.group_portal')

# Create User
http.request.env['res.users'].sudo().create({
'name': name,
'login': email,
'password': password,
'groups_id': [(6, 0, [customer.id, portal.id])],
})



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: 1/26/16, 2:39 AM
Seen: 686 times
Last updated: 1/29/16, 3:22 AM