comee_core 0.1.65 → 0.1.67

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/comee/core/client_prices_controller.rb +1 -1
  3. data/app/controllers/comee/core/clients_controller.rb +1 -1
  4. data/app/controllers/comee/core/item_statuses_controller.rb +1 -1
  5. data/app/controllers/comee/core/product_lookups_controller.rb +24 -0
  6. data/app/controllers/comee/core/quotation_request_items_controller.rb +2 -1
  7. data/app/controllers/comee/core/sales_order_items_controller.rb +26 -26
  8. data/app/controllers/comee/core/shipment_items_controller.rb +40 -0
  9. data/app/models/comee/core/client.rb +1 -1
  10. data/app/models/comee/core/client_price.rb +3 -2
  11. data/app/models/comee/core/item_status.rb +5 -1
  12. data/app/models/comee/core/product_lookup.rb +5 -1
  13. data/app/models/comee/core/quotation_request_item.rb +5 -2
  14. data/app/models/comee/core/sales_order_item.rb +2 -2
  15. data/app/models/comee/core/shipment_item.rb +18 -0
  16. data/app/serializers/comee/core/client_price_serializer.rb +1 -1
  17. data/app/serializers/comee/core/client_serializer.rb +1 -1
  18. data/app/serializers/comee/core/item_status_serializer.rb +1 -1
  19. data/app/serializers/comee/core/product_lookup_serializer.rb +8 -0
  20. data/app/serializers/comee/core/quotation_request_item_serializer.rb +1 -1
  21. data/app/serializers/comee/core/sales_order_item_serializer.rb +1 -1
  22. data/app/serializers/comee/core/shipment_item_serializer.rb +8 -0
  23. data/app/services/comee/core/product_lookup_service.rb +2 -3
  24. data/app/services/comee/core/quotation_request_service.rb +4 -2
  25. data/config/routes.rb +8 -0
  26. data/db/migrate/20230728123039_create_comee_core_clients.rb +4 -1
  27. data/db/migrate/20230812212844_create_comee_core_sales_order_items.rb +0 -1
  28. data/db/migrate/20230813235946_create_comee_core_master_prices.rb +1 -1
  29. data/db/migrate/20230814151601_create_comee_core_client_prices.rb +2 -1
  30. data/db/migrate/{20230914041307_create_comee_core_external_products.rb → 20230914041307_create_comee_core_product_lookups.rb} +2 -1
  31. data/db/migrate/20231121132709_create_comee_core_quotation_request_items.rb +2 -1
  32. data/db/migrate/20231207153420_create_comee_core_shipment_items.rb +17 -0
  33. data/db/migrate/20231207235542_create_comee_core_item_statuses.rb +2 -2
  34. data/lib/comee/core/version.rb +1 -1
  35. data/spec/factories/comee/core/client_prices.rb +2 -1
  36. data/spec/factories/comee/core/clients.rb +1 -1
  37. data/spec/factories/comee/core/item_statuses.rb +1 -1
  38. data/spec/factories/comee/core/product_lookups.rb +1 -0
  39. data/spec/factories/comee/core/quotation_request_items.rb +2 -1
  40. data/spec/factories/comee/core/sales_order_items.rb +0 -1
  41. data/spec/factories/comee/core/shipment_items.rb +10 -0
  42. metadata +10 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 52af84253c893c7cd0227d8f90bf1cfc08122dddd244dc08b43a35cb37d1e023
4
- data.tar.gz: '088941a03a3d82ce6139ee9dbbe37184efc8b5f14dfc28bbedc8c7cc01713359'
3
+ metadata.gz: c8f7ff9ee03c4082238dd29c879529437ae713513aa1bd046e64ceecea1c53d0
4
+ data.tar.gz: 85e177e6799ab61d4f78390390765ade9b80a4dca42fc14cd4169d747f3e2180
5
5
  SHA512:
