comee_core 0.2.34 → 0.2.35

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b249ddf2a74cdb65f1a5567e2a37ec440728906f7d13a09c1bcb2ba4b883875
4
- data.tar.gz: d8a2a8f09283ea682f03166894045c080f5f00ef6431135a7d9a517af1ffa3a8
3
+ metadata.gz: bf6fc63ad754f4758f41618ce9466a608116d8e38c3c8cfe938a87cbcd2ac97a
4
+ data.tar.gz: 5c12cc3e700a0c6f8e0c35a649f438cd8f512c680b094943fd35285fb9d3a347
5
5
  SHA512:
6
- metadata.gz: 99cadabdab0149cca9b835c97b92d0e73932ebe77effe9ad8d190217c03dd5761dad6789cb4aa120845fecf46f7726e51a4f507f3fb42f8b9b50ab6fecd54eed
7
- data.tar.gz: 30f275e6123103a971aef2abe8293b6ef0a7375dd32a3b76878da053eee4dcce2bd4bcd66c6db1e6eaf2e13d32d16d5585af1ea855d5741b02c2b7a483efed2a
6
+ metadata.gz: 429787daf6e1d36ee7091c4620ed014cddbe2b9a312d30b6b414f46a2add9057fee1ec11112730b6f8d17b78ea5747affbbe24ae62b6c2eed6533f39c11fe6c2
7
+ data.tar.gz: e0f204ae7f90d4844ac35cd5bfa27128e5aa26ff42c3efdf16eb01bfdafa71a035f0d5121ed2e815770bfd30835075f835e730f41169d338a2268ed37bdc0792
@@ -47,7 +47,8 @@ module Comee
47
47
  def model_params
48
48
  params.require(:payload).permit(:sales_order_id, :customer_order_item_id, :product_id, :unit_id, :quantity, :quantity_delivered,
49
49
  :customer_item_no, :customer_item_description, :price, :handover_date, :delivery_date,
50
- :eb_number, :lead_time, :comment, :action_note, :po_reference, :pallet_no, :source_id)
50
+ :eb_number, :lead_time, :comment, :action_note, :po_reference, :pallet_no, :source_id,
51
+ :processing_status)
51
52
  end
52
53
  end
53
54
  end
@@ -2,22 +2,29 @@ module Comee
2
2
  module Core
3
3
  class PurchaseOrder < ApplicationRecord
4
4
  belongs_to :supplier
5
- validates :order_date, :delivery_address, presence: true
5
+ validates :order_date, :delivery_address, :status, :delivery_date, presence: true
6
6
  enum status: {
7
7
  draft: 0,
8
- pending_approval: 1,
8
+ submitted: 1,
9
9
  approved: 2,
10
- submitted_to_supplier: 3
10
+ confirmed: 3,
11
+ canceled: 4
11
12
  }
12
13
  def self.ransackable_attributes(_auth_object = nil)
13
14
  %w[
14
15
  id
15
16
  supplier_id
17
+ unit_id
16
18
  order_date
17
19
  status
18
20
  delivery_address
21
+ delivery_date
19
22
  ]
20
23
  end
24
+
25
+ def self.ransackable_associations(_auth_object = nil)
26
+ %w[supplier unit]
27
+ end
21
28
  end
22
29
  end
23
30
  end
@@ -1,31 +1,38 @@
1
1
  module Comee
2
2
  module Core
3
3
  class PurchaseOrderItem < ApplicationRecord
4
+ enum status: {active: 0, canceled: 1}
5
+
4
6
  belongs_to :purchase_order
5
- belongs_to :sales_order_item
6
- validates :status, :quantity, :delivery_date, presence: true
7
- validate :sales_order_item_must_have_eb_number
8
- enum status: {
9
- active: 0,
10
- canceled: 1
11
- }
12
- def sales_order_item_must_have_eb_number
13
- return unless sales_order_item
14
- return if sales_order_item.eb_number
7
+ belongs_to :unit
8
+ belongs_to :source, polymorphic: true
15
9
 
16
- errors.add(:sales_order_item, "must have an EB number.")
17
- end
10
+ validates :quantity, :confirmed_quantity, presence: true, numericality: {greater_than: 0}
11
+ validates :price, :confirmed_price, presence: true, numericality: {greater_than_or_equal_to: 0}
12
+ validates :status, :delivery_date, :confirmed_delivery_date, presence: true
18
13
 
19
14
  def self.ransackable_attributes(_auth_object = nil)
20
15
  %w[
21
16
  id
22
17
  purchase_order_id
23
- sales_order_item_id
18
+ unit_id
24
19
  quantity
20
+ confirmed_quantity
21
+ price
22
+ confirmed_price
25
23
  delivery_date
24
+ confirmed_delivery_date
26
25
  status
27
26
  ]
28
27
  end
