client/skr/models/PaymentTerm.coffee in stockor-0.1.9 vs client/skr/models/PaymentTerm.coffee in stockor-0.2

- old
+ new

@@ -1,10 +1,23 @@ +SHARED_DATA = null +SHARED_COLLECTION = null + class Skr.Models.PaymentTerm extends Skr.Models.Base props: - id: {"type":"integer","required":true} - code: {"type":"string","required":true} - days: {"type":"integer","required":true,"default":"0"} - description: {"type":"string","required":true} + id: {type:"integer"} + code: {type:"code"} + days: {type:"integer", "default":"0"} + description: {type:"string"} discount_days: "integer" discount_amount:"string" + + @initialize: (data) -> + SHARED_DATA = data.payment_terms + + +Object.defineProperty Skr.Models.PaymentTerm, 'all', + get: -> + SHARED_COLLECTION ||= new Skr.Models.PaymentTerm.Collection( + SHARED_DATA, comparator: 'code' + )