diff --git a/addons/sale_stock/stock.py b/addons/sale_stock/stock.py
index 93acf8579f5..034b7d43403 100644
--- a/addons/sale_stock/stock.py
+++ b/addons/sale_stock/stock.py
@@ -20,6 +20,7 @@
##############################################################################
from openerp.osv import fields, osv
+from openerp.tools.translate import _
class stock_move(osv.osv):
_inherit = 'stock.move'
@@ -41,7 +42,19 @@ class stock_picking(osv.osv):
_defaults = {
'sale_id': False
}
-
+
+ def action_done(self, cr, uid, ids, context=None):
+ """Changes picking state to done.
+
+ This method is called at the end of the workflow by the activity "done".
+ @return: True
+ """
+ for record in self.browse(cr, uid, ids, context):
+ if record.type == "out" and record.sale_id:
+ for sale in self.pool.get('sale.order').browse(cr, uid, [record.sale_id.id], context):
+ sale.message_post(body=_("Products Delivered"))
+ return super(stock_picking, self).action_done(cr, uid, ids, context=context)
+
def get_currency_id(self, cursor, user, picking):
if picking.sale_id:
return picking.sale_id.pricelist_id.currency_id.id
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index fb38d5d0abd..86a462e74b6 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -874,14 +874,10 @@ class stock_picking(osv.osv):
This method is called at the end of the workflow by the activity "done".
@return: True
- """
+ """
self.write(cr, uid, ids, {'state': 'done', 'date_done': time.strftime('%Y-%m-%d %H:%M:%S')})
- for record in self.browse(cr, uid, ids, context):
- if record.type == "out":
- for sale in self.pool.get('sale.order').browse(cr, uid, [record.sale_id.id], context):
- sale.message_post(body=_("Products Delivered"))
return True
-
+
def action_move(self, cr, uid, ids, context=None):
"""Process the Stock Moves of the Picking