[MERGE]
authorHarry (Open ERP) <hmo@tinyerp.com>
Thu, 4 Mar 2010 13:28:44 +0000 (18:58 +0530)
committerHarry (Open ERP) <hmo@tinyerp.com>
Thu, 4 Mar 2010 13:28:44 +0000 (18:58 +0530)
bzr revid: hmo@tinyerp.com-20100304132844-patzedhk0a71d5av

1  2 
addons/sale_crm/sale_crm_view.xml
addons/sale_crm/wizard/makesale.py

@@@ -9,7 -9,10 +9,8 @@@
          <field name="inherit_id" ref="crm.crm_case_form_view_oppor"/>
          <field name="arch" type="xml">
              <xpath expr="/form[@string='Opportunities']/group/button[@string='Schedule Call']" position="after">
-                 <button string="Quotation" icon="terp-sale" name="%(sale_crm_wizard)d" type="action"/> 
 -              <group colspan="7" col="7">
 -              <label colspan="6"  string=""/>
 -                      <button string="Convert to Quote" icon="terp-sale" name="%(sale_crm_wizard)d" type="action"/>
 -                </group>
++              <button string="Convert to Quote" icon="terp-sale" name="%(sale_crm_wizard)d" type="action"/>
++                <label colspan="6"  string=""/>
              </xpath>           
          </field>
      </record>
@@@ -130,16 -130,28 +130,31 @@@ class make_sale(wizard.interface)
  
          if data['form']['close']:
              case_obj.case_close(cr, uid, data['ids'])
-         value = {
-             'domain': str([('id', 'in', new_ids)]),
-             'view_type': 'form',
-             'view_mode': 'tree,form',
-             'res_model': 'sale.order',
-             'view_id': False,
-             'type': 'ir.actions.act_window',
-             'search_view_id': id['res_id']
-         }
++        
++        if not new_ids:
++            return {}
+             
+         if len(new_ids)<=1:
+             value = {
+                 'domain': str([('id', 'in', new_ids)]),
+                 'view_type': 'form',
+                 'view_mode': 'form',
+                 'res_model': 'sale.order',
+                 'view_id': False,
+                 'type': 'ir.actions.act_window',
+                 'res_id': new_ids and new_ids[0]
+             }
+         else:
+             value = {
+                 'domain': str([('id', 'in', new_ids)]),
+                 'view_type': 'form',
+                 'view_mode': 'tree,form',
+                 'res_model': 'sale.order',
+                 'view_id': False,
+                 'type': 'ir.actions.act_window',
+                 'res_id':new_ids
+                 }
+                 
          return value
  
      states = {