6
- metadata.gz: 594acab1ee9e374d297fd00251ec3abffa8a3b3f7fe10aef418fd6209d310a4f55376d1dfac93a3948375afcbf196ff4d0bb4e748b6d83e5acb3087208d5c00f
7
- data.tar.gz: 39b42c4dea22968643c0a782850fe981599936983494b3621beeeb055d31a7f4f104f040bb5b81d6b658dc9242e21e2b11c326ae6362003914060e7de4cbddc3
6
+ metadata.gz: 128d85dc812325aa125f0853ab44e98e5e02df194d17fc8b37528e9c8e4a4d8faf5858245a5e5c79657fcbde6b023f0414b6b1730b48418fdc2b75ed6cf498d0
7
+ data.tar.gz: 83a9953071d1334a20bd32dc9ea5a964e2b39ab219df0fa108144490d74038df661f7bb2632daf71daf51afcdfa9045134ad0781a094ca9bd59a617f613f4806
@@ -19,7 +19,7 @@ module Comee
19
19
  private
20
20
 
21
21
  def model_params
22
- params.require(:payload).permit(:valid_from, :valid_to, :price, :product_id, :discount, :client_id, :previous_price,
22
+ params.require(:payload).permit(:valid_from, :valid_to, :price, :product_id, :margin, :margin_type, :client_id, :previous_price,
23
23
  :unit_id)
24
24
  end
25
25
  end
@@ -11,7 +11,7 @@ module Comee
11
11
  private
12
12
 
13
13
  def model_params
14
- params.require(:payload).permit(:code, :name, :address, :locale, :user_id)
14
+ params.require(:payload).permit(:code, :name, :address, :locale, :user_id, :parent_id)
15
15
  end
16
16
  end
17
17
  end
@@ -11,7 +11,7 @@ module Comee
11
11
  private
12
12
 
13
13
  def model_params
14
- params.require(:payload).permit(:hash_code, :status, :status_date, :remark, :sales_order_item_id, :details)
14
+ params.require(:payload).permit(:hash_code, :status, :status_date, :remark, :shipment_item_id, :details)
15
15
  end
16
16
  end
17
17
  end
@@ -0,0 +1,24 @@
1
+ module Comee
2
+ module Core
3
+ class ProductLookupsController < ApplicationController
4
+ include Common
5
+
6
+ def index
7
+ super do
8
+ ProductLookup.includes(:product).all
9
+ end
10
+ end
11
+
12
+ def filter
13
+ lookups = ProductLookup.ransack(params[:q]).result
14
+ render json: {success: true, data: serialize(lookups)}
15
+ end
16
+
17
+ private
18
+
19
+ def model_params
20
+ params.required(:payload).permit(:code, :itemable_id, :itemable_type, :item_description, :product_id)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -32,7 +32,8 @@ module Comee
32
32
  :customer_item_no,
33
33
  :price,
34
34
  :quantity,
35
- :discount,
35
+ :margin,
36
+ :margin_type,
36
37
  :valid_from,
37
38
  :valid_to,
38
39
  :product_id,
@@ -25,32 +25,32 @@ module Comee
25
25
  render json: {success: true}
26
26
  end
27
27
 
28
- def filter_with_status
29
- items = SalesOrderItem.includes(:sales_order, :product, :unit)
30
- .ransack(params[:q]).result
31
- statuses = ItemStatus.where(sales_order_item_id: items.map(&:id))
32
- .select("MAX(id) AS max_id, sales_order_item_id")
33
- .group(:sales_order_item_id)
34
- .all
35
- ids = statuses.map(&:max_id)
36
- statuses = ItemStatus.where(id: ids).each_with_object({}) { |status, res| res[status.sales_order_item_id] = status }
37
- result = items.each_with_object([]) do |item, res|
38
- status = statuses[item.id]
39
- data = {
40
- sales_order_no: item.sales_order.order_number,
41
- customer_item_no: item.customer_item_no,
42
- product_code: item.product.code,
43
- unit: item.unit.code,
44
- quantity: item.quantity,
45
- delivery_date: item.delivery_date,
46
- handover_date: item.sales_order.handover_date,
47
- po_reference: item.po_reference,
48
- status: status&.status
49
- }
50
- res << data.merge(status&.details)
51
- end
52
- render json: {success: true, data: result}
53
- end
28
+ # def filter_with_status
29
+ # items = SalesOrderItem.includes(:sales_order, :product, :unit)
30
+ # .ransack(params[:q]).result
31
+ # statuses = ItemStatus.where(sales_order_item_id: items.map(&:id))
32
+ # .select("MAX(id) AS max_id, sales_order_item_id")
33
+ # .group(:sales_order_item_id)
34
+ # .all
35
+ # ids = statuses.map(&:max_id)
36
+ # statuses = ItemStatus.where(id: ids).each_with_object({}) { |status, res| res[status.sales_order_item_id] = status }
37
+ # result = items.each_with_object([]) do |item, res|
38
+ # status = statuses[item.id]
39
+ # data = {
40
+ # sales_order_no: item.sales_order.order_number,
41
+ # customer_item_no: item.customer_item_no,
42
+ # product_code: item.product.code,
43
+ # unit: item.unit.code,
44
+ # quantity: item.quantity,
45
+ # delivery_date: item.delivery_date,
46
+ # handover_date: item.sales_order.handover_date,
47
+ # po_reference: item.po_reference,
48
+ # status: status&.status
49
+ # }
50
+ # res << data.merge(status&.details)
51
+ # end
52
+ # render json: {success: true, data: result}
53
+ # end
54
54
 
55
55
  private
56
56
 
@@ -0,0 +1,40 @@
1
+ module Comee
2
+ module Core
3
+ class ShipmentItemsController < ApplicationController
4
+ include Common
5
+
6
+ def filter_with_status
7
+ items = ShipmentItem.includes(sales_order_item: %i[sales_order product unit])
8
+ .ransack(params[:q]).result
9
+ statuses = ItemStatus.where(shipment_item_id: items.map(&:id))
10
+ .select("MAX(id) AS max_id, shipment_item_id")
11
+ .group(:shipment_item_id)
12
+ .all
13
+ ids = statuses.map(&:max_id)
14
+ statuses = ItemStatus.where(id: ids).each_with_object({}) { |status, res| res[status.shipment_item_id] = status }
15
+ result = items.each_with_object([]) do |item, res|
16
+ status = statuses[item.id]
17
+ data = {
18
+ sales_order_no: item.sales_order_item.sales_order.order_number,
19
+ customer_item_no: item.sales_order_item.customer_item_no,
20
+ product_code: item.sales_order_item.product.code,
21
+ unit: item.sales_order_item.unit.code,
22
+ quantity: item.sales_order_item.quantity,
23
+ delivery_date: item.sales_order_item.delivery_date,
24
+ handover_date: item.sales_order_item.sales_order.handover_date,
25
+ po_reference: item.sales_order_item.po_reference,
26
+ status: status&.status
27
+ }
28
+ res << data.merge(status&.details)
29
+ end
30
+ render json: {success: true, data: result}
31
+ end
32
+
33
+ private
34
+
35
+ def model_params
36
+ params.require(:payload).permit(:sales_order_item_id, :quantity, :shipment_status, :handover_date, :delivery_date, :pallet_no)
37
+ end
38
+ end
39
+ end
40
+ end
@@ -2,6 +2,7 @@ module Comee
2
2
  module Core
3
3
  class Client < ApplicationRecord
4
4
  belongs_to :user, optional: true
5
+ belongs_to :parent, class_name: "Comee::Core::Client", optional: true
5
6
  has_many :warehouse_shipments
6
7
 
7
8
  validates :code, :name, :address, :locale, presence: true
@@ -15,7 +16,6 @@ module Comee
15
16
  address
16
17
  code
17
18
  name
18
- discount
19
19
  locale
20
20
  ]
