Odoo Help


How can I display python data in tree view? [Odoo 8.0]

Juan Muñoz
on 10/22/15, 10:33 AM 1,630 views

Hi to all,

In python I have data that I get from an API.

The data looks like that: {19459,XXXXXX, BRAVUS,1}, {19459,XXXXXXX,AVANT,1}

How can I display this data in my own module but in another sub menu item and in a tree view?

Please I really need help.

Finger up to a useful replies. Thanks so much in advance! :)


EDIT: If you tell me how to send data to a bill it can also serve as a good answer. TYYY


Akhil P Sivan

--Akhil P Sivan--

| 5 4 7
Kochi, India
--Akhil P Sivan--

Interested in exploring Odoo both technically & functionality wise.

email-id : akhilpsivan01@gmail.com

Akhil P Sivan
On 10/22/15, 1:07 PM


One option is you can create a compute field on the model. And in the function you can have the code to get the data from API and extract the value you want and set that value to the compute field. You can that call that field in the tree view.

For eg:

class model_name(models.Model):
_inherit = 'model.name'

api_data = fields.Text(compute='_get_data', string="Data")

def _get_data(self):
for record in self:
.............. // code to get data from api

record.api_data = value

Hi Akhil, thanks so much for your reply. The problem is that I have a function called 'search_calls_by_customer' which calls API and saves data in array called 'clientDataAndBillIdArray'. I need that this array starts at 0 each time I call the API. So if I do a method called '_get_data' I can't access to this data array. Odoo had any method to create a new tree view line for each array object? I need create the tree line in the same function that calls API. Here me py code: client_name= fields.Char('Nombre cliente', readonly=True) client_cif= fields.Char('CIF cliente', readonly=True) bill_id= fields.Char('ID de factura', readonly=True) . . . for key2 in jData2: for key in billIdClientIdArray: if(key2[u'id']==key[u'client']): clientDataAndBillIdArray.append("{"+key2[u'id']+","+key2[u'cif']+","+key2[u'name']+","+key[u'id']+"}") self.client_name=key2[u'name'] I tried this, but only show the last name client of the array. Thank so much in advance! :)

Juan Muñoz
on 10/23/15, 11:59 AM

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: 10/22/15, 10:33 AM
Seen: 1630 times
Last updated: 10/22/15, 1:08 PM