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.

0

How to rename a website page url

By
Erwin van der Ploeg
on 6/24/15, 9:27 AM 931 views

 How can i rename a website page url?

e.g.:

www.example.com/page/page-abc to

www.example.com/page/page-xyz 


0

Yenthe

--Yenthe--
6721
| 7 7 8
Turnhout, Belgium
--Yenthe--

My Odoo blog: http://www.odoo.yenthevg.com/

My Twitter: https://twitter.com/Yenthe666

Yenthe
On 6/25/15, 2:21 AM

Hi Erwin,

If you have this page built in XML it will have an ID. The XML ID refers to a class in a Python file which is inside an http.route and this determinates the page URL.An example for one of the pages I made. The XML:

 <template id="categoryselection">
            <t t-call="website.layout">
              <div id="wrap">
                <div class="container oe_website_sale">
                  <h1 class="mb32">Kies een categorie</h1>
                  <div class="row">
                    <form method="post" class="">
                        <div class="row bg-info" style="padding:15px;margin-top:30px;border-radius:15px;">
                          <div class="form-inline form-group">
                            <label for="afwerking" class="h4">Type afwerking</label>
			    <br />
                            <select id="afwerking" name="afwerking" class="form-control">
                              <t t-foreach="afwerkingen" t-as="afwerking">
                                <option t-att-value='afwerking.id'>
                                  <span t-field="afwerking.name" />
                                </option>
                              </t>
                            </select>
                          </div>
                        </div>
			<input type="submit" class='btn btn-primary pull-right' value='Bevestigen'/>
		   </form>
		  </div>
		</div>
	     </div>
	   </t>
	</template>

As you can see this has a template ID named 'categoryselection'. When you'd open the controller you will find a http route and a function which links to this page. In my example:

    @http.route(['/shop/categoryselection'], type='http', auth="public", website=True)
    //The function for this page
    def categoryselection(self, **post):
	cr, uid, context, pool = request.cr, request.uid, request.context, request.registry
        order = request.website.sale_get_order()
    //Lots of irrelevant code for you after this.

This @http.route is the name of the webpage, so this would for example be http://localhost:8069/shop/categoryselection. By changing this @http.route you can modify the page URL.

I hope this helps you enough.
Yenthe


No, sorry i don't understand what you mean. I just created a webpage trough frontend, and that needs a new url.

Bas Solutions, Erwin van der Ploeg
on 6/25/15, 3:13 PM

Hmm no idea about that sorry.. By the way you should know that its not a good idea to create new webpages etc through the frontend. If you ever update your base module or websites modules you will lose a lot of things due to it not being in the code..

Yenthe
on 6/26/15, 2:05 AM

The content pages you make always trough the front end. Looks to me this is how it is intended. The only problem is that if the page name has an error, we can't change it. At least i don't know how.

Bas Solutions, Erwin van der Ploeg
on 7/6/15, 3:05 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: 6/24/15, 9:27 AM
Seen: 931 times
Last updated: 6/25/15, 2:22 AM