21
21
  end
@@ -1,13 +1,14 @@
1
1
  module Comee
2
2
  module Core
3
3
  class ClientPrice < Price
4
+ enum :margin_type, {increase: 0, discount: 1}
4
5
  belongs_to :client
5
6
  belongs_to :previous_price, class_name: "Comee::Core::ClientPrice", optional: true
6
7
  belongs_to :next_price, class_name: "Comee::Core::ClientPrice", optional: true
7
8
 
8
- validates :price, presence: true
9
+ validates :price, :margin_type, presence: true
9
10
  validates :price, numericality: {greater_than: 0}
10
- validates :discount, presence: true, numericality: {greater_than_or_equal_to: 0, less_than_or_equal_to: 100}
11
+ validates :margin, presence: true, numericality: {greater_than_or_equal_to: 0, less_than_or_equal_to: 100}
11
12
  validates :product_id, uniqueness: {scope: %i[client_id previous_price_id next_price_id status]}
12
13
 
13
14
  def self.ransackable_attributes(_auth_object = nil)
@@ -5,13 +5,17 @@ module Comee
5
5
  COMPLETELY_PICKED_AND_PACKED = "Completely Picked & Packed".freeze
6
6
  PARTIALLY_PICKED_AND_PACKED = "Partially Picked & Packed".freeze