28
+
29
+ def self.ransackable_associations(_auth_object = nil)
30
+ %w[
31
+ purchase_order
32
+ source
33
+ unit
34
+ ]
35
+ end
29
36
  end
30
37
  end
31
38
  end
@@ -4,11 +4,14 @@ module Comee
4
4
  before_save :calculate_total_price
5
5
  after_save :calculate_requisition_price
6
6
 
7
+ enum processing_status: {unprocessed: 0, partially_processed: 1, fully_processed: 2}
8
+
7
9
  belongs_to :product
8
10
  belongs_to :unit
9
11
  belongs_to :supplier
10
12
  belongs_to :purchase_requisition
11
13
 
14
+ validates :processing_status, presence: true
12
15
  validates :quantity, :price, presence: true, numericality: {greater_than_or_equal_to: 0}
13
16
 
14
17
  def calculate_total_price
@@ -3,6 +3,8 @@ module Comee
3
3
  class SalesOrderItem < ApplicationRecord
4
4
  before_save :calculate_total_price
5
5
 
6
+ enum processing_status: {unprocessed: 0, partially_processed: 1, fully_processed: 2}
7
+
6
8
  belongs_to :sales_order
7
9
  belongs_to :customer_order_item
8
10
  belongs_to :product
@@ -10,7 +12,7 @@ module Comee
10
12
  belongs_to :source, class_name: "Comee::Core::FulfillmentCenter", optional: true
11
13
  has_many :shipment_items
12
14
 
13
- validates :customer_item_no, :customer_item_description, :delivery_date, presence: true
15
+ validates :customer_item_no, :customer_item_description, :delivery_date, :processing_status, presence: true
14
16
  validates :quantity, :price, presence: true, numericality: {greater_than: 0}
15
17
  validates :quantity_delivered, numericality: {greater_than_or_equal_to: 0}
16
18
 
@@ -33,6 +35,7 @@ module Comee
33
35
  sales_order_id
34
36
  source_id
35
37
  unit_id
38
+ processing_status
36
39
  ]
37
40
  end
38
41
 
@@ -2,7 +2,8 @@ module Comee
2
2
  module Core
3
3
  class SalesOrderItemSerializer < ActiveModel::Serializer
4
4
  attributes :id, :customer_item_no, :customer_item_description, :quantity, :quantity_delivered, :price, :handover_date,
5
- :delivery_date, :eb_number, :lead_time, :comment, :action_note, :po_reference, :total_price, :canceled
5
+ :delivery_date, :eb_number, :lead_time, :comment, :action_note, :po_reference, :total_price, :canceled,
6
+ :processing_status
6
7
 
7
8
  belongs_to :sales_order
8
9
  belongs_to :customer_order_item
@@ -35,6 +35,7 @@ class CreateComeeCoreSalesOrderItems < ActiveRecord::Migration[7.0]
35
35
  t.string :comment
36
36
  t.string :action_note
37
37
  t.string :po_reference
38
+ t.integer :processing_status, null: false, default: 0
38
39
 
39
40
  t.timestamps
40
41
  end
@@ -20,6 +20,7 @@ class CreateComeeCorePurchaseRequisitionItems < ActiveRecord::Migration[7.1]
20
20
  t.float :quantity, null: false
21
21
  t.float :price, null: false
22
22
  t.float :total_price, null: false
23
+ t.integer :processing_status, null: false, default: 0
23
24
 
24
25
  t.timestamps
25
26
  end
@@ -8,6 +8,7 @@ class CreateComeeCorePurchaseOrders < ActiveRecord::Migration[7.1]
8
8
  t.date :order_date, default: Date.today
9
9
  t.integer :status, default: 0
10
10
  t.string :delivery_address, null: false
11
+ t.date :delivery_date, null: false
11
12
 
12
13
  t.timestamps
13
14
  end
@@ -6,12 +6,17 @@ class CreateComeeCorePurchaseOrderItems < ActiveRecord::Migration[7.1]
6
6
  index: {name: "pos_on_ccpoitm_indx"},
7
7
  foreign_key: {to_table: :comee_core_purchase_orders}
8
8
 
9
- t.references :sales_order_item,
10
- null: false,
11
- index: {name: "soi_on_ccpoitm_indx"},
12
- foreign_key: {to_table: :comee_core_sales_order_items}
9
+ t.references :source, polymorphic: true, null: false
13
10
  t.float :quantity, null: false
11
+ t.float :confirmed_quantity, null: false
12
+ t.references :unit,
13
+ null: false,
14
+ index: {name: "unit_on_ccpoitm_indx"},
15
+ foreign_key: {to_table: :comee_core_units}
16
+ t.float :price, null: false
17
+ t.float :confirmed_price, null: false
14
18
  t.date :delivery_date, null: false
19
+ t.date :confirmed_delivery_date, null: false
15
20
  t.integer :status, null: false, default: 0
16
21
 
