 
     derived:
         total: deps: ['invoice_total'], fn: ->
-            @order_total or @lines.reduce( (t, l) ->
+            @invoice_total or @lines.reduce( (t, l) ->
                 t.plus(l.total)
             , _.bigDecimal(0))
 

        shipping_address: { model: "Address" }
        sales_order:      { model: "SalesOrder",  readOnly:true }
        customer:         { model: "Customer",    readOnly:true }
        location:         { model: "Location",    readOnly:true }
        terms:            { model: "PaymentTerm", readOnly:true }
        pick_ticket:      { model: "PickTicket",  readOnly:true }
        lines:            { collection: "InvLine", inverse: 'invoice'  }

        id:                 {type:"integer", required:true}
        visible_id:         {type:"integer", required:true}
        terms_id:           {type:"integer", required:true}
        customer_id:        {type:"integer", required:true, default: ->
            Skr.Models.Location.default()?.id
        }
        location_id:        {type:"integer", required:true}
        sales_order_id:     "integer"
        pick_ticket_id:     "integer"
