diff --git a/README.rst b/README.rst index 56450f78e..bacfede3a 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,14 @@ Quant merge =========== -This module allows to merge diferent quants if they meet some requirements. \ No newline at end of file +This module allows to merge diferent quants if they meet some requirements. + + +Credits +======= + +Contributors +------------ +* Oihane Crucelaegui +* Pedro M. Baeza +* Ana Juaristi \ No newline at end of file diff --git a/models/stock.py b/models/stock.py index c269edcb5..8e627413c 100644 --- a/models/stock.py +++ b/models/stock.py @@ -19,12 +19,13 @@ class StockQuant(models.Model): ('package_id', '=', self.package_id.id), ('location_id', '=', self.location_id.id), ('reservation_id', '=', False), - ('propagated_from_id', '=', False)]) + ('propagated_from_id', '=', self.propagated_from_id.id)]) qty = cost = 0 for quant in quants: - qty += quant.qty - cost += quant.cost - quant.unlink() + if self._get_latest_move(self) == self._get_latest_move(quant): + qty += quant.qty + cost += quant.cost + quant.unlink() self.cost += cost self.qty += qty