[IMP] Add context as a dictionary if it is none.
authorBhumi Thakkar (Open ERP) <bth@tinyerp.com>
Mon, 18 Feb 2013 08:53:40 +0000 (14:23 +0530)
committerBhumi Thakkar (Open ERP) <bth@tinyerp.com>
Mon, 18 Feb 2013 08:53:40 +0000 (14:23 +0530)
bzr revid: bth@tinyerp.com-20130218085340-qqnw8n27my6mji5m

addons/purchase/purchase.py
addons/purchase_requisition/purchase_requisition.py

index 6dc18f4..2a802b5 100644 (file)
@@ -248,6 +248,8 @@ class purchase_order(osv.osv):
     def create(self, cr, uid, vals, context=None):
         if vals.get('name','/')=='/':
             vals['name'] = self.pool.get('ir.sequence').get(cr, uid, 'purchase.order') or '/'
+        if not context:
+            context = {}
         context.update({ 'mail_create_nolog' : True })
         order =  super(purchase_order, self).create(cr, uid, vals, context=context)
         self.message_post(cr, uid, [order], body=_("RFQ <b>Created</b>"), context=context)
@@ -791,7 +793,9 @@ class purchase_order(osv.osv):
                 value.update(dict(key))
             order_data['order_line'] = [(0, 0, value) for value in order_data['order_line'].itervalues()]
 
-            # create the new order            
+            # create the new order
+            if not context:
+                context = {}
             context.update({ 'mail_create_nolog' : True })
             neworder_id = self.create(cr, uid, order_data)
             self.message_post(cr, uid, [neworder_id], body=_("RFQ <b>Created</b>"), context=context)
index 2536b2c..2c1b658 100644 (file)
@@ -132,6 +132,8 @@ class purchase_requisition(osv.osv):
             if supplier.id in filter(lambda x: x, [rfq.state <> 'cancel' and rfq.partner_id.id or None for rfq in requisition.purchase_ids]):
                  raise osv.except_osv(_('Warning!'), _('You have already one %s purchase order for this partner, you must cancel this purchase order to create a new quotation.') % rfq.state)
             location_id = requisition.warehouse_id.lot_input_id.id
+            if not context:
+                context = {}
             context.update({ 'mail_create_nolog' : True })
             purchase_id = purchase_order.create(cr, uid, {
                         'origin': requisition.name,