Skip to Content
मेन्यू
This question has been flagged
1 Reply
4629 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?

Avatar
Discard
Best Answer

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.

Avatar
Discard
Author

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

Have you update your module?

Author

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

Author

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

Author

@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!

Author

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

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

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

Author

@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).

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