     @model.bind("change:currency_id", (model, name)->
       unless self.model.get("currency_id") == self.model.get("default_currency")
         self.openDialog()
+        self.setExchange()
+        self.setLabel()
       else
         self.model.set({exchange_rate: 1})
         self.setLabel()

    self = @
    $('#transaction_currency_id').bind 'change keyup', (event)->
      self.set({currency_id: $(this).val() * 1})
      console.log self.get("currency_id")
  # Sets the discount
  setDiscount: ->
    discount = @.get("subtotal") * @.get("discount")

  setExchange: ->
    rate = ($(@el).find("#exchange_rate").val() * 1).round(4)
    @model.set({exchange_rate: rate})
  # present dialog
  openDialog: ->
    @el.find("#exchange_rate").val(@model.get("exchange_rate"))
    @el.find("span.currency_symbol").html(@model.get("currency_symbol"))
    @el.dialog("open")
  closeDialog: ->
    @.setExchange()
    @el.dialog("close")

window.ExchangeRateDialog = ExchangeRateDialog

