[FIX] stock_available: Some affectations

This commit is contained in:
Denis Roussel
2017-11-29 18:13:25 +01:00
committed by Florian da Costa
parent a5ca2e154a
commit 7b317ac5f7
2 changed files with 6 additions and 8 deletions

View File

@@ -19,10 +19,10 @@ class ProductProduct(models.Model):
def _compute_available_quantities_dict(self):
res = {}
for product in self:
res[product.id] = {}
res[product.id]['immediately_usable_qty'] = \
product.virtual_available
res[product.id]['potential_qty'] = 0.0
res[product.id] = {
'immediately_usable_qty': product.virtual_available,
'potential_qty': 0.0
}
return res
@api.multi
@@ -30,8 +30,7 @@ class ProductProduct(models.Model):
def _compute_available_quantities(self):
res = self._compute_available_quantities_dict()
for product in self:
data = res[product.id]
for key, value in data.iteritems():
for key, value in res[product.id].iteritems():
if hasattr(product, key):
product[key] = value

View File

@@ -16,8 +16,7 @@ class ProductTemplate(models.Model):
def _compute_available_quantities(self):
res = self._compute_available_quantities_dict()
for product in self:
data = res[product.id]
for key, value in data.iteritems():
for key, value in res[product.id].iteritems():
if key in product._fields:
product[key] = value