Adds the product for this loan to a 'product' field.

        Product is a MambuProduct object.

        cache argument allows to use AllMambuProducts singleton to
        retrieve the products. See mambuproduct.AllMambuProducts code
        and pydoc for further information.

        Returns the number of requests done to Mambu.

def setProduct(self, cache=False, *args, **kwargs):
        """Adds the product for this loan to a 'product' field.

        Product is a MambuProduct object.

        cache argument allows to use AllMambuProducts singleton to
        retrieve the products. See mambuproduct.AllMambuProducts code
        and pydoc for further information.

        Returns the number of requests done to Mambu.
        """
        if cache:
            try:
                prods = self.allmambuproductsclass(*args, **kwargs)
            except AttributeError as ae:
                from .mambuproduct import AllMambuProducts
                self.allmambuproductsclass = AllMambuProducts
                prods = self.allmambuproductsclass(*args, **kwargs)
            for prod in prods:
                if prod['encodedKey'] == self['productTypeKey']:
                    self['product'] = prod
            try:
                # asked for cache, but cache was originally empty
                prods.noinit
            except AttributeError:
                return 1
            return 0
        try:
            product = self.mambuproductclass(entid=self['productTypeKey'], *args, **kwargs)
        except AttributeError as ae:
            from .mambuproduct import MambuProduct
            self.mambuproductclass = MambuProduct
            product = self.mambuproductclass(entid=self['productTypeKey'], *args, **kwargs)

        self['product'] = product

        return 1