Class: SharedSupplier

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/shared_supplier.rb

Instance Method Summary collapse

Instance Method Details

#autofill_attributesObject

These set of attributes are used to autofill attributes of new supplier, when created by import from shared supplier feature.


13
14
15
16
# File 'app/models/shared_supplier.rb', line 13

def autofill_attributes
  whitelist = %w(name address phone fax email url delivery_days note)
  attributes.select { |k,_v| whitelist.include?(k) }
end

#shared_sync_methodsObject

return list of synchronisation methods available for this supplier


19
20
21
22
23
24
# File 'app/models/shared_supplier.rb', line 19

def shared_sync_methods
  methods = []
  methods += %w(all_available all_unavailable) if shared_articles.count < 200
  methods += %w(import) # perhaps, in the future: if shared_articles.count > 20
  methods
end