[FIX] sale : ValueError: Non-db action dictionaries should provide either multiple...
authorDivyesh Makwana (Open ERP) <mdi@tinyerp.com>
Tue, 28 Aug 2012 09:59:41 +0000 (15:29 +0530)
committerDivyesh Makwana (Open ERP) <mdi@tinyerp.com>
Tue, 28 Aug 2012 09:59:41 +0000 (15:29 +0530)
bzr revid: mdi@tinyerp.com-20120828095941-kh1c5xh6osj93ck0

addons/sale/sale.py

index c525ba0..e99c7d3 100644 (file)
@@ -553,33 +553,22 @@ class sale_order(osv.osv):
         This function returns an action that display existing delivery orders of given sale order ids. It can either be a in a list or in a form view, if there is only one delivery order to show.
         '''
         mod_obj = self.pool.get('ir.model.data')
-        result = {
-            'name': _('Delivery Order'),
-            'view_type': 'form',
-            'res_model': 'stock.picking',
-            'context': "{'type':'out'}",
-            'type': 'ir.actions.act_window',
-            'nodestroy': True,
-            'target': 'current',
-        }
+        act_obj = self.pool.get('ir.actions.act_window')
+
+        result = mod_obj.get_object_reference(cr, uid, 'stock', 'action_picking_tree')
+        id = result and result[1] or False
+        result = act_obj.read(cr, uid, [id], context=context)[0]
         #compute the number of delivery orders to display
         pick_ids = []
         for so in self.browse(cr, uid, ids, context=context):
             pick_ids += [picking.id for picking in so.picking_ids]
         #choose the view_mode accordingly
         if len(pick_ids) > 1:
-            res = mod_obj.get_object_reference(cr, uid, 'stock', 'view_picking_out_tree')
-            result.update({
-                'view_mode': 'tree,form',
-                'res_id': pick_ids or False
-            })
+            result['domain'] = "[('id','in',["+','.join(map(str, pick_ids))+"])]"
         else:
             res = mod_obj.get_object_reference(cr, uid, 'stock', 'view_picking_out_form')
-            result.update({
-                'view_mode': 'form',
-                'res_id': pick_ids and pick_ids[0] or False,
-            })
-        result.update(view_id = res and res[1] or False)
+            result['views'] = [(res and res[1] or False, 'form')]
+            result['res_id'] = pick_ids and pick_ids[0] or False
         return result
 
     def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed', 'done', 'exception'], date_inv = False, context=None):