Skip to Content

Welcome!

Share and discuss the best content and new marketing ideas, build your professional profile and become a better marketer together.

Sign up

You need to be registered to interact with the community.
This question has been flagged
1 Reply
33 Views

Hi,

I am working in Odoo8 Community Edition.  I want to create a confirmation link  related to my Odoo Database User and URL over a specific event in email,  if an odoo user clicks on that link in email, he should be redirected to Login Page in Odoo and after entering his credentials, a screen for specific details to be entered should appear.


The case somewhat looks similar to user creation and verification in Odoo but it is  different to that scenario.

Is this possible in Odoo? and if yes, can anyone please help me over this?

Any help will be highly appreciated.

Thanks in advance.

Avatar
Discard

Hi,


You can try like this,


First of all you have to create a template for the page, which has to be displayed for entering the specific details.


You can create a page template like this,

<template id="acknowledge_page" name="Acknowledge" page="True">
      <form method="post" action="/test/acknowledge">
            <div class="container">
                  <b>Enter Details</b>
            </div>
            <div class="form-group form-field o_website_form_custom">
                  <font style="" class="text-gray">Test value1</font>
              <div class="col-md-7 col-sm-8">                 <input type="text" id="test_val" class="form-control o_website_form_input" name="Test Value1" required="True"/>
              </div>
            </div>
            <div class="form-group form-field o_website_form_custom">
                  <font style=""  class="text-gray">Test Value2</font>
              <div class="col-md-7 col-sm-8">
                  <input type="text" id="test_val2" class="form-control o_website_form_input" name="Test Value2" required="True"/>
              </div>
            </div>
            <div class="form-group">
              <input type="submit" class="btn btn-primary btn-lg" value="Enter"/>
           </div>
      </form> 
</template>


As the page template is created now we have to write route in the controller, suppose if we want to get this page on typing url like this or from clicking this url,


URL :  http://0.0.0.0:8013/acknowledgement


Then in controller,

@http.route('/acknowledgement', type='http', csrf=False, auth="user", website=True)
def view_acknowledgment(self, **kwargs):
#return the template, template id is acknowledge_page
return request.render('module_name.acknowledge_page')

Here as the auth="user" is given, before loading the acknowledgement page, the user will be redirected to login page and ask to enter his credentials,

After entering the credentials, user will be directed to the acknowledgment page.

Then we have to code the action for the submit button.

You may have to save the user entered details to the db, for this...,

On clicking the submit button, the route /test/acknowledge will work, (action of the form )

Inside this route we can access user entered value and save it to db.

@http.route('/test/acknowledge', type='http', csrf=False, auth="user", website=True)
def acknowledgment_save(self, **kwargs):
test_val = kwargs['test_val']
test_val2 = kwargs['test_val2']
# here write the code to save it to the db
return request.redirect('/')


Thanks

Avatar
Discard

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!