stockor 0.4.0 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (148) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -4
  3. data/Gemfile.lock +104 -87
  4. data/client/skr/api.js +3 -1
  5. data/client/skr/api/Components/AddressForm.cjsx +1 -1
  6. data/client/skr/api/Components/SingleItemCart.cjsx +1 -1
  7. data/client/skr/api/SingleItemCheckout.cjsx +3 -3
  8. data/client/skr/components/BankAccountFinder.cjsx +1 -1
  9. data/client/skr/components/CreditCardForm.cjsx +1 -1
  10. data/client/skr/components/Currency.cjsx +2 -1
  11. data/client/skr/components/CustomerFinder.cjsx +1 -1
  12. data/client/skr/components/CustomerProjectFinder.cjsx +1 -1
  13. data/client/skr/components/ExpenseCategoryFinder.cjsx +34 -0
  14. data/client/skr/components/GlAccountChooser.cjsx +2 -1
  15. data/client/skr/components/InvoiceFinder.cjsx +1 -1
  16. data/client/skr/components/LatexSnippets.cjsx +3 -0
  17. data/client/skr/components/LocationChooser.cjsx +3 -3
  18. data/client/skr/components/PaymentCategoryFinder.cjsx +1 -1
  19. data/client/skr/components/SalesOrderFinder.cjsx +1 -2
  20. data/client/skr/components/SkuFinder.cjsx +1 -1
  21. data/client/skr/components/SystemSettings.cjsx +4 -1
  22. data/client/skr/components/TermsChooser.cjsx +2 -2
  23. data/client/skr/components/ToolbarButton.cjsx +7 -3
  24. data/client/skr/components/TotalsLine.cjsx +5 -1
  25. data/client/skr/components/UserPreferences.cjsx +1 -1
  26. data/client/skr/components/VendorFinder.cjsx +1 -1
  27. data/client/skr/components/address/Address.cjsx +14 -1
  28. data/client/skr/components/styles.scss +6 -0
  29. data/client/skr/index.js +1 -0
  30. data/client/skr/lib/Remote.coffee +32 -0
  31. data/client/skr/lib/index.js +2 -0
  32. data/client/skr/lib/namespace.coffee +1 -0
  33. data/client/skr/models/CreditCardGateway.coffee +1 -1
  34. data/client/skr/models/ExpenseCategory.coffee +11 -0
  35. data/client/skr/models/ExpenseEntry.coffee +64 -0
  36. data/client/skr/models/ExpenseEntryCategory.coffee +11 -0
  37. data/client/skr/models/Invoice.coffee +4 -1
  38. data/client/skr/models/Payment.coffee +2 -2
  39. data/client/skr/models/SalesOrder.coffee +3 -2
  40. data/client/skr/models/SequentialId.coffee +1 -1
  41. data/client/skr/models/Vendor.coffee +1 -1
  42. data/client/skr/models/mixins/PrintSupport.coffee +1 -1
  43. data/client/skr/screens/bank-maint/BankMaint.cjsx +1 -1
  44. data/client/skr/screens/chart-of-accounts/ChartOfAccounts.cjsx +1 -1
  45. data/client/skr/screens/customer-maint/CustomerMaint.cjsx +1 -1
  46. data/client/skr/screens/customer-projects/CustomerProjects.cjsx +1 -1
  47. data/client/skr/screens/expense-categories/ExpenseCategories.cjsx +31 -0
  48. data/client/skr/screens/expense-categories/index.js +5 -0
  49. data/client/skr/screens/expense-categories/index.scss +9 -0
  50. data/client/skr/screens/expense-entry/ApprovalRequest.coffee +14 -0
  51. data/client/skr/screens/expense-entry/ApproveDialog.cjsx +30 -0
  52. data/client/skr/screens/expense-entry/Categories.cjsx +112 -0
  53. data/client/skr/screens/expense-entry/ExpenseEntry.cjsx +193 -0
  54. data/client/skr/screens/expense-entry/Form.cjsx +54 -0
  55. data/client/skr/screens/expense-entry/Grid.cjsx +51 -0
  56. data/client/skr/screens/expense-entry/ScreenState.coffee +1 -0
  57. data/client/skr/screens/expense-entry/index.js +1 -0
  58. data/client/skr/screens/expense-entry/index.scss +106 -0
  59. data/client/skr/screens/fresh-books-import/ApiInfo.cjsx +3 -3
  60. data/client/skr/screens/fresh-books-import/ChooseRecords.cjsx +6 -4
  61. data/client/skr/screens/fresh-books-import/FreshBooksImport.cjsx +1 -1
  62. data/client/skr/screens/fresh-books-import/ViewRecords.cjsx +2 -2
  63. data/client/skr/screens/fresh-books-import/index.scss +5 -4
  64. data/client/skr/screens/gl-accounts/GlAccounts.cjsx +1 -1
  65. data/client/skr/screens/gl-transactions/GlTransactions.cjsx +1 -1
  66. data/client/skr/screens/invoice/Invoice.cjsx +6 -2
  67. data/client/skr/screens/invoice/Payment.cjsx +1 -1
  68. data/client/skr/screens/invoice/TotalExtraInfo.cjsx +32 -0
  69. data/client/skr/screens/invoice/index.scss +4 -2
  70. data/client/skr/screens/locations/Locations.cjsx +1 -1
  71. data/client/skr/screens/payment-category/PaymentCategory.cjsx +1 -1
  72. data/client/skr/screens/payment-terms/PaymentTerms.cjsx +1 -1
  73. data/client/skr/screens/payments/Payments.cjsx +13 -6
  74. data/client/skr/screens/sale-report/SaleReport.cjsx +1 -1
  75. data/client/skr/screens/sales-order/SalesOrder.cjsx +2 -1
  76. data/client/skr/screens/sku-maint/SkuMaint.cjsx +1 -1
  77. data/client/skr/screens/sku-maint/SkuUomList.cjsx +2 -2
  78. data/client/skr/screens/time-invoicing/TimeInvoicing.cjsx +4 -4
  79. data/client/skr/screens/time-tracking/EditEntry.cjsx +2 -2
  80. data/client/skr/screens/time-tracking/Entries.coffee +6 -4
  81. data/client/skr/screens/time-tracking/Popover.cjsx +11 -6
  82. data/client/skr/screens/time-tracking/TimeTracking.cjsx +12 -5
  83. data/client/skr/screens/vendor-maint/VendorMaint.cjsx +2 -2
  84. data/config/database.yml +2 -0
  85. data/config/puma.rb +0 -4
  86. data/config/routes.rb +4 -0
  87. data/config/screens.rb +17 -0
  88. data/db/migrate/20140323001446_create_so_details_view.rb +2 -2
  89. data/db/migrate/20151121211323_create_customer_project_details_views.rb +1 -1
  90. data/db/migrate/20160216142845_create_gl_account_balances_view.rb +1 -1
  91. data/db/migrate/20160726004411_string_check_numbers.rb +5 -0
  92. data/db/migrate/20160805002717_create_expenses.rb +65 -0
  93. data/db/schema.sql +394 -229
  94. data/db/seed.rb +12 -12
  95. data/lib/skr/access_roles.rb +9 -4
  96. data/lib/skr/concerns/has_gl_transaction.rb +1 -1
  97. data/lib/skr/configuration.rb +3 -1
  98. data/lib/skr/db/migration_helpers.rb +2 -2
  99. data/lib/skr/handlers/approve_expense_entries.rb +16 -0
  100. data/lib/skr/handlers/invoice_from_time_entries.rb +1 -1
  101. data/lib/skr/handlers/sequential_ids.rb +2 -2
  102. data/lib/skr/jobs/fresh_books/import.rb +18 -17
  103. data/lib/skr/model.rb +3 -0
  104. data/lib/skr/models/bank_account.rb +9 -0
  105. data/lib/skr/models/expense_category.rb +27 -0
  106. data/lib/skr/models/expense_entry.rb +76 -0
  107. data/lib/skr/models/expense_entry_category.rb +15 -0
  108. data/lib/skr/models/gl_transaction.rb +2 -2
  109. data/lib/skr/models/inv_line.rb +3 -1
  110. data/lib/skr/models/invoice.rb +9 -5
  111. data/lib/skr/models/payment.rb +1 -1
  112. data/lib/skr/models/purchase_order.rb +4 -4
  113. data/lib/skr/models/uom.rb +2 -2
  114. data/lib/skr/models/voucher.rb +4 -4
  115. data/lib/skr/print/form.rb +17 -14
  116. data/lib/skr/version.rb +1 -1
  117. data/spec/fixtures/skr/expense_category.yml +17 -0
  118. data/spec/fixtures/skr/expense_entries.yml +20 -0
  119. data/spec/fixtures/skr/expense_entry_category.yml +19 -0
  120. data/spec/fixtures/skr/gl_account.yml +10 -0
  121. data/spec/server/handlers/invoice_from_time_entries_spec.rb +2 -2
  122. data/spec/server/handlers/sequential_ids_spec.rb +1 -1
  123. data/spec/server/models/expense_category_spec.rb +17 -0
  124. data/spec/server/models/expense_entry_spec.rb +44 -0
  125. data/spec/server/models/invoice_spec.rb +0 -1
  126. data/spec/server/models/spec_helper_spec.rb +5 -10
  127. data/spec/server/spec_helper.rb +12 -11
  128. data/spec/skr/components/SkuLinesSpec.coffee +11 -9
  129. data/spec/skr/models/CustomerSpec.coffee +1 -1
  130. data/spec/skr/models/ExpenseAccountSpec.coffee +5 -0
  131. data/spec/skr/screens/expense-categories/ExpenseCategoriesSpec.coffee +5 -0
  132. data/spec/skr/screens/expense-entry/ExpenseEntrySpec.coffee +5 -0
  133. data/spec/skr/screens/locations/LocationsSpec.coffee +4 -4
  134. data/spec/skr/screens/time-tracking/TimeTrackingSpec.coffee +4 -4
  135. data/stockor.gemspec +2 -3
  136. data/templates/print/partials/header.tex.erb +1 -1
  137. data/templates/print/partials/skus_table_invoice_footer.tex.erb +22 -19
  138. data/templates/print/partials/skus_table_invoice_info_line.tex.erb +5 -1
  139. data/templates/print/types/payment/default.tex.erb +10 -10
  140. metadata +40 -14
  141. data/client/skr/api/onReady.coffee +0 -23
  142. data/spec/skr/api/SingleItemCheckoutSpec.cjsx +0 -10
  143. data/spec/skr/screens/bank-maint/BankMaintSpec.coffee +0 -5
  144. data/spec/skr/screens/gl-accounts/GlAccountsSpec.coffee +0 -5
  145. data/spec/skr/screens/invoice/InvoiceSpec.coffee +0 -5
  146. data/spec/skr/screens/payment-category/PaymentCategorySpec.coffee +0 -5
  147. data/spec/skr/screens/payments/PaymentsSpec.coffee +0 -5
  148. data/spec/skr/screens/sale-report/SaleReportSpec.coffee +0 -5
