[FIX] sale : ValueError: Non-db action dictionaries should provide either multiple view modes or a single view mode and an optional view id.
bzr revid: mdi@tinyerp.com-20120828095941-kh1c5xh6osj93ck0
This commit is contained in:
parent
a1fa71621b
commit
417cd90249
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue