##= require_self ##= require ./Payment class Skr.Screens.Invoice extends Skr.Screens.Base syncOptions: with: [ 'with_details' ] include: [ 'sales_order', 'billing_address', 'shipping_address', 'lines', 'payments' ] dataObjects: invoice: -> @loadOrCreateModel({ syncOptions: @syncOptions, klass: Skr.Models.Invoice, prop: 'invoice', attribute: 'visible_id' }) getInitialState: -> commands: new Skr.Screens.Commands(this, modelName: 'invoice', print: true) setSalesOrder: (so) -> @invoice.setFromSalesOrder(so) showPayment: -> Skr.Screens.Invoice.Payment.display(@context.viewport, @invoice) PaymentButton: -> return null if @invoice.isNew() Payment shouldSaveLinesImmediately: -> not @invoice.isNew() render: -> <@PaymentButton />