Commit 695c942f by François C.

Fix purchase_compute_order error when a product is no more available for a supplier

parent dcf8a236
......@@ -22,6 +22,9 @@
##############################################################################
from openerp import models, api, fields
import logging
_logger = logging.getLogger(__name__)
class ProductProduct(models.Model):
......@@ -56,5 +59,9 @@ class ProductProduct(models.Model):
if not self.product_tmpl_id.seller_ids:
return False
valid_si = self._all_valid_psi()[0]
seq = min([si.sequence for si in valid_si])
return valid_si.filtered(lambda si, seq=seq: si.sequence == seq)
if len(valid_si) > 0:
seq = min([si.sequence for si in valid_si])
return valid_si.filtered(lambda si, seq=seq: si.sequence == seq)
else:
_logger.warning("No fisrt_valid_psi %s", str(self.product_tmpl_id))
return False
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment