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 can I display python data in tree view? [Odoo 8.0]

By
Juan Muñoz
on 10/22/15, 10:33 AM 754 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! :)

Juan.


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

1

Akhil P Sivan

--Akhil P Sivan--
3423
| 5 3 6
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

Hi,

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

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