Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
4963 มุมมอง

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 !

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
ส.ค. 24
31779
2
ก.ย. 22
7836
2
มี.ค. 20
4644
can't restore .sql database why? help ?? แก้ไขแล้ว
2
พ.ค. 16
3957
write and create function แก้ไขแล้ว
2
มิ.ย. 25
89213