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 pass a list of strings from python to xml and use it in java script inside of view?

By
Anna
on 9/14/14, 10:33 PM 991 views

Hi, i am working on a module where i'm going to show a google map in my xml view, i am wondering how can i pass a list of strings with coordantes to xml view and work with them inside of a javascript code embeded inside my view. Is it possible?

I am calling the view like this in the procedure that calculates coordantes

return {
            'type': 'ir.actions.act_window',
            'name': _(self._description),
            'res_model': self._name,
            'res_id': ids[0],
            'view_type': 'form',
            'view_mode': 'form',
            'view_id': view_id,
            'target': 'current',
            'nodestroy': True,
            'context' : {'group_by' :'fleet'}
        }

And the view where it leads me, is this one:

           <record id="view_best_rutas_result" model="ir.ui.view">
                <field name="name">best.route</field>
                <field name="model">best.route</field>
                <field name="priority">1</field>
                <field name="type">form</field>
                <field name="arch" type="xml">
                    <form string="Mejores Rutas" version="7.0">
                            <header>
                                    <script xmlns="http://www.w3.org/1999/xhtml"><![CDATA[
                                alert('Hello');
                                ]]></script>
                            </header>
                            <field name="invoices" string="Facturas para Enviar" widget="one2many"  colspan="4" nolabel="1">
                                <tree>
                                        <field name="inv_id"/>
                                        <field name="order"/>
                                </tree>
                            </field>
                    </form>
                </field>            
           </record>

I will replace javascript to show google maps, but i want to access data from that piece of code, can someone please light my way in achieving this?

 

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/14/14, 10:33 PM
Seen: 991 times
Last updated: 3/16/15, 8:10 AM