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 add javascript to xml view of openerp?

By
Anna
on 9/16/14, 12:17 AM 1,934 views

I tried adding some  javascript directly to xml view, in a header, and a simple alert works, but when i try to loop in any way, does not work, throws this message:

Error: Invalid XML: <form string="Mejores Rutas" version="7.0"><header><script type="text/javascript"> var elem = document.getElementByTagName("field"); for(var i=0;i<elem.length;i++){ if(i == 0) { alert("HOLA"); } } </script></header><field name="origen" modifiers="{&quot;required&quot;: true}"/><field name="invoices" string="Facturas para Enviar" widget="one2many" colspan="4" nolabel="1" modifiers="{&quot;required&quot;: true}"/><footer/></form>

http://localhost:8069/web/webclient/js?db=ms:162

Is there any other way of adding js code in openerp?

0
Zakaria ELIKLIL
On 11/18/14, 4:49 PM

You need to escape the < sign. Use &lt;

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: 9/16/14, 12:17 AM
Seen: 1934 times
Last updated: 3/16/15, 8:10 AM