This question has been flagged
1 Reply
13127 Views

please I want to open Return lines by python ? my code is 

res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'view_stock_return_picking_form')
             #raise osv.except_osv((res),())
             picking_id = self.browse(cr, uid, ids[0], context=context).picking_id.id
             #assert len(ids) == 1, 'This option should only be used for a single id at a time'
             return {
                'name': _('Return lines'),
                'view_type': 'form',
                'view_mode': 'form',
                'view_id': res and res[1] or False,
                'res_model': 'stock.return.picking',
                'src_model': "stock.picking",
                'type': 'ir.actions.act_window',
                'nodestroy': True,
                'target': 'current',
                'key2':"client_action_multi",
                'res_id': picking_id,
             }

but not open please help me for this issue thank you so much?

Avatar
Discard
Best Answer

hi,

try this:

res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'view_stock_return_picking_form')
res_id = res and res[1] or False
#raise osv.except_osv((res),())
picking_id = self.browse(cr, uid, ids[0], context=context).picking_id.id
#assert len(ids) == 1, 'This option should only be used for a single id at a time'
return {
        'name': _('Return lines'),
        'view_type': 'form',
        'view_mode': 'form',
        'view_id': [res_id],
        'res_model': 'stock.return.picking',
        'type': 'ir.actions.act_window',
        'target': 'current',
                'context':context
        }

Avatar
Discard