17
22
  t.timestamps
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.2.34".freeze
3
+ VERSION = "0.2.35".freeze
4
4
  end
5
5
  end
@@ -1,9 +1,14 @@
1
1
  FactoryBot.define do
2
2
  factory :purchase_order_item, class: "Comee::Core::PurchaseOrderItem" do
3
3
  purchase_order
4
- sales_order_item
4
+ unit
5
+ source factory: :purchase_requisition_item
5
6
  quantity { 10 }
7
+ confirmed_quantity { quantity }
8
+ price { 100 }
9
+ confirmed_price { price }
6
10
  delivery_date { Date.current.advance(days: 7) }
11
+ confirmed_delivery_date { delivery_date }
7
12
  status { 0 }
8
13
  end
9
14
  end
@@ -4,5 +4,6 @@ FactoryBot.define do
4
4
  order_date { Date.current }
5
5
  status { 0 }
6
6
  delivery_address { "Korsu warehouse address" }
7
+ delivery_date { Date.current.advance(days: 10) }
7
8
  end
8
9
  end
@@ -6,5 +6,6 @@ FactoryBot.define do
6
6
  purchase_requisition
7
7
  quantity { 10 }
8
8
  price { 15 }
9
+ processing_status { Comee::Core::PurchaseRequisitionItem.processing_statuses[:unprocessed] }
9
10
  end
10
11
  end
@@ -19,5 +19,6 @@ FactoryBot.define do
19
19
  action_note { Faker::Lorem.sentence }
20
20
  po_reference { Faker::Alphanumeric.alpha(number: 10) }
21
21
  canceled { false }
22
+ processing_status { Comee::Core::SalesOrderItem.processing_statuses[:unprocessed] }
22
23
  end
23
24
  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.2.34
4
+ version: 0.2.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-20 00:00:00.000000000 Z
11
+ date: 2024-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -283,8 +283,6 @@ files:
283
283
  - app/controllers/comee/core/notifications_controller.rb
284
284
  - app/controllers/comee/core/product_lookups_controller.rb
285
285
  - app/controllers/comee/core/products_controller.rb
286
- - app/controllers/comee/core/purchase_order_items_controller.rb
287
- - app/controllers/comee/core/purchase_orders_controller.rb
288
286
  - app/controllers/comee/core/quotation_request_items_controller.rb
289
287
  - app/controllers/comee/core/quotation_requests_controller.rb
290
288
  - app/controllers/comee/core/sales_order_items_controller.rb
@@ -421,8 +419,6 @@ files:
421
419
  - db/migrate/20231124120907_create_active_storage_tables.active_storage.rb
422
420
  - db/migrate/20231125111539_create_comee_core_lookups.rb
423
421
  - db/migrate/20231125115522_create_comee_core_customs_details.rb
424
- - db/migrate/20231125122723_create_comee_core_purchase_orders.rb
425
- - db/migrate/20231126082907_create_comee_core_purchase_order_items.rb
426
422
  - db/migrate/20231206082503_create_comee_core_unit_conversions.rb
427
423
  - db/migrate/20231207153420_create_comee_core_shipment_items.rb
428
424
  - db/migrate/20231207235542_create_comee_core_item_statuses.rb
@@ -443,6 +439,8 @@ files:
443
439
  - db/migrate/20240314111117_create_comee_core_purchase_requisitions.rb
444
440
  - db/migrate/20240314111307_create_comee_core_purchase_requisition_items.rb
445
441
  - db/migrate/20240315163900_add_subsidiary_to_client.rb
442
+ - db/migrate/20240325122723_create_comee_core_purchase_orders.rb
443
+ - db/migrate/20240326082907_create_comee_core_purchase_order_items.rb
446
444
  - lib/comee/core.rb
447
445
  - lib/comee/core/engine.rb
448
446
  - lib/comee/core/version.rb
@@ -1,18 +0,0 @@
1
- module Comee
2
- module Core
3
- class PurchaseOrderItemsController < ApplicationController
4
- include Common
5
-
6
- def filter
7
- data = PurchaseOrderItem.ransack(params[:q]).result
8
- render_content(data)
9
- end
10
-
11
- private
12
-
13
- def model_params
14
- params.required(:payload).permit(:purchase_order_id, :sales_order_item_id, :quantity, :delivery_date, :status)
15
- end
16
- end
17
- end
18
- end
@@ -1,18 +0,0 @@
1
- module Comee
2
- module Core
3
- class PurchaseOrdersController < ApplicationController
4
- include Common
5
-
6
- def filter
7
- data = Comee::Core::PurchaseOrder.ransack(params[:q]).result
8
- render_content(data)
9
- end
10
-
11
- private
12
-
13
- def model_params
14
- params.required(:payload).permit(:supplier_id, :order_date, :status, :delivery_address)
15
- end
16
- end
17
- end
18
- end