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 replace a title with xpath?

By
Pascal Tremblay
on 3/12/15, 9:13 AM 2,381 views

Hello everybody here,

Still an strange mystery today... Look at this example. 

My goal : replace a <title> tag with xpath

Example 1 : See code and image. the new title is after the original one. It is what we want.

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <template id="index" inherit_id='point_of_sale.index' name="Index AS">&lt;!DOCTYPE html&gt; 
            <xpath expr="//title" position="after">
                <title>Odoo POS - AS</title>
            </xpath>
            <xpath expr="//link[@id='pos-stylesheet']" position="after">
                <link rel="stylesheet" href="/pos_lapagept/static/src/css/pos_as.css" />
            </xpath>
        </template>
        <template id="assets_backend" name="point_of_sale assets" inherit_id="point_of_sale.assets_backend">
            <xpath expr="//script[contains(@src,'widget_base.js')]" position="replace">
                <script type="text/javascript" src="/pos_lapagept/static/src/js/widget_base.js"></script>
            </xpath>
        </template>
    </data>
</openerp>

 

Example 2 : See code and image. the new title DOESN'T REPLACE the original one. It is NOT what we want. ????????? 

<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <template id="index" inherit_id='point_of_sale.index' name="Index - AS">&lt;!DOCTYPE html&gt; 
            <xpath expr="//title" position="replace">
                <title>Odoo POS AS</title>
            </xpath>
            <xpath expr="//link[@id='pos-stylesheet']" position="after">
                <link rel="stylesheet" href="/pos_lapagept/static/src/css/pos_as.css" />
            </xpath>
        </template>
        <template id="assets_backend" name="point_of_sale assets" inherit_id="point_of_sale.assets_backend">
            <xpath expr="//script[contains(@src,'widget_base.js')]" position="replace">
                <script type="text/javascript" src="/pos_lapagept/static/src/js/widget_base.js"></script>
            </xpath>
        </template>
    </data>
</openerp>

 

What is the problem? Why could we not replace the title correctly?

 

1
Umashankar Subramani
On 3/13/15, 1:27 AM

Hi,

 <xpath expr="//title[1]" position="attributes">
                <attribute name="title">Odoo POS - AS</attribute>
  </xpath>

try this.............

With this test, I get :

It is not ok. Sorry and thanks.
Pascal Tremblay
on 3/13/15, 6:38 AM

You didnt get the expected result?....

Umashankar Subramani
on 3/13/15, 8:11 AM

With your code, I get :

It is not like I want. Thanks
Pascal Tremblay
on 3/17/15, 9:57 AM

Then exactly what u want.......

Umashankar Subramani
on 3/18/15, 4:56 AM
0

Pascal Tremblay

--Pascal Tremblay--
1312
| 5 2 7
Alma, Canada
--Pascal Tremblay--


Pascal Tremblay
On 10/27/15, 10:34 PM

What we needed was :

<xpath expr="//title" position="replace">

        <title>Odoo POS - AS</title>

</xpath>

We don't know why, but this time, it works!

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: 3/12/15, 9:13 AM
Seen: 2381 times
Last updated: 10/27/15, 10:34 PM