Odoo Help


How to pass a list of strings from python to xml and use it in java script inside of view?

on 9/14/14, 10:33 PM 1,743 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">
                                    <script xmlns="http://www.w3.org/1999/xhtml"><![CDATA[
                            <field name="invoices" string="Facturas para Enviar" widget="one2many"  colspan="4" nolabel="1">
                                        <field name="inv_id"/>
                                        <field name="order"/>

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?


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

1 follower(s)


Asked: 9/14/14, 10:33 PM
Seen: 1743 times
Last updated: 3/16/15, 8:10 AM