erp_inventory 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/erp_inventory/engine.rb +5 -3
- data/lib/erp_inventory/extensions/compass_ae/erp_products/erp_app/desktop/product_manager/base_controller.rb +64 -0
- data/lib/erp_inventory/version.rb +1 -1
- metadata +57 -123
- data/app/assets/javascripts/erp_inventory/application.js +0 -9
- data/app/assets/stylesheets/erp_inventory/application.css +0 -7
- data/app/controllers/erp_inventory/application_controller.rb +0 -4
- data/app/helpers/erp_inventory/application_helper.rb +0 -4
- data/app/models/extensions/product_instance.rb +0 -9
- data/app/models/extensions/product_type.rb +0 -3
- data/app/models/inv_entry_reln.rb +0 -14
- data/app/models/inv_entry_reln_type.rb +0 -4
- data/app/models/inv_entry_role_type.rb +0 -4
- data/app/models/inventory_entry.rb +0 -21
- data/app/models/prod_instance_inv_entry.rb +0 -6
- data/app/views/layouts/erp_inventory/application.html.erb +0 -14
data/lib/erp_inventory/engine.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
module ErpInventory
|
2
2
|
class Engine < Rails::Engine
|
3
3
|
isolate_namespace ErpInventory
|
4
|
-
|
4
|
+
|
5
|
+
initializer "erp_inventory.merge_public" do |app|
|
6
|
+
app.middleware.insert_before Rack::Lock, ::ActionDispatch::Static, "#{root}/public"
|
7
|
+
end
|
8
|
+
|
5
9
|
ActiveSupport.on_load(:active_record) do
|
6
10
|
include ErpInventory::Extensions::ActiveRecord::ActsAsInventoryEntry
|
7
11
|
end
|
8
12
|
|
9
|
-
#TODO
|
10
|
-
#this will be removed once rails 3.2 adds the ability to set the order of engine loading
|
11
13
|
engine = self
|
12
14
|
config.to_prepare do
|
13
15
|
ErpBaseErpSvcs.register_compass_ae_engine(engine)
|
@@ -0,0 +1,64 @@
|
|
1
|
+
ErpProducts::ErpApp::Desktop::ProductManager::BaseController.class_eval do
|
2
|
+
|
3
|
+
#
|
4
|
+
#Inventory
|
5
|
+
#
|
6
|
+
|
7
|
+
def inventory
|
8
|
+
result = {}
|
9
|
+
|
10
|
+
inventory_entry = InventoryEntry.find_by_product_type_id(params[:id])
|
11
|
+
result[:number_available] = inventory_entry.number_available
|
12
|
+
result[:sku] = inventory_entry.sku
|
13
|
+
|
14
|
+
render :json => result
|
15
|
+
end
|
16
|
+
|
17
|
+
def update_inventory
|
18
|
+
inventory_entry = InventoryEntry.find_by_product_type_id(params[:product_type_id])
|
19
|
+
inventory_entry.sku = params[:sku]
|
20
|
+
inventory_entry.number_available = params[:number_available]
|
21
|
+
|
22
|
+
render :json => (inventory_entry.save) ? {:success => true} : {:success => false}
|
23
|
+
end
|
24
|
+
|
25
|
+
def new
|
26
|
+
result = {}
|
27
|
+
|
28
|
+
title = params[:title]
|
29
|
+
description = params[:description]
|
30
|
+
|
31
|
+
product_type = ProductType.new(
|
32
|
+
:description => title
|
33
|
+
)
|
34
|
+
|
35
|
+
product_type.descriptions << DescriptiveAsset.create(
|
36
|
+
:description => description,
|
37
|
+
:internal_identifier => 'long_description'
|
38
|
+
)
|
39
|
+
|
40
|
+
if product_type.save
|
41
|
+
#create inventory
|
42
|
+
inventory_entry = InventoryEntry.new(
|
43
|
+
:product_type => product_type,
|
44
|
+
:number_available => 0,
|
45
|
+
:number_sold => 0,
|
46
|
+
:description => product_type.description
|
47
|
+
)
|
48
|
+
|
49
|
+
if inventory_entry.save
|
50
|
+
result[:success] = true
|
51
|
+
result[:id] = product_type.id
|
52
|
+
else
|
53
|
+
product_type.destroy
|
54
|
+
result[:success] = false
|
55
|
+
end
|
56
|
+
|
57
|
+
else
|
58
|
+
result[:success] = false
|
59
|
+
end
|
60
|
+
|
61
|
+
render :json => result
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: erp_inventory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,85 +9,30 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-05-
|
12
|
+
date: 2012-05-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: erp_app
|
16
|
-
requirement: &81711740 !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - =
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 3.0.1
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: *81711740
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: erp_agreements
|
27
|
-
requirement: &81709610 !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
|
-
requirements:
|
30
|
-
- - =
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: 3.0.1
|
33
|
-
type: :runtime
|
34
|
-
prerelease: false
|
35
|
-
version_requirements: *81709610
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: erp_txns_and_accts
|
38
|
-
requirement: &81734550 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - =
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: 3.0.1
|
44
|
-
type: :runtime
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: *81734550
|
47
14
|
- !ruby/object:Gem::Dependency
|
48
15
|
name: erp_orders
|
49
|
-
requirement: &
|
50
|
-
none: false
|
51
|
-
requirements:
|
52
|
-
- - =
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: 3.0.1
|
55
|
-
type: :runtime
|
56
|
-
prerelease: false
|
57
|
-
version_requirements: *81733670
|
58
|
-
- !ruby/object:Gem::Dependency
|
59
|
-
name: erp_products
|
60
|
-
requirement: &81733100 !ruby/object:Gem::Requirement
|
61
|
-
none: false
|
62
|
-
requirements:
|
63
|
-
- - =
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
version: 3.0.1
|
66
|
-
type: :runtime
|
67
|
-
prerelease: false
|
68
|
-
version_requirements: *81733100
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: erp_commerce
|
71
|
-
requirement: &81731790 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2160190560 !ruby/object:Gem::Requirement
|
72
17
|
none: false
|
73
18
|
requirements:
|
74
|
-
- -
|
19
|
+
- - ~>
|
75
20
|
- !ruby/object:Gem::Version
|
76
|
-
version: 3.0
|
21
|
+
version: '3.0'
|
77
22
|
type: :runtime
|
78
23
|
prerelease: false
|
79
|
-
version_requirements: *
|
24
|
+
version_requirements: *2160190560
|
80
25
|
- !ruby/object:Gem::Dependency
|
81
26
|
name: erp_dev_svcs
|
82
|
-
requirement: &
|
27
|
+
requirement: &2160190060 !ruby/object:Gem::Requirement
|
83
28
|
none: false
|
84
29
|
requirements:
|
85
|
-
- -
|
30
|
+
- - ~>
|
86
31
|
- !ruby/object:Gem::Version
|
87
|
-
version: 3.0
|
32
|
+
version: '3.0'
|
88
33
|
type: :development
|
89
34
|
prerelease: false
|
90
|
-
version_requirements: *
|
35
|
+
version_requirements: *2160190060
|
91
36
|
description: The Inventory Engine in CompassAE implements a set of models for storing
|
92
37
|
information about the availability and location of ProductTypes and optionally Product
|
93
38
|
Instances. It is also the root for yield and revenue management requirements to
|
@@ -98,61 +43,50 @@ executables: []
|
|
98
43
|
extensions: []
|
99
44
|
extra_rdoc_files: []
|
100
45
|
files:
|
101
|
-
- app/assets/stylesheets/erp_inventory/application.css
|
102
|
-
- app/assets/javascripts/erp_inventory/application.js
|
103
|
-
- app/views/layouts/erp_inventory/application.html.erb
|
104
|
-
- app/models/inv_entry_role_type.rb
|
105
|
-
- app/models/inv_entry_reln_type.rb
|
106
|
-
- app/models/inventory_entry.rb
|
107
|
-
- app/models/prod_instance_inv_entry.rb
|
108
|
-
- app/models/inv_entry_reln.rb
|
109
|
-
- app/models/extensions/product_type.rb
|
110
|
-
- app/models/extensions/product_instance.rb
|
111
|
-
- app/helpers/erp_inventory/application_helper.rb
|
112
|
-
- app/controllers/erp_inventory/application_controller.rb
|
113
46
|
- config/routes.rb
|
114
47
|
- db/migrate/20080805000050_base_inventory.rb
|
115
48
|
- db/migrate/20080805000051_base_inventory_indexes.rb
|
116
49
|
- lib/erp_inventory/engine.rb
|
117
|
-
- lib/erp_inventory/extensions.rb
|
118
50
|
- lib/erp_inventory/extensions/active_record/acts_as_inventory_entry.rb
|
51
|
+
- lib/erp_inventory/extensions/compass_ae/erp_products/erp_app/desktop/product_manager/base_controller.rb
|
52
|
+
- lib/erp_inventory/extensions.rb
|
119
53
|
- lib/erp_inventory/version.rb
|
120
54
|
- lib/erp_inventory.rb
|
121
55
|
- lib/tasks/erp_inventory_tasks.rake
|
122
56
|
- GPL-3-LICENSE
|
123
57
|
- Rakefile
|
124
58
|
- README.rdoc
|
125
|
-
- spec/spec_helper.rb
|
126
|
-
- spec/models/inv_entry_reln_type_spec.rb
|
127
|
-
- spec/models/inventory_entry_spec.rb
|
128
|
-
- spec/models/inv_entry_role_type_spec.rb
|
129
|
-
- spec/models/prod_instance_inv_entry_spec.rb
|
130
|
-
- spec/models/inv_entry_reln_spec.rb
|
131
|
-
- spec/dummy/public/422.html
|
132
|
-
- spec/dummy/public/404.html
|
133
|
-
- spec/dummy/public/500.html
|
134
|
-
- spec/dummy/public/favicon.ico
|
135
|
-
- spec/dummy/config.ru
|
136
|
-
- spec/dummy/app/assets/stylesheets/application.css
|
137
59
|
- spec/dummy/app/assets/javascripts/application.js
|
138
|
-
- spec/dummy/app/
|
139
|
-
- spec/dummy/app/helpers/application_helper.rb
|
60
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
140
61
|
- spec/dummy/app/controllers/application_controller.rb
|
141
|
-
- spec/dummy/
|
142
|
-
- spec/dummy/
|
143
|
-
- spec/dummy/config/boot.rb
|
62
|
+
- spec/dummy/app/helpers/application_helper.rb
|
63
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
144
64
|
- spec/dummy/config/application.rb
|
65
|
+
- spec/dummy/config/boot.rb
|
66
|
+
- spec/dummy/config/database.yml
|
67
|
+
- spec/dummy/config/environment.rb
|
145
68
|
- spec/dummy/config/environments/spec.rb
|
146
|
-
- spec/dummy/config/initializers/mime_types.rb
|
147
|
-
- spec/dummy/config/initializers/session_store.rb
|
148
69
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
149
|
-
- spec/dummy/config/initializers/wrap_parameters.rb
|
150
70
|
- spec/dummy/config/initializers/inflections.rb
|
71
|
+
- spec/dummy/config/initializers/mime_types.rb
|
151
72
|
- spec/dummy/config/initializers/secret_token.rb
|
152
|
-
- spec/dummy/config/
|
153
|
-
- spec/dummy/config/
|
73
|
+
- spec/dummy/config/initializers/session_store.rb
|
74
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
75
|
+
- spec/dummy/config/locales/en.yml
|
76
|
+
- spec/dummy/config/routes.rb
|
77
|
+
- spec/dummy/config.ru
|
78
|
+
- spec/dummy/public/404.html
|
79
|
+
- spec/dummy/public/422.html
|
80
|
+
- spec/dummy/public/500.html
|
81
|
+
- spec/dummy/public/favicon.ico
|
154
82
|
- spec/dummy/Rakefile
|
155
83
|
- spec/dummy/script/rails
|
84
|
+
- spec/models/inv_entry_reln_spec.rb
|
85
|
+
- spec/models/inv_entry_reln_type_spec.rb
|
86
|
+
- spec/models/inv_entry_role_type_spec.rb
|
87
|
+
- spec/models/inventory_entry_spec.rb
|
88
|
+
- spec/models/prod_instance_inv_entry_spec.rb
|
89
|
+
- spec/spec_helper.rb
|
156
90
|
homepage: http://development.compassagile.com
|
157
91
|
licenses: []
|
158
92
|
post_install_message:
|
@@ -173,41 +107,41 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
173
107
|
version: '0'
|
174
108
|
requirements: []
|
175
109
|
rubyforge_project:
|
176
|
-
rubygems_version: 1.8.
|
110
|
+
rubygems_version: 1.8.15
|
177
111
|
signing_key:
|
178
112
|
specification_version: 3
|
179
113
|
summary: The Inventory Engine in CompassAE implements a set of models for storing
|
180
114
|
information about the availability and location of ProductTypes and optionally Product
|
181
115
|
Instances.
|
182
116
|
test_files:
|
183
|
-
- spec/spec_helper.rb
|
184
|
-
- spec/models/inv_entry_reln_type_spec.rb
|
185
|
-
- spec/models/inventory_entry_spec.rb
|
186
|
-
- spec/models/inv_entry_role_type_spec.rb
|
187
|
-
- spec/models/prod_instance_inv_entry_spec.rb
|
188
|
-
- spec/models/inv_entry_reln_spec.rb
|
189
|
-
- spec/dummy/public/422.html
|
190
|
-
- spec/dummy/public/404.html
|
191
|
-
- spec/dummy/public/500.html
|
192
|
-
- spec/dummy/public/favicon.ico
|
193
|
-
- spec/dummy/config.ru
|
194
|
-
- spec/dummy/app/assets/stylesheets/application.css
|
195
117
|
- spec/dummy/app/assets/javascripts/application.js
|
196
|
-
- spec/dummy/app/
|
197
|
-
- spec/dummy/app/helpers/application_helper.rb
|
118
|
+
- spec/dummy/app/assets/stylesheets/application.css
|
198
119
|
- spec/dummy/app/controllers/application_controller.rb
|
199
|
-
- spec/dummy/
|
200
|
-
- spec/dummy/
|
201
|
-
- spec/dummy/config/boot.rb
|
120
|
+
- spec/dummy/app/helpers/application_helper.rb
|
121
|
+
- spec/dummy/app/views/layouts/application.html.erb
|
202
122
|
- spec/dummy/config/application.rb
|
123
|
+
- spec/dummy/config/boot.rb
|
124
|
+
- spec/dummy/config/database.yml
|
125
|
+
- spec/dummy/config/environment.rb
|
203
126
|
- spec/dummy/config/environments/spec.rb
|
204
|
-
- spec/dummy/config/initializers/mime_types.rb
|
205
|
-
- spec/dummy/config/initializers/session_store.rb
|
206
127
|
- spec/dummy/config/initializers/backtrace_silencers.rb
|
207
|
-
- spec/dummy/config/initializers/wrap_parameters.rb
|
208
128
|
- spec/dummy/config/initializers/inflections.rb
|
129
|
+
- spec/dummy/config/initializers/mime_types.rb
|
209
130
|
- spec/dummy/config/initializers/secret_token.rb
|
210
|
-
- spec/dummy/config/
|
211
|
-
- spec/dummy/config/
|
131
|
+
- spec/dummy/config/initializers/session_store.rb
|
132
|
+
- spec/dummy/config/initializers/wrap_parameters.rb
|
133
|
+
- spec/dummy/config/locales/en.yml
|
134
|
+
- spec/dummy/config/routes.rb
|
135
|
+
- spec/dummy/config.ru
|
136
|
+
- spec/dummy/public/404.html
|
137
|
+
- spec/dummy/public/422.html
|
138
|
+
- spec/dummy/public/500.html
|
139
|
+
- spec/dummy/public/favicon.ico
|
212
140
|
- spec/dummy/Rakefile
|
213
141
|
- spec/dummy/script/rails
|
142
|
+
- spec/models/inv_entry_reln_spec.rb
|
143
|
+
- spec/models/inv_entry_reln_type_spec.rb
|
144
|
+
- spec/models/inv_entry_role_type_spec.rb
|
145
|
+
- spec/models/inventory_entry_spec.rb
|
146
|
+
- spec/models/prod_instance_inv_entry_spec.rb
|
147
|
+
- spec/spec_helper.rb
|
@@ -1,9 +0,0 @@
|
|
1
|
-
// This is a manifest file that'll be compiled into including all the files listed below.
|
2
|
-
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
3
|
-
// be included in the compiled file accessible from http://example.com/assets/application.js
|
4
|
-
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
5
|
-
// the compiled file.
|
6
|
-
//
|
7
|
-
//= require jquery
|
8
|
-
//= require jquery_ujs
|
9
|
-
//= require_tree .
|
@@ -1,7 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
3
|
-
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
4
|
-
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
5
|
-
*= require_self
|
6
|
-
*= require_tree .
|
7
|
-
*/
|
@@ -1,9 +0,0 @@
|
|
1
|
-
ProductInstance.class_eval do
|
2
|
-
|
3
|
-
# A ProductInstance can be referenced by more than one inventory entry via overbooking or
|
4
|
-
# "first-come, first serve" inventory strategies. This is a cross-reference entity that
|
5
|
-
# allows this kind of relationship, which is optional depending on business circumstances.
|
6
|
-
has_many :prod_instance_inv_entries
|
7
|
-
has_many :inventory_entries, :through => :prod_instance_inv_entries
|
8
|
-
|
9
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
class InvEntryReln < ActiveRecord::Base
|
2
|
-
|
3
|
-
belongs_to :inv_entry_from, :class_name => "InvEntry", :foreign_key => "inv_entry_id_from"
|
4
|
-
belongs_to :inv_entry_to, :class_name => "InvEntry", :foreign_key => "inv_entry_id_to"
|
5
|
-
|
6
|
-
belongs_to :from_role, :class_name => "InvEntryRoleType", :foreign_key => "role_type_id_from"
|
7
|
-
belongs_to :to_role, :class_name => "InvEntryRoleType", :foreign_key => "role_type_id_to"
|
8
|
-
|
9
|
-
belongs_to :inv_entry_reln_type
|
10
|
-
|
11
|
-
alias :from_item :inv_entry_from
|
12
|
-
alias :to_item :inv_entry_to
|
13
|
-
|
14
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
class InventoryEntry < ActiveRecord::Base
|
2
|
-
|
3
|
-
belongs_to :inventory_entry_record, :polymorphic => true
|
4
|
-
belongs_to :product_type
|
5
|
-
has_one :classification, :as => :classification, :class_name => 'CategoryClassification'
|
6
|
-
has_many :prod_instance_inv_entries
|
7
|
-
has_many :product_instances, :through => :prod_instance_inv_entries do
|
8
|
-
def available
|
9
|
-
includes([:prod_availability_status_type]).where('prod_availability_status_types.internal_identifier = ?', 'available')
|
10
|
-
end
|
11
|
-
|
12
|
-
def sold
|
13
|
-
includes([:prod_availability_status_type]).where('prod_availability_status_types.internal_identifier = ?', 'sold')
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def to_label
|
18
|
-
"#{description}"
|
19
|
-
end
|
20
|
-
|
21
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<title>ErpInventory</title>
|
5
|
-
<%= stylesheet_link_tag "erp_inventory/application" %>
|
6
|
-
<%= javascript_include_tag "erp_inventory/application" %>
|
7
|
-
<%= csrf_meta_tags %>
|
8
|
-
</head>
|
9
|
-
<body>
|
10
|
-
|
11
|
-
<%= yield %>
|
12
|
-
|
13
|
-
</body>
|
14
|
-
</html>
|