def set_currency(cls): """Sets the currency for current session. A change in the currency should reset the cart if the currency of the cart is not the same as the one here """ Cart = Pool().get('nereid.cart') rv = super(Website, cls).set_currency() # TODO: If currency has changed drop the cart # This behaviour needs serious improvement. Probably create a new cart # with all items in this cart and then drop this one cart = Cart.open_cart() if cart.sale and cart.sale.currency.id != session['currency']: Cart.clear_cart() return rv