Explain intent of pending_quants and simplify loop condition

As suggested by @oihane
This commit is contained in:
Lionel Sausin
2015-11-26 16:21:20 +01:00
committed by Cyril Gaudin
parent 7dac9d65c2
commit 2105eacc3e

View File

@@ -24,10 +24,10 @@ class StockQuant(models.Model):
@api.multi
def merge_stock_quants(self):
pending_quants = self.filtered(lambda x: True)
for quant2merge in self:
if (quant2merge in pending_quants and
not quant2merge.reservation_id):
# Get a copy of the recorset
pending_quants = self.browse(self.ids)
for quant2merge in self.filtered(lambda x: not x.reservation_id):
if quant2merge in pending_quants:
quants = self.search(self._mergeable_domain())
cont = 1
cost = quant2merge.cost