This question has been flagged
1 Reply
2546 Views

I don't have much expirience with python, i need to change this code to return a list of suppliers.

def _get_main_product_supplier(self, cr, uid, product, context=None):       

        sellers = [(seller_info.sequence, seller_info)
                       for seller_info in product.seller_ids or []
                       if seller_info and isinstance(seller_info.sequence, (int, long))]
        return sellers and sellers[0][1] or False

Thanks in advance. 

Avatar
Discard
Best Answer

def _get_main_product_supplier(self, cr, uid, product, context=None):       

        sellers = [(seller_info.sequence, seller_info)
                       for seller_info in product.seller_ids or []
                       if seller_info and isinstance(seller_info.sequence, (int, long))]
        return sellers and [x[1] for x in sellers[0][1]] or False

This will return list of seller_info means instead of singel supplier it will return all.

Avatar
Discard

return sellers and [x[1] for x in sellers] or False