7
7
 
8
- belongs_to :sales_order_item
8
+ belongs_to :shipment_item
9
9
 
10
10
  validates :hash_code, :status, :status_date, presence: true
11
11
 
12
12
  def self.ransackable_attributes(_auth_object = nil)
13
13
  %w[hash_code status status_date sales_order_item_id]
14
14
  end
15
+
16
+ def self.ransackable_associations(_auth_object = nil)
17
+ ["shipment_item"]
18
+ end
15
19
  end
16
20
  end
17
21
  end
@@ -4,7 +4,11 @@ module Comee
4
4
  belongs_to :product
5
5
  belongs_to :itemable, polymorphic: true
6
6
 
7
- validates :code, presence: true
7
+ validates :code, :item_description, presence: true
8
+
9
+ def self.ransackable_attributes(_auth_object = nil)
10
+ %w[code item_description itemable_id itemable_type product_id]
11
+ end
8
12
  end
9
13
  end
10
14
  end
@@ -1,14 +1,17 @@
1
1
  module Comee
2
2
  module Core
3
3
  class QuotationRequestItem < ApplicationRecord
4
+ enum :margin_type, {increase: 0, discount: 1}
4
5
  belongs_to :product
5
6
  belongs_to :quotation_request
6
7
  belongs_to :unit
7
8
 
8
- validates :quantity, :price, :discount, :expected_delivery_date, presence: true
9
+ validates :margin_type, :expected_delivery_date, presence: true
10
+ validates :quantity, :price, presence: true, numericality: {greater_than_or_equal_to: 0}
11
+ validates :margin, presence: true, numericality: {greater_than_or_equal_to: 0, less_than_or_equal_to: 100}
9
12
 
10
13
  def self.ransackable_attributes(_auth_object = nil)
11
- %w[quotation_request_id product_id unit_id quantity price discount expected_delivery_date]
14
+ %w[quotation_request_id product_id unit_id quantity price margin margin_type expected_delivery_date]
12
15
  end
13
16
  end
14
17
  end
@@ -6,8 +6,8 @@ module Comee
6
6
  belongs_to :product
7
7
  belongs_to :unit
8
8
  belongs_to :source, class_name: "Comee::Core::FulfillmentCenter", optional: true
9
- has_many :warehouse_shipment_items
10
- has_many :item_statuses
9
+ # has_many :warehouse_shipment_items
10
+ has_many :shipment_items
11
11
 
12
12
  validates :customer_item_no, :delivery_date, presence: true
13
13
  validates :quantity, :price, presence: true, numericality: {greater_than: 0}
@@ -0,0 +1,18 @@
1
+ module Comee
2
+ module Core
3
+ class ShipmentItem < ApplicationRecord
4
+ belongs_to :sales_order_item
5
+
6
+ validates :handover_date, :delivery_date, presence: true
7
+ validates :quantity, presence: true, numericality: {greater_than: 0}
8
+
9
+ def self.ransackable_attributes(_auth_object = nil)
10
+ %w[delivery_date handover_date pallet_no quantity sales_order_item_id shipment_status]
11
+ end
12
+
13
+ def self.ransackable_associations(_auth_object = nil)
14
+ ["sales_order_item"]
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,7 +1,7 @@
1
1
  module Comee
2
2
  module Core
3
3
  class ClientPriceSerializer < ActiveModel::Serializer
4
- attributes :id, :valid_from, :valid_to, :price, :status, :previous_price
4
+ attributes :id, :valid_from, :valid_to, :price, :status, :previous_price, :margin, :margin_type
5
5
  belongs_to :product
