This is the whole code I am using, I guess I am mixing old and new API. I would like to use new API.
It is a controller. It is activated by clicking a button in stock_picking, retrieves current stock_picking and I am looking to retrieve all stock moves associated to that stock_picking.
class Binary(http.Controller):
@http.route('/web/binary/item_labels', type='http', auth="user")
@serialize_exception
def download_item_labels(self, id, **kw):
cr, uid, context = request.cr, request.uid, request.context
env = Env(cr, uid, context)
Model = request.registry['stock.picking']
fields = [ 'id' ]
current_stock_picking = Model.read(cr, uid, [int(id)], fields, context)[0]['id']
print "download_item_labels"
print "current_stock_picking"
print current_stock_picking
moves = env['stock.move'].search([('picking_id','=',current_stock_picking)])
print "moves"
print moves
for move in moves:
print "move"
print move
print move.id
#print move.source <---- THIS FAILS!
Any help / comments are truly appreciated,