İçereği Atla
Menü
Bu soru işaretlendi
1 Cevapla
2867 Görünümler

in odoo 11

i applied a script for importing products list to my database all is fine until now, but when i check articles menu  in stock module or purchase i don't find any imported products even are in my database (i checked my db (product_template and product_product) all products exist)

script:

import csv
import psycopg2

conn_string = "dbname= 'db' user='vagrant' password='vagrant'"

conn = psycopg2.connect(conn_string)
cursor = conn.cursor()

reader = csv.reader(open('listArticles.csv', 'r'))

for row in reader:
print(row)
statement = "INSERT INTO product_template (name,default_code,list_price,type,categ_id,sale_ok,uom_id,uom_po_id,responsible_id,tracking,sale_line_warn) " \
"VALUES ('" +row[1]+"','" +(row[0])+"','" +(row[3])+"','" +(row[2])+"',1,True,1,1,1,'serial','no-message') RETURNING id"

cursor.execute(statement)
conn.commit()
templateid = cursor.fetchone()[0]

statement = "INSERT INTO product_product (product_tmpl_id,default_code,active) VALUES \
(" + str(templateid) + ",'" + row[0] + "',True)"

cursor.execute(statement)
conn.commit()
Avatar
Vazgeç
En İyi Yanıt

Hi,

Check and see whats the value in the field active, you  might not see the records as the active field might be set to False.

Go to Products view and select the Archived Filter and see,


Thanks

Avatar
Vazgeç
Üretici

Hi Niyas

yes i found the products but i want to know why are archived

In your scrypt set active field as True

Üretici

thank you

İlgili Gönderiler Cevaplar Görünümler Aktivite
1
Nis 25
724
2
Ağu 24
2301
1
Ağu 22
2414
0
Eyl 18
3158
1
Ağu 24
8129