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

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

By
Juan Formoso
on 10/6/14, 10:12 AM 635 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?

1

Ben Bernard

--Ben Bernard--
1083
| 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>
</xpath>

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

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

2 follower(s)

Stats

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