=== modified file 'stock/stock.py' --- stock/stock.py 2012-01-10 12:52:13 +0000 +++ stock/stock.py 2012-01-26 14:04:31 +0000 @@ -853,7 +853,9 @@ """ Changes picking state to done. @return: True """ - self.write(cr, uid, ids, {'state': 'done', 'date_done': time.strftime('%Y-%m-%d %H:%M:%S')}) + if context is None: + context={} + self.write(cr, uid, ids, {'state': 'done', 'date_done': context.get("inventory") and context.get("to_date") or time.strftime('%Y-%m-%d %H:%M:%S')}) return True def action_move(self, cr, uid, ids, context=None): @@ -2565,6 +2567,7 @@ move_obj = self.pool.get('stock.move') for inv in self.browse(cr, uid, ids, context=context): move_obj.action_done(cr, uid, [x.id for x in inv.move_ids], context=context) + move_obj.write(cr, uid, [x.id for x in inv.move_ids], {'date_expected': inv.date}) self.write(cr, uid, [inv.id], {'state':'done', 'date_done': time.strftime('%Y-%m-%d %H:%M:%S')}, context=context) return True @@ -2583,7 +2586,7 @@ move_ids = [] for line in inv.inventory_line_id: pid = line.product_id.id - product_context.update(uom=line.product_uom.id, date=inv.date, prodlot_id=line.prod_lot_id.id) + product_context.update(uom=line.product_uom.id, to_date=inv.date, prodlot_id=line.prod_lot_id.id, inventory=True) amount = location_obj._product_get(cr, uid, line.location_id.id, [pid], product_context)[pid] change = line.product_qty - amount