Skip to Content
Menu
This question has been flagged

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"/>

</tree>

</field>

</record>

so please help me, I am really blocked !

Avatar
Discard
Related Posts Replies Views Activity
1
Aug 24
26621
2
Sep 22
6856
2
Mar 20
3707
2
May 16
3115
2
Apr 23
85089