Odoo Help


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.


How to create empty rows in table and fill it with objects one by one

on 3/14/16, 6:18 AM 300 views

Hi ! I want to create x empty rows which x in the length of a list of objects returned by webservice after that I want to fill records one by one and finally I want to display these objects in tree view. I tried to use : 

impo = self.env['product.impo']impo.create({'VIN': record.VIN,'Serial_No': record.Serial_No})

but I've got an error : impo = self.env['product.impo'] NameError: name 'self' is not defined

 and this is the code :

from openerp import models, fields

import suds

from suds.client import Client

from suds.transport.https import WindowsHttpAuthenticated

# Define our SUDS client for the Nav WS SOAP API

ntlm = WindowsHttpAuthenticated(username='xxxxx', password='xxxxx')

url = 'http://salma-pc:7047/xxxxxxxxxxxxx'

client = Client(url, transport=ntlm)

print (client) # this will return the methods and types available from the codeunit

result = client.service.ReadMultiple()#List of objects

taille = len(result.Stock_Vehicule)

class ProductImpo(models.Model):

       _name = 'product.impo'

       VIN = fields.Char(string="VIN")

       Serial_No = fields.Char(string="N° de série")

And the tree view :

<record id="product_impo_tree_view" model="ir.ui.view">

<field name="name">product.impo.tree</field>

<field name="model">product.impo</field>

<field name="arch" type="xml">

<tree string="Disponibilité">

<field name="VIN"/>

<field name="Serial_No"/>




so please help me, I am really blocked !

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)


Asked: 3/14/16, 6:18 AM
Seen: 300 times
Last updated: 3/14/16, 6:30 AM