diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 80a9aaf87d5..cb690e8cc9e 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -550,10 +550,12 @@ class stock_quant(osv.osv): """ solving_quant = quant dom = [('qty', '<', 0)] + prod = quant.product_id.id if quant.lot_id: dom += [('lot_id', '=', quant.lot_id.id)] dom += [('owner_id', '=', quant.owner_id.id)] dom += [('package_id', '=', quant.package_id.id)] + dom += [('id', '!=', quant.propagated_from_id.id)] quants = self.quants_get(cr, uid, quant.location_id, quant.product_id, quant.qty, dom, context=context) product_uom_rounding = quant.product_id.uom_id.rounding for quant_neg, qty in quants: @@ -577,6 +579,8 @@ class stock_quant(osv.osv): remaining_to_solve_quant_ids = self.search(cr, uid, [('propagated_from_id', '=', quant_neg.id), ('id', 'not in', solved_quant_ids)], context=context) if remaining_to_solve_quant_ids: self.write(cr, SUPERUSER_ID, remaining_to_solve_quant_ids, {'propagated_from_id': remaining_neg_quant.id}, context=context) + if solving_quant.propagated_from_id: + self.write(cr, uid, solved_quant_ids, {'propagated_from_id': solving_quant.propagated_from_id.id}) #delete the reconciled quants, as it is replaced by the solved quants self.unlink(cr, SUPERUSER_ID, [quant_neg.id], context=context) #price update + accounting entries adjustments @@ -586,6 +590,8 @@ class stock_quant(osv.osv): self.unlink(cr, SUPERUSER_ID, [solving_quant.id], context=context) solving_quant = remaining_solving_quant + + def _price_update(self, cr, uid, ids, newprice, context=None): self.write(cr, SUPERUSER_ID, ids, {'cost': newprice}, context=context)