[IMP] stock: add if condition to check context
authorAjay Chauhan (OpenERP) <cha@tinyerp.com>
Mon, 24 Sep 2012 05:39:44 +0000 (11:09 +0530)
committerAjay Chauhan (OpenERP) <cha@tinyerp.com>
Mon, 24 Sep 2012 05:39:44 +0000 (11:09 +0530)
bzr revid: cha@tinyerp.com-20120924053944-l2mwyuijvzr9ot0w

addons/stock/stock.py

index 295cee2..96cabbf 100644 (file)
@@ -1393,24 +1393,28 @@ class stock_picking(osv.osv):
         return type_dict.get(type, 'Stock picking')
 
     def create_send_note(self, cr, uid, ids, context=None):
-        context = context or {}
+        if context is None:
+            context = {}
         self._get_thread_model(cr, uid, ids, context=context)
         for obj in self.browse(cr, uid, ids, context=context):
             self.message_post(cr, uid, [obj.id], body=_("%s has been <b>created</b>.") % (self._get_document_type(obj.type)), context=context)
 
     def confirm_send_note(self, cr, uid, ids, context=None):
-        context = context or {}
+        if context is None:
+            context = {}
         self._get_thread_model(cr, uid, ids, context=context)
         for obj in self.browse(cr, uid, ids, context=context):
             self.message_post(cr, uid, [obj.id], body=_("%s has been <b>confirmed</b>.") % (self._get_document_type(obj.type)), context=context)
 
     def scrap_send_note(self, cr, uid, ids, quantity, uom, name, context=None):
-        context = context or {}
+        if context is None:
+            context = {}
         self._get_thread_model(cr, uid, ids, context=context)
         return self.message_post(cr, uid, ids, body= _("%s %s %s has been <b>moved to</b> scrap.") % (quantity, uom, name), context=context)
 
     def back_order_send_note(self, cr, uid, ids, back_name, context=None):
-        context = context or {}
+        if context is None:
+            context = {}
         self._get_thread_model(cr, uid, ids, context=context)
         return self.message_post(cr, uid, ids, body=_("Back order <em>%s</em> has been <b>created</b>.") % (back_name), context=context)
 
@@ -1420,13 +1424,15 @@ class stock_picking(osv.osv):
                 'in': 'received',
                 'internal': 'moved',
         }
-        context = context or {}
+        if context is None:
+            context = {}
         self._get_thread_model(cr, uid, ids, context=context)
         for obj in self.browse(cr, uid, ids, context=context):
             self.message_post(cr, uid, [obj.id], body=_("Products have been <b>%s</b>.") % (type_dict.get(obj.type, 'move done')), context=context)
 
     def ship_cancel_send_note(self, cr, uid, ids, context=None):
-        context = context or {}
+        if context is None:
+            context = {}
         self._get_thread_model(cr, uid, ids, context=context)
         for obj in self.browse(cr, uid, ids, context=context):
             self.message_post(cr, uid, [obj.id], body=_("%s has been <b>cancelled</b>.") % (self._get_document_type(obj.type)), context=context)