@@ -41,14 +41,14 @@ module Skr
41
41
  after_save :set_maybe_completed!
42
42
 
43
43
  export_join_tables :details
44
- export_scope :with_details, lambda { |should_use=true |
44
+ scope :with_details, lambda { |should_use=true |
45
45
  joins('join po_details as details on details.purchase_order_id = purchase_orders.id')
46
46
  .select('purchase_orders.*, details.*') if should_use
47
- }
47
+ }, export: true
48
48
 
49
- export_scope :only_incoming, lambda { |should_use=true|
49
+ scope :only_incoming, lambda { |should_use=true|
50
50
  with_details.where.not(state: :received) if should_use
51
- }
51
+ }, export: true
52
52
 
53
53
  enum state: {
54
54
  open: 0,
@@ -51,13 +51,13 @@ module Skr
51
51
  Uom.new({ :code=>'EA',:size=>1, :price=>0.0 })
52
52
  end
53
53
 
54
- export_scope :for_sku_loc, lambda{ | sku_loc_id = nil |
54
+ scope :for_sku_loc, lambda{ | sku_loc_id = nil |
55
55
  if sku_loc_id
56
56
  Skr::Uom.joins(sku: [:sku_locs]).where(Skr::SkuLoc.table_name => {id: sku_loc_id})
57
57
  else
58
58
  Skr::Uom.none
59
59
  end
60
- }
60
+ }, export: true
61
61
  end
62
62
 
63
63
 
@@ -28,13 +28,13 @@ module Skr
28
28
 
29
29
  before_validation :set_defaults, :on=>:create
30
30
 
31
- export_scope :with_details, lambda { | *args |
31
+ scope :with_details, lambda { | *args |
32
32
  compose_query_using_detail_view( view: 'vo_details', join_to: 'voucher_id' )
33
- }
33
+ }, export: true
34
34
 
35
- export_scope :unpaid, lambda{ | unused=nil |
35
+ scope :unpaid, lambda{ | unused=nil |
36
36
  where(['vouchers.state <> ? and payment_lines.id is null', 'pending']).includes(:payment_line)
37
- }
37
+ }, export: true
38
38
 
39
39
  enum state: {
40
40
  pending: 0,
@@ -1,25 +1,28 @@
1
1
  module Skr
2
2
  module Print
3
3
 
4
+ # finds and generates a pdf verison of a document
4
5
  class Form
5
6
 
6
7
  def initialize(form, code)
7
- @template = Template.get(form) || raise("Unable to find template for #{form}")
8
+ @template = Template.get(form) ||
9
+ fail("Unable to find template for #{form}")
8
10
  @record = @template.model.where(hash_code: code).first!
9
11
  @latex = @template.path_for_record(@record)
10
12
  unless @latex.exist?
11
- raise("Unable to find template type for record")
13
+ fail("Unable to find template type for record")
12
14
  end
13
15
  Lanes.logger.debug "Printing #{form} #{code} using #{@latex}"
14
16
  end
15
17
 
16
18
  def as_pdf
17
- begin
18
- template.to_stringio
19
- rescue => e
20
- Lanes.logger.warn e.log
21
- raise
22
- end
19
+ template.to_stringio
20
+ rescue ErbLatex::LatexError => e
21
+ Lanes.logger.warn e.log
22
+ raise
23
+ rescue => e
24
+ Lanes.logger.warn e
25
+ raise
23
26
  end
24
27
 
25
28
  def as_latex
@@ -38,12 +41,12 @@ module Skr
38
41
  end
39
42
 
40
43
  def template
41
- ErbLatex::Template.new( @latex,
42
- data: data,
43
- context: Skr::Print::Context,
44
- layout: ROOT.join('layout.tex.erb'),
45
- partials_path: ROOT.join('partials'),
46
- packages_path: ROOT.join('packages')
44
+ ErbLatex::Template.new(@latex,
45
+ data: data,
46
+ context: Skr::Print::Context,
47
+ layout: ROOT.join('layout.tex.erb'),
48
+ partials_path: ROOT.join('partials'),
49
+ packages_path: ROOT.join('packages')
47
50
  )
48
51
  end
49
52
  end
@@ -1,3 +1,3 @@
1
1
  module Skr
2
- VERSION='0.4.0'
2
+ VERSION='0.5.0'
3
3
  end
@@ -0,0 +1,17 @@
1
+ misc:
2
+ code: MISC
3
+ name: Miscellaneous Expenses
4
+ gl_account: misc_expense
5
+ is_active: true
6
+
7
+ food:
8
+ code: FOOD
9
+ name: Dining
10
+ gl_account: misc_expense
11
+ is_active: true
12
+
13
+ trans:
14
+ code: TRANS
15
+ name: Transportation Expenses
16
+ gl_account: trans_expense
17
+ is_active: true
@@ -0,0 +1,20 @@
1
+ paper:
2
+ uuid: f8c45b51-8d87-43bf-ae5b-a86b77133660
3
+ name: Biggy Office Store
4
+ memo: Paper for office
5
+ occured: <%= Time.now - 2.days %>
6
+ created_by_id: 1
7
+
8
+ gas:
9
+ uuid: 3c6dd5c7-7dca-4763-a7c3-5964b6f42e36
10
+ name: Mr Fuel
11
+ memo: Gas for truck
12
+ occured: <%= Time.now - 3.days %>
13
+ created_by_id: 1
14
+
15
+ transmission:
16
+ uuid: 13182d4c-ab49-49bc-85a7-b0aae5eb186f
17
+ name: Tranny Fixit
18
+ memo: repairs
19
+ occured: <%= Time.now - 1.days %>
20
+ created_by_id: 1
@@ -0,0 +1,19 @@
1
+ paper_misc:
2
+ category: misc
3
+ entry: paper
4
+ amount: 13.48
5
+
6
+ gas_trans:
7
+ category: trans
8
+ entry: gas
9
+ amount: 53.00
10
+
11
+ gas_food:
12
+ category: food
13
+ entry: gas
14
+ amount: 12.00
15
+
16
+ transmission_trans:
17
+ category: trans
18
+ entry: transmission
19
+ amount: 833.88
@@ -55,6 +55,16 @@ utilities:
55
55
  name: Utilities
56
56
  description: Utility Costs
57
57
 
58
+ misc_expense:
59
+ number: 5200
60
+ name: Misc Exp
61
+ description: Miscellaneous Expense
62
+
63
+ trans_expense:
64
+ number: 5300
65
+ name: Trans Exp
66
+ description: Transportation Expenses
67
+
58
68
  ship:
59
69
  number: 5100
60
70
  name: Shipping
@@ -14,7 +14,7 @@ class InvoiceFromTimeEntriesSpec < Skr::TestCase
14
14
  let (:controller) {
15
15
  subject.new( Invoice, authentication, {}, data )
16
16
  }
17
- let (:invoice_data) { controller.perform_creation[:data]['invoice'] }
17
+ let (:invoice_data) { controller.create[:data]['invoice'] }
18
18
  let (:invoice) { Invoice.find(invoice_data['id']) }
19
19
  let (:time_entry) { skr_time_entry(:siteprep) }
20
20
  let (:line) { invoice.lines.first }
@@ -23,7 +23,7 @@ class InvoiceFromTimeEntriesSpec < Skr::TestCase
23
23
  assert_raises(ActiveRecord::RecordNotFound) {
24
24
  subject.new(
25
25
  Invoice, authentication, {}, data.merge('time_entry_ids' => [12345])
26
- ).perform_creation
26
+ ).create
27
27
  }
28
28
  end
29
29
 
@@ -6,7 +6,7 @@ class SequentialIdsSpec < Skr::TestCase
6
6
 
7
7
  let (:authentication) { Lanes::API::AuthenticationProvider.new({}) }
8
8
  let (:controller) { subject.new( Skr::Invoice, authentication, {}, {} ) }
9
- let (:sids) { controller.perform_retrieval[:data]['ids'] }
9
+ let (:sids) { controller.show[:data]['ids'] }
10
10
 
11
11
  it "retrieves the list of sequential ids" do
12
12
  assert_kind_of Array, sids
@@ -0,0 +1,17 @@
1
+ require_relative '../spec_helper'
2
+
3
+ class ExpenseCategorySpec < Skr::TestCase
4
+
5
+ it "can be saved" do
6
+ model = ExpenseCategory.new(
7
+ code: 'FOO', name: 'Category Newer', is_active: true,
8
+ gl_account: skr_gl_account(:misc_expense)
9
+ )
10
+ assert_saves model
11
+ end
12
+
13
+ it 'calculates balance' do
14
+ assert_equal(skr_expense_category(:trans).balance.to_s, '886.88')
15
+ end
16
+
17
+ end
@@ -0,0 +1,44 @@
1
+ require_relative '../spec_helper'
2
+
3
+ class ExpenseEntrySpec < Skr::TestCase
4
+
5
+ it "can be saved" do
6
+ model = ExpenseEntry.new(
7
+ name: 'Food Inc'
8
+ )
9
+ model.categories.build({
10
+ amount: 101.42,
11
+ category: skr_expense_category(:food)
12
+ })
13
+ assert_saves model
14
+ end
15
+
16
+ it 'calulates amount from categories' do
17
+ entry = skr_expense_entries(:gas)
18
+ assert_equal entry.amount.to_s, '65.0'
19
+ end
20
+
21
+ it 'can join with details' do
22
+ entries = ExpenseEntry.with_category_details.order('occured desc')
23
+ details = entries.map(&:category_list)
24
+ assert_equal(details[0].first['amount'], 833.88)
25
+ assert_equal(details[0].first['balance'], 886.88)
26
+ assert_equal(details[2].first['balance'], 12.0)
27
+ end
28
+
29
+ it "can query details with a category id" do
30
+ food = skr_expense_category(:food)
31
+ entries = ExpenseEntry.with_category_details(food.id)
32
+ assert_equal(entries.length, 1)
33
+ end
34
+
35
+ it "can be approved" do
36
+ entry = skr_expense_entries(:gas)
37
+ bank_account = skr_bank_account(:checking)
38
+ assert_difference ->{ bank_account.gl_account.trial_balance }, (entry.amount * -1) do
39
+ assert entry.approve!(bank_account), 'expense failed to save'
40
+ assert entry.reload.gl_transaction
41
+ end
42
+ end
43
+
44
+ end
@@ -49,7 +49,6 @@ class InvoiceSpec < Skr::TestCase
49
49
  assert inv.payments.create!(
50
50
  amount: 10.10, bank_account: bank_account
51
51
  )
52
- inv.mark_partialy_paid!
53
52
  assert inv.reload.partialy_paid?
54
53
  end
55
54
  end
@@ -1,13 +1,8 @@
1
1
  module FixtureHelpers
2
2
 
3
- extend ActiveSupport::Concern
3
+ def table_rows
4
4
 
5
- included do
6
- alias_method_chain :table_rows, :custom_autoset_fields
7
- end
8
-
9
- def table_rows_with_custom_autoset_fields
10
- results = table_rows_without_custom_autoset_fields
5
+ results = super #table_rows_without_custom_autoset_fields
11
6
  if model_class
12
7
  results[ table_name ].each do | row |
13
8
  row['visible_id'] ||= Skr::SequentialId.next_for( model_class ) if model_class.column_names.include?('visible_id')
@@ -15,12 +10,12 @@ module FixtureHelpers
15
10
  row['created_at'] = Time.now if model_class.column_names.include?('created_at')
16
11
  row['updated_at'] = Time.now if model_class.column_names.include?('updated_at')
17
12
  # 135138680 == "admin"
18
- row['created_by_id'] = 135138680 if model_class.column_names.include?('created_by_id')
19
- row['updated_by_id'] = 135138680 if model_class.column_names.include?('updated_by_id')
13
+ row['created_by_id'] ||= 135138680 if model_class.column_names.include?('created_by_id')
14
+ row['updated_by_id'] ||= 135138680 if model_class.column_names.include?('updated_by_id')
20
15
  end
21
16
  end
22
17
  results
23
18
  end
24
19
  end
25
20
 
26
- ActiveRecord::FixtureSet.send :include, FixtureHelpers
21
+ ActiveRecord::FixtureSet.prepend FixtureHelpers
@@ -1,7 +1,10 @@
1
- require 'skr'
2
- require 'lanes/spec_helper'
3
- require 'webmock/minitest'
4
- require 'vcr'
1
+ require 'lanes'
2
+ Lanes.silence_logs do
3
+ require 'skr'
4
+ require 'lanes/spec_helper'
5
+ require 'webmock/minitest'
6
+ require 'vcr'
7
+ end
5
8
 
6
9
  class Lanes::TestCase
7
10
  include Skr
@@ -22,14 +25,9 @@ module Skr
22
25
  end
23
26
 
24
27
  module StockorFixtureTestPatches
25
- extend ActiveSupport::Concern
26
-
27
- included do
28
- alias_method_chain :table_rows, :custom_autoset_stockor_fields
29
- end
30
28
 
31
- def table_rows_with_custom_autoset_stockor_fields
32
- results = table_rows_without_custom_autoset_stockor_fields
29
+ def table_rows
30
+ results = super
33
31
  if model_class && model_class < ActiveRecord::Base
34
32
  results[ table_name ].each do | row |
35
33
  if self['hash_code'].blank? && model_class.column_names.include?('hash_code')
@@ -41,6 +39,9 @@ module StockorFixtureTestPatches
41
39
  end
42
40
  end
43
41
 
42
+ ActiveRecord::FixtureSet.prepend StockorFixtureTestPatches
43
+
44
+
44
45
  VCR_OPTS = {
45
46
  record: :none
46
47
  }
@@ -16,6 +16,7 @@ startEdit = (props) ->
16
16
  checkRendered = ->
17
17
  editors = LT.Utils.scryRenderedComponentsWithType(lines,
18
18
  Lanes.Components.Grid.RowEditor)
19
+
19
20
  if remaining and _.isEmpty(editors)
20
21
  remaining -= 1
21
22
  console.log remaining
@@ -30,24 +31,25 @@ startEdit = (props) ->
30
31
  screen = LT.makeScreen()
31
32
  commands = new Lanes.Screens.Commands(screen, modelName: 'sales_order')
32
33
  Lanes.Models.Sync.restorePerform =>
33
- Skr.Models.SalesOrder.where({visible_id: 1}, include: 'lines')
34
+ Skr.Models.SalesOrder.where({visible_id: 1021}, include: 'lines')
34
35
  .whenLoaded (orders) =>
35
36
  @sales_order = orders.first()
36
37
  lines = @sales_order.lines
37
38
  @props = {lines, commands, screen}
38
39
  done()
39
40
 
40
- xit "renders lines", (done) ->
41
+ it "renders lines", (done) ->
41
42
  renderLines(@props).then (lines) =>
42
- expect(_.dom(lines).qsa('.grid-body .r').length).toEqual( @props.lines.length )
43
+ expect(_.dom(lines).qs('.grid-body .r:last-child .c:first-child').text)
44
+ .toEqual(@sales_order.lines.last().sku_code)
43
45
  done()
44
46
 
45
- # it "displays the editor", (done) ->
46
- # startEdit(@props).then ({lines, editor}) =>
47
- # sol = @props.lines.last()
48
- # expect(_.pluck( _.dom(editor).qsa('input'), 'value'))
49
- # .toEqual([sol.sku_code, sol.description, sol.uom_code, "#{sol.qty}", sol.price.toString()])
50
- # done()
47
+ # it "displays the editor", (done) ->
48
+ # startEdit(@props).then ({lines, editor}) =>
49
+ # sol = @sales_order.lines.last()
50
+ # expect(_.pluck( _.dom(editor).qsa('input'), 'value'))
51
+ # .toEqual([sol.sku_code, sol.description, sol.uom_code, "#{sol.qty}", sol.price.toString()])
52
+ # done()
51
53
 
52
54
  # it "saves values when edited", (done) ->
53
55
  # startEdit(@props).then ({lines, editor}) =>
@@ -11,7 +11,7 @@ describe "Skr.Models.Customer", ->
11
11
  it "saves when fields are set", (done) ->
12
12
  model = new Skr.Models.Customer(
13
13
  code: "SPECTEST", name: "A Spec Test Customer"
14
- terms: {code: 'SPECTESTER'}
14
+ terms: {code: 'SPECTESTER', description: 'SPEC test'}
15
15
  billing_address: { name: "Billing Address" }
16
16
  shipping_address: { name: "Shipping Address" }
17
17
  )
@@ -0,0 +1,5 @@
1
+ describe "Skr.Models.ExpenseAccount", ->
2
+
3
+ # it "can be instantiated", ->
4
+ # model = new Skr.Models.ExpenseAccount()
5
+ # expect(model).toEqual(jasmine.any(Skr.Models.ExpenseAccount))
@@ -0,0 +1,5 @@
1
+ #describe "Skr.Screens.ExpenseCategories", ->
2
+
3
+ # it "can be rendered", ->
4
+ # screen = LT.renderComponent(Skr.Screens.ExpenseCategories)
5
+ # expect(_.dom(screen).text).toBeDefined()
@@ -0,0 +1,5 @@
1
+ describe "Skr.Screens.ExpenseEntry", ->
2
+
3
+ it "can be rendered", ->
4
+ screen = LT.renderComponent(Skr.Screens.ExpenseEntry)
5
+ expect(_.dom(screen).text).toBeDefined()
@@ -1,5 +1,5 @@
1
- describe "Skr.Screens.Locations", ->
1
+ # describe "Skr.Screens.Locations", ->
2
2
 
3
- it "can be rendered", ->
4
- screen = LT.renderComponent(Skr.Screens.Locations)
5
- expect(_.dom(screen).el.textContent).toMatch(/Code/)
3
+ # it "can be rendered", ->
4
+ # screen = LT.renderComponent(Skr.Screens.Locations)
5
+ # expect(_.dom(screen).el.textContent).toMatch(/Code/)