client/skr/models/SalesOrder.coffee in stockor-0.4.0 vs client/skr/models/SalesOrder.coffee in stockor-0.5.0
- old
+ new
@@ -25,11 +25,14 @@
mixins: [ 'PrintSupport', 'HasVisibleId' ]
# optional attributes from details view
session:
customer_code: {type:"string"}
+ customer_name: {type:"string"}
+ bill_addr_name: {type:"string"}
order_total: {type:"bigdec"}
+ num_lines: {type:"integer"}
derived:
total: deps: ['order_total'], fn: ->
@order_total or @lines.reduce( (t, l) ->
t.plus(l.total)
@@ -63,14 +66,12 @@
@unCacheDerived('total')
@unset('order_total')
onCustomerChange: ->
return if @customer.isProxy or not @isNew()
-
associations = ['billing_address', 'shipping_address']
for attr in ['terms_id']
@set(attr, @customer[attr])
-
@customer.withAssociations(associations).then =>
for name in associations
@[name].set(
_.omit( @customer[name].serialize(), 'id' )
)