Odoo Help


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

on 3/14/16, 6:18 AM 716 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 !

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: 3/14/16, 6:18 AM
Seen: 716 times
Last updated: 3/14/16, 6:30 AM