oI select same field from mo.queue and I want save it into the procurement.order table
My code looks as follows:
def action_ship_create(self, cr, uid, ids, id_queue, context=None):
queue_obj = self.pool.get('mo.queue'). browse (cr, uid, id_queue, context=context)
mo_name = queue_obj.name
query_param = (mo_name)
cr.execute("select origin,create_date,product_uos_qty,product_qty,name,city from mo_queue",(query_param,))
ads = cr.fetchone()
name = ads and ads [0] or None
print "======================"
print name
print "======================"
val = { 'origin': name,
}
print "======================"
print val
print "======================"
return {'value': val }
proc_id = self.pool.get('procurement.order').create(cr, uid, {
'origin':origin,
})
proc_ids.append(proc_id)
The result of the print is:
print name = SO013
print val = {'origin': u'SO013'}
But the data is not inserted into the procurement.order table.
your code me look like this after return statement is does not executes anything do put cdeo before return and your code need lot of tuning, like do not use SQL Injection it is not good idea.
Hope this will help you let me know i I am missing.
Thank You