6
6
  belongs_to :client
7
7
  belongs_to :unit
@@ -1,7 +1,7 @@
1
1
  module Comee
2
2
  module Core
3
3
  class ClientSerializer < ActiveModel::Serializer
4
- attributes :id, :code, :name, :address, :locale, :user_id, :user_name
4
+ attributes :id, :code, :name, :address, :locale, :user_id, :user_name, :parent_id
5
5
  end
6
6
  end
7
7
  end
@@ -1,7 +1,7 @@
1
1
  module Comee
2
2
  module Core
3
3
  class ItemStatusSerializer < ActiveModel::Serializer
4
- attributes :id, :status, :status_date, :details, :remark, :sales_order_item_id
4
+ attributes :id, :status, :status_date, :details, :remark, :shipment_item_id
5
5
  end
6
6
  end
7
7
  end
@@ -0,0 +1,8 @@
1
+ module Comee
2
+ module Core
3
+ class ProductLookupSerializer < ActiveModel::Serializer
4
+ attributes :id, :code, :itemable_id, :itemable_type, :item_description
5
+ belongs_to :product
6
+ end
7
+ end
8
+ end
@@ -1,7 +1,7 @@
1
1
  module Comee
2
2
  module Core
3
3
  class QuotationRequestItemSerializer < ActiveModel::Serializer
4
- attributes :id, :customer_item_no, :price, :discount, :valid_from, :valid_to, :quantity, :expected_delivery_date
4
+ attributes :id, :customer_item_no, :price, :margin, :margin_type, :valid_from, :valid_to, :quantity, :expected_delivery_date
5
5
  belongs_to :product
6
6
  belongs_to :quotation_request
7
7
  belongs_to :unit
@@ -2,7 +2,7 @@ module Comee
2
2
  module Core
3
3
  class SalesOrderItemSerializer < ActiveModel::Serializer
4
4
  attributes :id, :customer_item_no, :quantity, :quantity_delivered, :price, :delivery_date, :eb_number, :lead_time, :comment,
5
- :action_note, :po_reference, :pallet_no
5
+ :action_note, :po_reference
6
6
 
7
7
  belongs_to :sales_order
8
8
  belongs_to :customer_order_item
@@ -0,0 +1,8 @@
1
+ module Comee
2
+ module Core
3
+ class ShipmentItemSerializer < ActiveModel::Serializer
4
+ attributes :id, :quantity, :shipment_status, :handover_date, :delivery_date, :pallet_no
5
+ belongs_to :sales_order_item
6
+ end
7
+ end
8
+ end
@@ -21,7 +21,7 @@ module Comee
21
21
 
22
22
  if from == ORGANIZATION
23
23
  query = ProductLookup.joins(:product).find_by(product: {code: code}, **to)
24
- return query.code
24
+ return query
25
25
  end
26
26
 
27
27
  if to == ORGANIZATION
@@ -30,8 +30,7 @@ module Comee
30
30
  end
31
31
 
32
32
  product = ProductLookup.find_by(code: code, **from).product
33
- query = ProductLookup.find_by(product: product, **to)
34
- query.code
33
+ ProductLookup.find_by(product: product, **to)
35
34
  end
36
35
  end
37
36
  end
@@ -16,7 +16,8 @@ module Comee
16
16
  items.each do |item|
17
17
  item[:price] = 0
18
18
  item[:quotation_request_id] = request.id
19
- item[:discount] = 0
19
+ item[:margin] = 0
20
+ item[:margin_type] = QuotationRequestItem.margin_types[:increase]
20
21
  end
21
22
  QuotationRequestItem.insert_all!(items)
22
23
  end
@@ -73,7 +74,8 @@ module Comee
73
74
  product_id: item.product_id,
74
75
  unit_id: item.unit_id,
75
76
  price: item.price,
76
- discount: 0,
77
+ margin: 0,
78
+ margin_type: QuotationRequestItem.margin_types[:increase],
77
79
  valid_from: item.valid_from,
78
80
  valid_to: item.valid_to,
79
81
  status: ClientPrice.statuses[:current]
