Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @http.route('/felino/product', auth='public')
- def inv(self, **kw):
- http.request.cr.execute('select * from h_dbinv where count>1 ')
- data = http.request.cr.fetchall()
- objects= http.request.env['product.template']
- #product= http.request.env['product.template']
- attr_test= http.request.env['product.attribute'].browse([389])
- print(attr_test.value_ids.ids)
- for record in data:
- print(attr_test.value_ids.ids)
- px=[]
- attx=[]
- attx=list(map(int,record[6]))
- for data in record[5]:
- px.append((0,0,data))
- print(attx)
- print("****************************")
- productlist = {'id':record[0],'name':record[1],'list_price':record[3],'standard_price':record[2],
- 'lst_price':record[3],
- 'product_variant_ids':px,
- 'attribute_line_ids': [(0, 0, {
- 'attribute_id': 1,
- 'value_ids':[(6, 0,attx)],
- }),
- ]
- #attribute_value_ids,
- #'qty_availab
- }
- #productlist.update(pv)
- #print("==================================")
- #print(productlist)
- #print("==================================")
- try:
- objects.sudo().create(productlist)
- http.request.cr.commit()
- except:
- print("error")
- return http.request.render('felino.listing')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement