comee_core 0.1.13 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/comee/core/back_order.rb +1 -1
- data/app/models/comee/core/client_order.rb +10 -0
- data/app/models/comee/core/client_price.rb +5 -3
- data/app/models/comee/core/field_mapping.rb +9 -0
- data/app/models/comee/core/master_price.rb +3 -3
- data/app/models/comee/core/order_source.rb +8 -0
- data/app/models/comee/core/sales_order.rb +1 -1
- data/db/migrate/20230812190652_create_comee_core_sales_orders.rb +1 -1
- data/db/migrate/20230813235946_create_comee_core_master_prices.rb +8 -4
- data/db/migrate/20230814151601_create_comee_core_client_prices.rb +6 -4
- data/db/migrate/20230929115336_create_comee_core_order_sources.rb +10 -0
- data/db/migrate/20230929120051_create_comee_core_field_mappings.rb +15 -0
- data/db/migrate/20230929130910_create_comee_core_client_orders.rb +18 -0
- data/lib/comee/core/version.rb +1 -1
- data/spec/factories/comee/core/client_orders.rb +8 -0
- data/spec/factories/comee/core/client_prices.rb +2 -4
- data/spec/factories/comee/core/field_mappings.rb +8 -0
- data/spec/factories/comee/core/master_prices.rb +4 -4
- data/spec/factories/comee/core/order_sources.rb +6 -0
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 043ed1a164fa93440307c74baae5cca804e78ce043d1463eb5680cc76cef451d
|
4
|
+
data.tar.gz: c48d480a64a3eb1585351a98497a6507e456bf00782c60f8dace90a607c83f92
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e45c3b4df5048fc6e9f0b6d34700cd8bce34223e73f67c4a3ff35506ff371ee44efb355d60330a6d75a57bd614d5e5150f8d992cafdab73c47ee88b3ecf9f43
|
7
|
+
data.tar.gz: 593b15735e3294c82069a5151fcfff0a8c74eef4fd97b35b81dcda5f17dd321c25dc7aec687224b004303be1e292b43b427cf817b237983b6cab2f041dba60a7
|
@@ -1,11 +1,13 @@
|
|
1
1
|
module Comee
|
2
2
|
module Core
|
3
3
|
class ClientPrice < ApplicationRecord
|
4
|
+
enum :status, {old: 0, current: 1, future: 2}
|
4
5
|
belongs_to :product
|
5
6
|
belongs_to :client
|
7
|
+
belongs_to :previous_price, class_name: "Comee::Core::ClientPrice", optional: true
|
6
8
|
|
7
|
-
validates :valid_from, :valid_to, :
|
8
|
-
validates :
|
9
|
+
validates :valid_from, :valid_to, :price, :status, presence: true
|
10
|
+
validates :price, numericality: {greater_than: 0}
|
9
11
|
validates :product_id, uniqueness: {scope: :client_id}
|
10
12
|
validate :validate_price_validity_dates
|
11
13
|
|
@@ -17,7 +19,7 @@ module Comee
|
|
17
19
|
end
|
18
20
|
|
19
21
|
def self.ransackable_attributes(auth_object = nil)
|
20
|
-
["valid_from", "valid_to", "
|
22
|
+
["valid_from", "valid_to", "price", "status", "product_id", "client_id", "previous_price_id"]
|
21
23
|
end
|
22
24
|
|
23
25
|
def self.ransackable_associations(auth_object = nil)
|
@@ -3,10 +3,10 @@ module Comee
|
|
3
3
|
class MasterPrice < ApplicationRecord
|
4
4
|
belongs_to :supplier
|
5
5
|
belongs_to :product
|
6
|
+
belongs_to :previous_price, class_name: "Comee::Core::MasterPrice", optional: true
|
6
7
|
|
7
|
-
validates :
|
8
|
-
validates :
|
9
|
-
validates :new_pprice, :new_sprice, numericality: {greater_than: 0}
|
8
|
+
validates :purchase_price, :selling_price, :pp_valid_from, :pp_valid_to, :sp_valid_from, :sp_valid_to, presence: true
|
9
|
+
validates :margin, presence: true, numericality: {greater_than_or_equal_to: 0, less_than_or_equal_to: 100}
|
10
10
|
validates :product_id, uniqueness: {scope: :supplier_id}
|
11
11
|
validate :validate_primary_price, :validate_purchase_price_validity_dates, :validate_selling_price_validity_dates
|
12
12
|
|
@@ -4,7 +4,7 @@ module Comee
|
|
4
4
|
belongs_to :client
|
5
5
|
has_many :sales_order_items
|
6
6
|
|
7
|
-
enum :status, {draft: 0, confirmed: 1}
|
7
|
+
enum :status, {draft: 0, confirmed: 1, canceled: 2}
|
8
8
|
|
9
9
|
validates :order_number, presence: true, uniqueness: true
|
10
10
|
validates :order_date, :expected_delivery_date, :delivery_address, :invoice_address, :status, presence: true
|
@@ -6,7 +6,7 @@ class CreateComeeCoreSalesOrders < ActiveRecord::Migration[7.0]
|
|
6
6
|
t.date :expected_delivery_date, null: false
|
7
7
|
t.references :client,
|
8
8
|
null: false,
|
9
|
-
index: {name: "
|
9
|
+
index: {name: "client_on_ccso_indx"},
|
10
10
|
foreign_key: {to_table: :comee_core_clients}
|
11
11
|
t.json :client_terms
|
12
12
|
t.integer :payment_no_of_days, null: false, default: 0
|
@@ -1,15 +1,15 @@
|
|
1
1
|
class CreateComeeCoreMasterPrices < ActiveRecord::Migration[7.0]
|
2
2
|
def change
|
3
3
|
create_table :comee_core_master_prices do |t|
|
4
|
+
t.float :purchase_price, null: false
|
5
|
+
t.float :selling_price, null: false
|
4
6
|
t.date :pp_valid_from, null: false
|
5
7
|
t.date :pp_valid_to, null: false
|
6
8
|
t.date :sp_valid_from, null: false
|
7
9
|
t.date :sp_valid_to, null: false
|
8
|
-
t.
|
9
|
-
t.float :new_pprice, null: false
|
10
|
-
t.float :old_sprice, null: true
|
11
|
-
t.float :new_sprice, null: false
|
10
|
+
t.boolean :active, null: false
|
12
11
|
t.boolean :primary, null: false
|
12
|
+
t.integer :margin, null: false
|
13
13
|
t.references :product,
|
14
14
|
null: false,
|
15
15
|
index: {name: "product_on_ccsp_indx"},
|
@@ -18,6 +18,10 @@ class CreateComeeCoreMasterPrices < ActiveRecord::Migration[7.0]
|
|
18
18
|
null: false,
|
19
19
|
index: {name: "supplier_on_ccsp_indx"},
|
20
20
|
foreign_key: {to_table: :comee_core_suppliers}
|
21
|
+
t.references :previous_price,
|
22
|
+
null: true,
|
23
|
+
index: {name: "previous_price_on_ccsp_indx"},
|
24
|
+
foreign_key: {to_table: :comee_core_master_prices}
|
21
25
|
|
22
26
|
t.timestamps
|
23
27
|
end
|
@@ -3,10 +3,8 @@ class CreateComeeCoreClientPrices < ActiveRecord::Migration[7.0]
|
|
3
3
|
create_table :comee_core_client_prices do |t|
|
4
4
|
t.date :valid_from, null: false
|
5
5
|
t.date :valid_to, null: false
|
6
|
-
t.float :
|
7
|
-
t.float :
|
8
|
-
t.float :future_price, null: true
|
9
|
-
t.date :future_validity, null: true
|
6
|
+
t.float :price, null: false
|
7
|
+
t.float :status, null: false, default: 0
|
10
8
|
t.references :product,
|
11
9
|
null: false,
|
12
10
|
index: {name: "product_on_cccp_indx"},
|
@@ -15,6 +13,10 @@ class CreateComeeCoreClientPrices < ActiveRecord::Migration[7.0]
|
|
15
13
|
null: false,
|
16
14
|
index: {name: "client_on_cccp_indx"},
|
17
15
|
foreign_key: {to_table: :comee_core_clients}
|
16
|
+
t.references :previous_price,
|
17
|
+
null: true,
|
18
|
+
index: {name: "previous_price_on_cccp_indx"},
|
19
|
+
foreign_key: {to_table: :comee_core_client_prices}
|
18
20
|
|
19
21
|
t.timestamps
|
20
22
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class CreateComeeCoreFieldMappings < ActiveRecord::Migration[7.0]
|
2
|
+
def change
|
3
|
+
create_table :comee_core_field_mappings do |t|
|
4
|
+
t.string :source, null: false
|
5
|
+
t.string :destination, null: false
|
6
|
+
t.integer :level, null: false, default: 0
|
7
|
+
t.references :order_source,
|
8
|
+
null: false,
|
9
|
+
index: {name: "order_source_on_cfm_indx"},
|
10
|
+
foreign_key: {to_table: :comee_core_order_sources}
|
11
|
+
|
12
|
+
t.timestamps
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
class CreateComeeCoreClientOrders < ActiveRecord::Migration[7.0]
|
2
|
+
def change
|
3
|
+
create_table :comee_core_client_orders do |t|
|
4
|
+
t.references :order_source,
|
5
|
+
null: false,
|
6
|
+
index: {name: "order_source_on_ccco_indx"},
|
7
|
+
foreign_key: {to_table: :comee_core_order_sources}
|
8
|
+
t.string :url, null: false
|
9
|
+
t.boolean :processed, null: false, default: true
|
10
|
+
t.references :client,
|
11
|
+
null: false,
|
12
|
+
index: {name: "client_on_ccco_indx"},
|
13
|
+
foreign_key: {to_table: :comee_core_clients}
|
14
|
+
|
15
|
+
t.timestamps
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/comee/core/version.rb
CHANGED
@@ -2,10 +2,8 @@ FactoryBot.define do
|
|
2
2
|
factory :client_price, class: "Comee::Core::ClientPrice" do
|
3
3
|
valid_from { Date.current.advance(months: -1) }
|
4
4
|
valid_to { Date.current.advance(months: 1) }
|
5
|
-
|
6
|
-
|
7
|
-
future_price { nil }
|
8
|
-
future_validity { nil }
|
5
|
+
status { 0 }
|
6
|
+
price { 100 }
|
9
7
|
product
|
10
8
|
client
|
11
9
|
end
|
@@ -1,14 +1,14 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :master_price, class: "Comee::Core::MasterPrice" do
|
3
|
+
purchase_price { 100.0 }
|
4
|
+
selling_price { 90.0 }
|
3
5
|
pp_valid_from { Date.current.advance(months: -1) }
|
4
6
|
pp_valid_to { Date.current.advance(months: 1) }
|
5
7
|
sp_valid_from { Date.current.advance(months: -1) }
|
6
8
|
sp_valid_to { Date.current.advance(months: 1) }
|
7
|
-
|
8
|
-
new_pprice { 100 }
|
9
|
-
old_sprice { nil }
|
10
|
-
new_sprice { 120 }
|
9
|
+
active { true }
|
11
10
|
primary { false }
|
11
|
+
margin { 10.0 }
|
12
12
|
product
|
13
13
|
supplier
|
14
14
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comee_core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -248,12 +248,15 @@ files:
|
|
248
248
|
- app/models/comee/core/back_order.rb
|
249
249
|
- app/models/comee/core/back_order_item.rb
|
250
250
|
- app/models/comee/core/client.rb
|
251
|
+
- app/models/comee/core/client_order.rb
|
251
252
|
- app/models/comee/core/client_price.rb
|
252
253
|
- app/models/comee/core/currency.rb
|
254
|
+
- app/models/comee/core/field_mapping.rb
|
253
255
|
- app/models/comee/core/invoice.rb
|
254
256
|
- app/models/comee/core/invoice_item.rb
|
255
257
|
- app/models/comee/core/master_price.rb
|
256
258
|
- app/models/comee/core/notification.rb
|
259
|
+
- app/models/comee/core/order_source.rb
|
257
260
|
- app/models/comee/core/product.rb
|
258
261
|
- app/models/comee/core/product_lookup.rb
|
259
262
|
- app/models/comee/core/product_type.rb
|
@@ -297,6 +300,9 @@ files:
|
|
297
300
|
- db/migrate/20230914041307_create_comee_core_external_products.rb
|
298
301
|
- db/migrate/20230915205522_create_comee_core_invoices.rb
|
299
302
|
- db/migrate/20230915205648_create_comee_core_invoice_items.rb
|
303
|
+
- db/migrate/20230929115336_create_comee_core_order_sources.rb
|
304
|
+
- db/migrate/20230929120051_create_comee_core_field_mappings.rb
|
305
|
+
- db/migrate/20230929130910_create_comee_core_client_orders.rb
|
300
306
|
- lib/comee/core.rb
|
301
307
|
- lib/comee/core/engine.rb
|
302
308
|
- lib/comee/core/version.rb
|
@@ -304,13 +310,16 @@ files:
|
|
304
310
|
- lib/tasks/comee_core_tasks.rake
|
305
311
|
- spec/factories/comee/core/back_order_items.rb
|
306
312
|
- spec/factories/comee/core/back_orders.rb
|
313
|
+
- spec/factories/comee/core/client_orders.rb
|
307
314
|
- spec/factories/comee/core/client_prices.rb
|
308
315
|
- spec/factories/comee/core/clients.rb
|
309
316
|
- spec/factories/comee/core/currencies.rb
|
317
|
+
- spec/factories/comee/core/field_mappings.rb
|
310
318
|
- spec/factories/comee/core/invoice_items.rb
|
311
319
|
- spec/factories/comee/core/invoices.rb
|
312
320
|
- spec/factories/comee/core/master_prices.rb
|
313
321
|
- spec/factories/comee/core/notifications.rb
|
322
|
+
- spec/factories/comee/core/order_sources.rb
|
314
323
|
- spec/factories/comee/core/product_lookups.rb
|
315
324
|
- spec/factories/comee/core/product_types.rb
|
316
325
|
- spec/factories/comee/core/products.rb
|