data/config/routes.rb CHANGED
@@ -15,6 +15,12 @@ Comee::Core::Engine.routes.draw do
15
15
  post "client_prices"
16
16
  end
17
17
  end
18
+ resources :product_lookups do
19
+ collection do
20
+ post "filter"
21
+ end
22
+ end
23
+
18
24
  resources :lookups
19
25
  resources :quotation_requests do
20
26
  collection do
@@ -77,7 +83,9 @@ Comee::Core::Engine.routes.draw do
77
83
  member do
78
84
  get "suggest", controller: :sales_order_items, action: :suggest_values
79
85
  end
86
+ end
80
87
 
88
+ resources :shipment_items do
81
89
  collection do
82
90
  post "filter_with_status"
83
91
  end
@@ -9,7 +9,10 @@ class CreateComeeCoreClients < ActiveRecord::Migration[7.0]
9
9
  t.string :name, null: false
10
10
  t.string :address, null: false
11
11
  t.string :locale, null: false, default: "en"
12
- t.string :discount, null: false, default: 0
12
+ t.references :parent,
13
+ null: true,
14
+ index: {name: "so_on_ccc_indx"},
15
+ foreign_key: {to_table: :comee_core_clients}
13
16
 
14
17
  t.timestamps
15
18
  end
@@ -33,7 +33,6 @@ class CreateComeeCoreSalesOrderItems < ActiveRecord::Migration[7.0]
33
33
  t.string :comment
34
34
  t.string :action_note
35
35
  t.string :po_reference
36
- t.string :pallet_no
37
36
 
38
37
  t.timestamps
39
38
  end
@@ -7,7 +7,7 @@ class CreateComeeCoreMasterPrices < ActiveRecord::Migration[7.0]
7
7
  t.date :valid_to, null: false
8
8
  t.float :status, null: false, default: 0
9
9
  t.boolean :primary, null: false, default: false
10
- t.integer :margin, null: false
10
+ t.float :margin, null: false, default: 0
11
11
  t.integer :lead_time
12
12
  t.references :product,
13
13
  null: false,
@@ -5,7 +5,8 @@ class CreateComeeCoreClientPrices < ActiveRecord::Migration[7.0]
5
5
  t.date :valid_to, null: false
6
6
  t.float :price, null: false
7
7
  t.float :status, null: false, default: 0
8
- t.integer :discount, null: false
8
+ t.float :margin, null: false, default: 0
9
+ t.integer :margin_type, null: false, default: 0
9
10
  t.references :product,
10
11
  null: false,
11
12
  index: {name: "product_on_cccp_indx"},
@@ -1,8 +1,9 @@
1
- class CreateComeeCoreExternalProducts < ActiveRecord::Migration[7.0]
1
+ class CreateComeeCoreProductLookups < ActiveRecord::Migration[7.0]
2
2
  def change
3
3
  create_table :comee_core_product_lookups do |t|
4
4
  t.string :code, null: false
5
5
  t.references :itemable, polymorphic: true, null: false
6
+ t.string :item_description, null: false
6
7
  t.references :product,
7
8
  null: false,
8
9
  index: {name: "product_on_ccep_indx"},
@@ -12,7 +12,8 @@ class CreateComeeCoreQuotationRequestItems < ActiveRecord::Migration[7.1]
12
12
  t.string :customer_item_no
13
13
  t.float :quantity, null: false
14
14
  t.float :price, null: false, default: 0
15
- t.float :discount, null: false, default: 0
15
+ t.float :margin, null: false, default: 0
16
+ t.integer :margin_type, null: false, default: 0
16
17
  t.date :expected_delivery_date, null: false
17
18
  t.boolean :canceled, null: false, default: false
18
19
  t.references :unit,
@@ -0,0 +1,17 @@
1
+ class CreateComeeCoreShipmentItems < ActiveRecord::Migration[7.1]
2
+ def change
3
+ create_table :comee_core_shipment_items do |t|
4
+ t.references :sales_order_item,
5
+ index: {name: "soi_on_ccsi_indx"},
6
+ null: false,
7
+ foreign_key: {to_table: :comee_core_sales_order_items}
8
+ t.float :quantity, null: false
9
+ t.string :shipment_status, null: false
10
+ t.date :handover_date, null: false
11
+ t.date :delivery_date, null: false
12
+ t.string :pallet_no
13
+
14
+ t.timestamps
15
+ end
16
+ end
17
+ end
@@ -2,10 +2,10 @@ class CreateComeeCoreItemStatuses < ActiveRecord::Migration[7.1]
2
2
  def change
