module Skr::Concerns::IsOrderLike::InstanceMethods

Public Instance Methods

customer=(cust) click to toggle source

Set's the customer. It also defaults the terms, addresses,and tax_exempt status to the customer's defaults @param cust [Customer] @return Customer

Calls superclass method
# File lib/skr/concerns/is_order_like.rb, line 13
def customer=(cust)
    super
    self.terms ||= cust.terms
    self.is_tax_exempt    = cust.is_tax_exempt        if     self.is_tax_exempt.nil?
    self.billing_address  = cust.billing_address.dup  unless self.billing_address.present?
    self.shipping_address = cust.shipping_address.dup unless self.shipping_address.present?
end

Protected Instance Methods

set_order_defaults() click to toggle source
# File lib/skr/concerns/is_order_like.rb, line 23
def set_order_defaults
    self.location ||= Location.default
    self.terms    ||= customer.terms if self.customer
    true
end