Odoo Help


[SOLVED] How to change a HTML line in a XML view through inheritance?

Juan Formoso
on 10/6/14, 10:12 AM 850 views

I made a form which inherits from a form view. I added some new fields and changed some attributes, but now, I need to change this line:

<a type="open"><field name="name"/></a>

And convert it into this:

<a type="object" name="my_function"><field name="name"/></a>

How can I do this?


Ben Bernard

--Ben Bernard--

| 4 3 6
Jakarta, Indonesia
--Ben Bernard--
Ben Bernard
On 10/6/14, 11:25 AM

try this:

<xpath expr="//a[@type='open']" position="attributes">
    <attribute name="type">object</attribute>
    <attribute name="name">my_function</attribute>

edit: as a note, the expr should be defined such that it found unique node.

Thank you! I added the lines, but nothing happened. The form is still behaving in the old way.

Juan Formoso
on 10/6/14, 11:47 AM

Have you update your module?

Ben Bernard
on 10/6/14, 11:50 AM

@Ben Bernard may be because the tag is inside a page?

Juan Formoso
on 10/6/14, 11:50 AM

Yes, I stopped, started and updated the OpenERP to make the changes visible even in the XML code.

Juan Formoso
on 10/6/14, 11:52 AM

@Ben Bernard This one worked: <xpath expr="/form//page//a[@type='open']" position="attributes"> object open_line Edit your answer and I'll mark it as the right one!

Juan Formoso
on 10/6/14, 12:02 PM

Sorry, take into account only this change: <xpath expr="/form//page//a[@type='open']" position="attributes">

Juan Formoso
on 10/6/14, 12:03 PM

Did you mean the xml has changed as expected when editing the form in debug mode?

Ben Bernard
on 10/6/14, 12:06 PM

Owh.. I see. Ignore my last question. Yes, it has to make sure the xpath expr find uniq node. Thanks for the correction.

Ben Bernard
on 10/6/14, 12:09 PM

@Ben Bernard No, I add your lines to my XML code (with the modification I told you above), and after restarting and updating the service, it started to work as expected! Your answer was almost right (it did not work because the tag was inside a page, I guess).

Juan Formoso
on 10/6/14, 12:11 PM

I let my answer as the original plus some note to preserve the context of the question.

Ben Bernard
on 10/6/14, 12:22 PM

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.


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)


Asked: 10/6/14, 10:12 AM
Seen: 850 times
Last updated: 3/16/15, 8:10 AM