3
3
  create_table :comee_core_item_statuses do |t|
4
4
  t.bigint :hash_code, null: false
5
- t.references :sales_order_item,
5
+ t.references :shipment_item,
6
6
  null: false,
7
7
  index: {name: "so_on_ccis_indx"},
8
- foreign_key: {to_table: :comee_core_sales_order_items}
8
+ foreign_key: {to_table: :comee_core_shipment_items}
9
9
  t.string :status, null: false
10
10
  t.date :status_date, null: false
11
11
  t.jsonb :details
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.1.65".freeze
3
+ VERSION = "0.1.67".freeze
4
4
  end
5
5
  end
@@ -7,7 +7,8 @@ FactoryBot.define do
7
7
  product
8
8
  client
9
9
  unit
10
- discount { 0 }
10
+ margin { 0.0 }
11
+ margin_type { Comee::Core::ClientPrice.margin_types[:increase] }
11
12
  previous_price { nil }
12
13
  next_price { nil }
13
14
 
@@ -5,6 +5,6 @@ FactoryBot.define do
5
5
  name { Faker::Name.name }
6
6
  address { Faker::Address.full_address }
7
7
  locale { "en" }
8
- discount { 0 }
8
+ parent { nil }
9
9
  end
10
10
  end
@@ -1,7 +1,7 @@
1
1
  FactoryBot.define do
2
2
  factory :item_status, class: "Comee::Core::ItemStatus" do
3
3
  hash_code { "abcdefg".hash }
4
- sales_order_item
4
+ shipment_item
5
5
  status { Faker::Lorem.word }
6
6
  status_date { Date.current }
7
7
  details { {} }
@@ -3,5 +3,6 @@ FactoryBot.define do
3
3
  code { Faker::Alphanumeric.alpha(number: 8) }
4
4
  product
5
5
  itemable factory: :supplier
6
+ item_description { Faker::Lorem.sentence }
6
7
  end
7
8
  end
@@ -6,7 +6,8 @@ FactoryBot.define do
6
6
  customer_item_no { Faker::Alphanumeric.alpha(number: 10) }
7
7
  quantity { 10 }
8
8
  price { 0 }
9
- discount { 0 }
9
+ margin { 0 }
10
+ margin_type { Comee::Core::QuotationRequestItem.margin_types[:increase] }
10
11
  expected_delivery_date { Date.current.advance(days: 15) }
11
12
  canceled { false }
12
13
  valid_from { nil }
@@ -16,6 +16,5 @@ FactoryBot.define do
16
16
  comment { Faker::Lorem.sentence }
17
17
  action_note { Faker::Lorem.sentence }
18
18
  po_reference { Faker::Alphanumeric.alpha(number: 10) }
19
- pallet_no { Faker::Alphanumeric.alpha(number: 10) }
20
19
  end
21
20
  end
@@ -0,0 +1,10 @@
1
+ FactoryBot.define do
2
+ factory :shipment_item, class: "Comee::Core::ShipmentItem" do
3
+ sales_order_item
4
+ quantity { 50 }
5
+ shipment_status { Faker::Lorem.word }
6
+ handover_date { Date.current.advance(days: 3) }
7
+ delivery_date { Date.current.advance(days: 6) }
8
+ pallet_no { Faker::Alphanumeric.alpha(number: 10) }
9
+ end
10
+ 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.65
4
+ version: 0.1.67
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-12-22 00:00:00.000000000 Z
11
+ date: 2023-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -291,6 +291,7 @@ files:
291
291
  - app/controllers/comee/core/item_statuses_controller.rb
292
292
  - app/controllers/comee/core/lookups_controller.rb
293
293
  - app/controllers/comee/core/notifications_controller.rb
