stockor 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +13 -13
- data/client/skr/Extension.coffee +12 -2
- data/client/skr/models/GlAccount.coffee +12 -1
- data/client/skr/models/PurchaseOrder.coffee +6 -1
- data/client/skr/models/SalesOrder.coffee +7 -1
- data/client/skr/models/Sku.coffee +6 -2
- data/client/skr/models/mixins/VisibleID.coffee +5 -0
- data/client/skr/screens/customer-maint/CustomerMaint.coffee +1 -1
- data/client/skr/screens/mixins/index.js +0 -1
- data/client/skr/screens/sales-order/SalesOrder.coffee +30 -0
- data/client/skr/screens/sales-order/index.js +5 -0
- data/client/skr/screens/sales-order/index.scss +8 -0
- data/client/skr/screens/sales-order/layout.html +30 -0
- data/client/skr/screens/sku-maint/SkuMaint.coffee +7 -2
- data/client/skr/screens/sku-maint/layout.html +4 -0
- data/client/skr/screens/vendor-maint/VendorMaint.coffee +1 -1
- data/client/skr/styles.scss +1 -0
- data/config/screens.rb +22 -6
- data/db/migrate/20140322223912_create_skr_sales_orders.rb +1 -1
- data/db/migrate/20140327202102_create_skr_purchase_orders.rb +1 -1
- data/db/migrate/20140330232810_create_skr_sku_qty_details_view.rb +2 -2
- data/db/schema.sql +71 -71
- data/db/seed.rb +4 -3
- data/lib/skr/access_roles.rb +14 -4
- data/lib/skr/concerns/state_machine.rb +7 -2
- data/lib/skr/extension.rb +10 -0
- data/lib/skr/model.rb +34 -1
- data/lib/skr/models/address.rb +4 -4
- data/lib/skr/models/customer.rb +1 -1
- data/lib/skr/models/purchase_order.rb +6 -1
- data/lib/skr/models/sales_order.rb +7 -1
- data/lib/skr/version.rb +1 -1
- data/lib/skr.rb +1 -2
- data/spec/fixtures/skr/address.yml +8 -0
- data/spec/fixtures/skr/customer.yml +7 -0
- data/spec/fixtures/skr/gl_account.yml +41 -0
- data/spec/fixtures/skr/location.yml +5 -0
- data/spec/fixtures/skr/payment_term.yml +4 -0
- data/spec/server/models/{address.rb → address_spec.rb} +2 -2
- data/spec/server/models/{customer.rb → customer_spec.rb} +2 -2
- data/spec/server/models/{gl_account.rb → gl_account_spec.rb} +2 -2
- data/spec/server/models/{gl_manual_entry.rb → gl_manual_entry_spec.rb} +2 -2
- data/spec/server/models/{gl_period.rb → gl_period_spec.rb} +2 -2
- data/spec/server/models/{gl_posting.rb → gl_posting_spec.rb} +2 -2
- data/spec/server/models/{gl_transaction.rb → gl_transaction_spec.rb} +2 -2
- data/spec/server/models/{ia_line.rb → ia_line_spec.rb} +2 -2
- data/spec/server/models/{ia_reason.rb → ia_reason_spec.rb} +2 -2
- data/spec/server/models/{inv_line.rb → inv_line_spec.rb} +2 -2
- data/spec/server/models/{inventory_adjustment.rb → inventory_adjustment_spec.rb} +2 -2
- data/spec/server/models/{invoice.rb → invoice_spec.rb} +2 -2
- data/spec/server/models/{location.rb → location_spec.rb} +2 -2
- data/spec/server/models/{payment_term.rb → payment_term_spec.rb} +2 -2
- data/spec/server/models/{pick_ticket.rb → pick_ticket_spec.rb} +2 -2
- data/spec/server/models/{po_line.rb → po_line_spec.rb} +2 -2
- data/spec/server/models/{po_receipt.rb → po_receipt_spec.rb} +2 -2
- data/spec/server/models/{por_line.rb → por_line_spec.rb} +2 -2
- data/spec/server/models/{pt_line.rb → pt_line_spec.rb} +2 -2
- data/spec/server/models/{purchase_order.rb → purchase_order_spec.rb} +2 -2
- data/spec/server/models/sales_order_spec.rb +22 -0
- data/spec/server/models/{sku_loc.rb → sku_loc_spec.rb} +2 -2
- data/spec/server/models/{sku.rb → sku_spec.rb} +2 -2
- data/spec/server/models/{sku_tran.rb → sku_tran_spec.rb} +2 -2
- data/spec/server/models/{sku_vendor.rb → sku_vendor_spec.rb} +2 -2
- data/spec/server/models/{so_line.rb → so_line_spec.rb} +2 -2
- data/spec/server/models/{uom.rb → uom_spec.rb} +2 -2
- data/spec/server/models/{vendor.rb → vendor_spec.rb} +2 -2
- data/spec/server/models/{vo_line.rb → vo_line_spec.rb} +2 -2
- data/spec/server/models/{voucher.rb → voucher_spec.rb} +2 -2
- data/spec/server/spec_helper.rb +42 -0
- data/spec/skr/models/CustomerSpec.coffee +4 -3
- data/spec/skr/models/SalesOrderSpec.coffee +4 -2
- data/spec/skr/screens/sales-order/SalesOrderSpec.coffee +5 -0
- metadata +40 -36
- data/client/skr/screens/mixins/Editing.coffee +0 -32
- data/lib/skr/concerns/code_identifier.rb +0 -43
- data/log/test.log +0 -0
- data/spec/server/models/sales_order.rb +0 -10
- /data/spec/server/models/{spec_helper.rb → spec_helper_spec.rb} +0 -0
@@ -0,0 +1,22 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
|
3
|
+
class SalesOrderSpec < Skr::TestCase
|
4
|
+
|
5
|
+
|
6
|
+
it "can be saved" do
|
7
|
+
user = Lanes::User.find_by(login:'admin')
|
8
|
+
model = SalesOrder.from_attribute_data({
|
9
|
+
terms_id: skr_payment_term(:cashy).id,
|
10
|
+
location_id: skr_location(:default).id,
|
11
|
+
customer_id: skr_customer(:billy).id,
|
12
|
+
billing_address: {
|
13
|
+
name: "Billy"
|
14
|
+
},
|
15
|
+
shipping_address:{
|
16
|
+
name: "Billy"
|
17
|
+
}
|
18
|
+
}, user)
|
19
|
+
assert model.save
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require_relative '../../lib/stockor'
|
2
|
+
require 'lanes/spec_helper'
|
3
|
+
|
4
|
+
class Lanes::TestCase
|
5
|
+
include Skr
|
6
|
+
end
|
7
|
+
|
8
|
+
module Skr
|
9
|
+
|
10
|
+
# Add more helper methods to be used by all tests here...
|
11
|
+
|
12
|
+
class TestCase < Lanes::TestCase
|
13
|
+
include Skr
|
14
|
+
end
|
15
|
+
|
16
|
+
class ApiTestCase < Lanes::ApiTestCase
|
17
|
+
include Skr
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
module StockorFixtureTestPatches
|
23
|
+
extend ActiveSupport::Concern
|
24
|
+
|
25
|
+
included do
|
26
|
+
alias_method_chain :table_rows, :custom_autoset_stockor_fields
|
27
|
+
end
|
28
|
+
|
29
|
+
def table_rows_with_custom_autoset_stockor_fields
|
30
|
+
results = table_rows_without_custom_autoset_stockor_fields
|
31
|
+
if model_class && model_class < ActiveRecord::Base
|
32
|
+
results[ table_name ].each do | row |
|
33
|
+
if self['hash_code'].blank? && model_class.column_names.include?('hash_code')
|
34
|
+
row['hash_code'] = Lanes::Strings.random(8)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
results
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
ActiveRecord::FixtureSet.send :include, StockorFixtureTestPatches
|
@@ -1,7 +1,7 @@
|
|
1
1
|
describe "Skr.Models.Customer", ->
|
2
2
|
|
3
3
|
beforeEach ->
|
4
|
-
Lanes.
|
4
|
+
Lanes.Test.ModelSaver.setUser('admin')
|
5
5
|
|
6
6
|
it "can be instantiated", ->
|
7
7
|
model = new Skr.Models.Customer()
|
@@ -10,16 +10,17 @@ describe "Skr.Models.Customer", ->
|
|
10
10
|
|
11
11
|
it "sends failure messages when code isn't set", (done)->
|
12
12
|
model = new Skr.Models.Customer()
|
13
|
-
Lanes.
|
13
|
+
Lanes.Test.ModelSaver.perform(model, done).then (save)->
|
14
14
|
expect(save.error).toHaveBeenCalled()
|
15
15
|
expect(model.errors?.code).toContain("blank")
|
16
16
|
|
17
17
|
it "saves when fields are set", (done)->
|
18
18
|
model = new Skr.Models.Customer(
|
19
19
|
code: "SPECTEST", name: "A Spec Test Customer"
|
20
|
+
terms_id: 1,
|
20
21
|
billing_address: { name: "Billing Address" }
|
21
22
|
shipping_address: { name: "Shipping Address" }
|
22
23
|
)
|
23
|
-
Lanes.
|
24
|
+
Lanes.Test.ModelSaver.perform(model, done).then (save)->
|
24
25
|
expect(save.error).not.toHaveBeenCalled()
|
25
26
|
expect(model.errors).toBeNull()
|
@@ -1,5 +1,7 @@
|
|
1
1
|
describe "Skr.Models.SalesOrder", ->
|
2
2
|
|
3
|
-
it "
|
3
|
+
it "must have a customer to save", (done)->
|
4
4
|
model = new Skr.Models.SalesOrder()
|
5
|
-
|
5
|
+
Lanes.Test.ModelSaver.perform(model, done).then (save)->
|
6
|
+
expect(save.error).toHaveBeenCalled()
|
7
|
+
expect(model.errors.customer).toContain("is not set")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stockor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Stitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aasm
|
@@ -176,6 +176,7 @@ files:
|
|
176
176
|
- client/skr/models/VoLine.coffee
|
177
177
|
- client/skr/models/Voucher.coffee
|
178
178
|
- client/skr/models/mixins/CodeField.coffee
|
179
|
+
- client/skr/models/mixins/VisibleID.coffee
|
179
180
|
- client/skr/screens/.gitkeep
|
180
181
|
- client/skr/screens/Base.coffee
|
181
182
|
- client/skr/screens/base/index.js
|
@@ -185,8 +186,11 @@ files:
|
|
185
186
|
- client/skr/screens/customer-maint/index.js
|
186
187
|
- client/skr/screens/customer-maint/index.scss
|
187
188
|
- client/skr/screens/customer-maint/layout.html
|
188
|
-
- client/skr/screens/mixins/Editing.coffee
|
189
189
|
- client/skr/screens/mixins/index.js
|
190
|
+
- client/skr/screens/sales-order/SalesOrder.coffee
|
191
|
+
- client/skr/screens/sales-order/index.js
|
192
|
+
- client/skr/screens/sales-order/index.scss
|
193
|
+
- client/skr/screens/sales-order/layout.html
|
190
194
|
- client/skr/screens/sku-maint/SkuMaint.coffee
|
191
195
|
- client/skr/screens/sku-maint/index.js
|
192
196
|
- client/skr/screens/sku-maint/index.scss
|
@@ -246,7 +250,6 @@ files:
|
|
246
250
|
- lib/skr.rb
|
247
251
|
- lib/skr/access_roles.rb
|
248
252
|
- lib/skr/concerns/acts_as_uom.rb
|
249
|
-
- lib/skr/concerns/code_identifier.rb
|
250
253
|
- lib/skr/concerns/gl_tran_extensions.rb
|
251
254
|
- lib/skr/concerns/has_gl_transaction.rb
|
252
255
|
- lib/skr/concerns/has_sku_loc_lines.rb
|
@@ -301,7 +304,6 @@ files:
|
|
301
304
|
- lib/skr/standard_pricing_provider.rb
|
302
305
|
- lib/skr/version.rb
|
303
306
|
- lib/stockor.rb
|
304
|
-
- log/test.log
|
305
307
|
- spec/fixtures/skr/address.yml
|
306
308
|
- spec/fixtures/skr/customer.yml
|
307
309
|
- spec/fixtures/skr/gl_account.yml
|
@@ -332,37 +334,38 @@ files:
|
|
332
334
|
- spec/fixtures/skr/vendor.yml
|
333
335
|
- spec/fixtures/skr/vo_line.yml
|
334
336
|
- spec/fixtures/skr/voucher.yml
|
335
|
-
- spec/server/models/
|
336
|
-
- spec/server/models/
|
337
|
-
- spec/server/models/
|
338
|
-
- spec/server/models/
|
339
|
-
- spec/server/models/
|
340
|
-
- spec/server/models/
|
341
|
-
- spec/server/models/
|
342
|
-
- spec/server/models/
|
343
|
-
- spec/server/models/
|
344
|
-
- spec/server/models/
|
345
|
-
- spec/server/models/
|
346
|
-
- spec/server/models/
|
347
|
-
- spec/server/models/
|
348
|
-
- spec/server/models/
|
349
|
-
- spec/server/models/
|
350
|
-
- spec/server/models/
|
351
|
-
- spec/server/models/
|
352
|
-
- spec/server/models/
|
353
|
-
- spec/server/models/
|
354
|
-
- spec/server/models/
|
355
|
-
- spec/server/models/
|
356
|
-
- spec/server/models/
|
357
|
-
- spec/server/models/
|
358
|
-
- spec/server/models/
|
359
|
-
- spec/server/models/
|
360
|
-
- spec/server/models/
|
361
|
-
- spec/server/models/
|
362
|
-
- spec/server/models/
|
363
|
-
- spec/server/models/
|
364
|
-
- spec/server/models/
|
365
|
-
- spec/server/models/
|
337
|
+
- spec/server/models/address_spec.rb
|
338
|
+
- spec/server/models/customer_spec.rb
|
339
|
+
- spec/server/models/gl_account_spec.rb
|
340
|
+
- spec/server/models/gl_manual_entry_spec.rb
|
341
|
+
- spec/server/models/gl_period_spec.rb
|
342
|
+
- spec/server/models/gl_posting_spec.rb
|
343
|
+
- spec/server/models/gl_transaction_spec.rb
|
344
|
+
- spec/server/models/ia_line_spec.rb
|
345
|
+
- spec/server/models/ia_reason_spec.rb
|
346
|
+
- spec/server/models/inv_line_spec.rb
|
347
|
+
- spec/server/models/inventory_adjustment_spec.rb
|
348
|
+
- spec/server/models/invoice_spec.rb
|
349
|
+
- spec/server/models/location_spec.rb
|
350
|
+
- spec/server/models/payment_term_spec.rb
|
351
|
+
- spec/server/models/pick_ticket_spec.rb
|
352
|
+
- spec/server/models/po_line_spec.rb
|
353
|
+
- spec/server/models/po_receipt_spec.rb
|
354
|
+
- spec/server/models/por_line_spec.rb
|
355
|
+
- spec/server/models/pt_line_spec.rb
|
356
|
+
- spec/server/models/purchase_order_spec.rb
|
357
|
+
- spec/server/models/sales_order_spec.rb
|
358
|
+
- spec/server/models/sku_loc_spec.rb
|
359
|
+
- spec/server/models/sku_spec.rb
|
360
|
+
- spec/server/models/sku_tran_spec.rb
|
361
|
+
- spec/server/models/sku_vendor_spec.rb
|
362
|
+
- spec/server/models/so_line_spec.rb
|
363
|
+
- spec/server/models/spec_helper_spec.rb
|
364
|
+
- spec/server/models/uom_spec.rb
|
365
|
+
- spec/server/models/vendor_spec.rb
|
366
|
+
- spec/server/models/vo_line_spec.rb
|
367
|
+
- spec/server/models/voucher_spec.rb
|
368
|
+
- spec/server/spec_helper.rb
|
366
369
|
- spec/skr/concerns/code_identifier_spec.rb
|
367
370
|
- spec/skr/models/AddressSpec.coffee
|
368
371
|
- spec/skr/models/CustomerSpec.coffee
|
@@ -396,6 +399,7 @@ files:
|
|
396
399
|
- spec/skr/models/VoucherSpec.coffee
|
397
400
|
- spec/skr/screens/Base.coffee
|
398
401
|
- spec/skr/screens/CustomerMaint.coffee
|
402
|
+
- spec/skr/screens/sales-order/SalesOrderSpec.coffee
|
399
403
|
- spec/skr/screens/sku-maint/SkuMaintSpec.coffee
|
400
404
|
- spec/skr/screens/vendor-maint/VendorMaintSpec.coffee
|
401
405
|
- stockor.gemspec
|
@@ -1,32 +0,0 @@
|
|
1
|
-
Skr.Screens.Mixins.Editing = {
|
2
|
-
|
3
|
-
included: (klass)->
|
4
|
-
klass::domEvents ||= {}
|
5
|
-
_.extend(klass::domEvents,{
|
6
|
-
'click .btn.save': 'saveRecord'
|
7
|
-
'click .btn.reset': 'resetRecord'
|
8
|
-
'display-record': 'onRecordTrigger'
|
9
|
-
})
|
10
|
-
|
11
|
-
klass::subviews ||= {}
|
12
|
-
_.extend(klass::subviews,{
|
13
|
-
finder: {
|
14
|
-
component: 'RecordFinder'
|
15
|
-
options: 'finderOptions'
|
16
|
-
model: 'model'
|
17
|
-
}
|
18
|
-
})
|
19
|
-
|
20
|
-
onRecordTrigger: (ev, model)->
|
21
|
-
this.model = model
|
22
|
-
|
23
|
-
resetRecord: ->
|
24
|
-
options = _.result(this,'finderOptions')
|
25
|
-
this.model = new options.modelClass
|
26
|
-
|
27
|
-
saveRecord: ->
|
28
|
-
Lanes.Views.SaveNotify(this, include:['billing_address','shipping_address','terms'])
|
29
|
-
|
30
|
-
initialize: ->
|
31
|
-
this.resetRecord()
|
32
|
-
}
|
@@ -1,43 +0,0 @@
|
|
1
|
-
module Skr
|
2
|
-
module Concerns
|
3
|
-
|
4
|
-
# @see ClassMethods
|
5
|
-
module CodeIdentifier
|
6
|
-
|
7
|
-
extend ActiveSupport::Concern
|
8
|
-
|
9
|
-
# ### Code Identifier Concern
|
10
|
-
# This adds the {#has_code_identifier} class method
|
11
|
-
module ClassMethods
|
12
|
-
|
13
|
-
# A 2-10 character string that identifies an entity, such as a Customer, Vendor, or SKU.
|
14
|
-
# The code is often assigned by the user, but may also
|
15
|
-
# be auto-generated by {Skr::Strings.code_identifier}
|
16
|
-
#
|
17
|
-
# @param max_length [Integer] how long the code is allowed to be
|
18
|
-
# @param from [Symbol], method to call for a string to base the code upon
|
19
|
-
def has_code_identifier( from: nil, max_length: 10 )
|
20
|
-
|
21
|
-
validates :code, :length=>2..max_length, :presence=>true, :uniqueness=>true
|
22
|
-
|
23
|
-
alias_attribute :record_identifier, :code
|
24
|
-
|
25
|
-
if from
|
26
|
-
before_validation(:on=>:create) do
|
27
|
-
source = self[from]
|
28
|
-
unless source.blank?
|
29
|
-
self.code ||= Skr::Strings.code_identifier( source, length:max_length )
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
before_validation do
|
35
|
-
self.code = self.code.upcase unless self.code.blank?
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
data/log/test.log
DELETED
File without changes
|
File without changes
|