294
+ - app/controllers/comee/core/product_lookups_controller.rb
294
295
  - app/controllers/comee/core/products_controller.rb
295
296
  - app/controllers/comee/core/purchase_order_items_controller.rb
296
297
  - app/controllers/comee/core/purchase_orders_controller.rb
@@ -298,6 +299,7 @@ files:
298
299
  - app/controllers/comee/core/quotation_requests_controller.rb
299
300
  - app/controllers/comee/core/sales_order_items_controller.rb
300
301
  - app/controllers/comee/core/sales_orders_controller.rb
302
+ - app/controllers/comee/core/shipment_items_controller.rb
301
303
  - app/controllers/comee/core/suppliers_controller.rb
302
304
  - app/controllers/comee/core/unit_conversions_controller.rb
303
305
  - app/controllers/comee/core/units_controller.rb
@@ -337,6 +339,7 @@ files:
337
339
  - app/models/comee/core/quotation_request_item.rb
338
340
  - app/models/comee/core/sales_order.rb
339
341
  - app/models/comee/core/sales_order_item.rb
342
+ - app/models/comee/core/shipment_item.rb
340
343
  - app/models/comee/core/supplier.rb
341
344
  - app/models/comee/core/unit.rb
342
345
  - app/models/comee/core/unit_conversion.rb
@@ -354,6 +357,7 @@ files:
354
357
  - app/serializers/comee/core/item_status_serializer.rb
355
358
  - app/serializers/comee/core/lookup_serializer.rb
356
359
  - app/serializers/comee/core/master_price_serializer.rb
360
+ - app/serializers/comee/core/product_lookup_serializer.rb
357
361
  - app/serializers/comee/core/product_serializer.rb
358
362
  - app/serializers/comee/core/product_type_serializer.rb
359
363
  - app/serializers/comee/core/purchase_order_item_serializer.rb
@@ -362,6 +366,7 @@ files:
362
366
  - app/serializers/comee/core/quotation_request_serializer.rb
363
367
  - app/serializers/comee/core/sales_order_item_serializer.rb
364
368
  - app/serializers/comee/core/sales_order_serializer.rb
369
+ - app/serializers/comee/core/shipment_item_serializer.rb
365
370
  - app/serializers/comee/core/supplier_serializer.rb
366
371
  - app/serializers/comee/core/unit_conversion_serializer.rb
367
372
  - app/serializers/comee/core/unit_serializer.rb
@@ -396,7 +401,7 @@ files:
396
401
  - db/migrate/20230812212844_create_comee_core_sales_order_items.rb
397
402
  - db/migrate/20230813235946_create_comee_core_master_prices.rb
398
403
  - db/migrate/20230814151601_create_comee_core_client_prices.rb
399
- - db/migrate/20230914041307_create_comee_core_external_products.rb
404
+ - db/migrate/20230914041307_create_comee_core_product_lookups.rb
400
405
  - db/migrate/20230915205522_create_comee_core_invoices.rb
401
406
  - db/migrate/20230915205648_create_comee_core_invoice_items.rb
402
407
  - db/migrate/20230929115336_create_comee_core_order_sources.rb
@@ -414,6 +419,7 @@ files:
414
419
  - db/migrate/20231125122723_create_comee_core_purchase_orders.rb
415
420
  - db/migrate/20231126082907_create_comee_core_purchase_order_items.rb
416
421
  - db/migrate/20231206082503_create_comee_core_unit_conversions.rb
422
+ - db/migrate/20231207153420_create_comee_core_shipment_items.rb
417
423
  - db/migrate/20231207235542_create_comee_core_item_statuses.rb
418
424
  - lib/comee/core.rb
419
425
  - lib/comee/core/engine.rb
@@ -448,6 +454,7 @@ files:
448
454
  - spec/factories/comee/core/quotation_requests.rb
449
455
  - spec/factories/comee/core/sales_order_items.rb
450
456
  - spec/factories/comee/core/sales_orders.rb
457
+ - spec/factories/comee/core/shipment_items.rb
451
458
  - spec/factories/comee/core/suppliers.rb
452
459
  - spec/factories/comee/core/unit_conversions.rb
453
460
  - spec/factories/comee/core/units.rb