comee_core 0.3.7 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/comee/core/sales_orders_controller.rb +1 -1
- data/app/models/comee/core/customer_order.rb +5 -1
- data/app/models/comee/core/sales_order.rb +5 -2
- data/app/services/comee/core/customer_order_service.rb +1 -1
- data/db/migrate/20240629065810_remove_address_field_from_supplier_and_client.rb +1 -1
- data/db/migrate/20240629135249_add_additional_fields_to_order.rb +2 -2
- data/lib/comee/core/version.rb +1 -1
- data/spec/factories/comee/core/customer_orders.rb +1 -1
- data/spec/factories/comee/core/sales_orders.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 369ec987be59ed7d3d293ebfd5c22f6d5062ac3b7c596ab27eef192b37c3db2c
|
4
|
+
data.tar.gz: cf4ec8c1046d2a1a5fe5f6942c0a3819466c888e3df4052378dd499b1f772a09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77396dd2d028a8e020c9eef7379f5bf71fb08aa51a31a5c4bf58eaa062d967355b60787df5fa51838853454e250f891c472e771288034da43a886cd17543ebb7
|
7
|
+
data.tar.gz: d41a97d4f5aaca91b23ce28eefde249cf94a5e787300baf6da7b007a388b257e537e8e1f85df13e59b17f055c1fcdb45b16dcf1d511d45f2b9b0e338c266f0fb
|
@@ -125,7 +125,7 @@ module Comee
|
|
125
125
|
:client_id, :order_terms, :shipment_address, :delivery_address, :invoice_address,
|
126
126
|
:destination, :handover_date, :shipping_date, :delivery_date, :consignee, :payment_term,
|
127
127
|
:delivery_term, :payment_penalty, :status, :purchase_status, :total_price, :amount_paid,
|
128
|
-
:pallete_note, :remark, files: [])
|
128
|
+
:consolidator_date, :voyage_no, :shipping_arrangement, :pallete_note, :remark, files: [])
|
129
129
|
end
|
130
130
|
|
131
131
|
def back_order_params
|
@@ -1,14 +1,18 @@
|
|
1
1
|
module Comee
|
2
2
|
module Core
|
3
3
|
class CustomerOrder < ApplicationRecord
|
4
|
+
OWN = "Own".freeze
|
5
|
+
AGENT = "Agent".freeze
|
6
|
+
SHIPPING_ARRANGEMENTS = [OWN, AGENT].freeze
|
7
|
+
|
4
8
|
belongs_to :client
|
5
9
|
has_many :customer_order_items
|
6
10
|
has_one_attached :file
|
7
11
|
|
8
12
|
enum :status, {draft: 0, submitted: 1, awaiting_confirmation: 2, accepted: 3, canceled: 4}
|
9
|
-
enum :shipping_arrangement, {own: 0, agent: 1}
|
10
13
|
|
11
14
|
validates :order_number, :order_date, :delivery_address, :invoice_address, :status, presence: true
|
15
|
+
validates :shipping_arrangement, inclusion: {in: SHIPPING_ARRANGEMENTS}, allow_nil: true
|
12
16
|
|
13
17
|
def self.ransackable_attributes(_auth_object = nil)
|
14
18
|
%w[id client_id delivery_address invoice_address order_number status final_destination consignee]
|
@@ -1,6 +1,10 @@
|
|
1
1
|
module Comee
|
2
2
|
module Core
|
3
3
|
class SalesOrder < ApplicationRecord
|
4
|
+
OWN = "Own".freeze
|
5
|
+
AGENT = "Agent".freeze
|
6
|
+
SHIPPING_ARRANGEMENTS = [OWN, AGENT].freeze
|
7
|
+
|
4
8
|
before_validation :generate_order_number, if: proc { |so| so.order_number.nil? }
|
5
9
|
|
6
10
|
before_save :set_parent_client_name
|
@@ -15,12 +19,11 @@ module Comee
|
|
15
19
|
|
16
20
|
enum :status, {draft: 0, submitted: 1, confirmed: 2, accepted: 3, canceled: 4}
|
17
21
|
enum :purchase_status, {unprocessed: 0, processed: 1}
|
18
|
-
enum :shipping_arrangement, {own: 0, agent: 1}
|
19
22
|
|
20
23
|
validates :order_number, presence: true, uniqueness: true
|
21
24
|
validates :order_date, :status, :purchase_status, presence: true
|
22
25
|
validates :payment_penalty, numericality: {greater_than_or_equal_to: 0, less_than_or_equal_to: 100}, allow_nil: true
|
23
|
-
|
26
|
+
validates :shipping_arrangement, inclusion: {in: SHIPPING_ARRANGEMENTS}, allow_nil: true
|
24
27
|
validates :amount_paid,
|
25
28
|
presence: true,
|
26
29
|
numericality: {greater_than_or_equal_to: 0},
|
@@ -219,7 +219,7 @@ module Comee
|
|
219
219
|
supplier_name: master_price.supplier.name,
|
220
220
|
supplier_item_no: product_lookup.code,
|
221
221
|
supplier_description: product_lookup.item_description,
|
222
|
-
country_of_origin: master_price
|
222
|
+
country_of_origin: master_price&.country_of_origin&.name
|
223
223
|
}
|
224
224
|
}
|
225
225
|
end
|
@@ -2,6 +2,6 @@ class RemoveAddressFieldFromSupplierAndClient < ActiveRecord::Migration[7.1]
|
|
2
2
|
def change
|
3
3
|
remove_column :comee_core_clients, :address, :string
|
4
4
|
remove_column :comee_core_suppliers, :address, :string
|
5
|
-
remove_column :comee_core_clients, :shipment_addresses, array: true
|
5
|
+
remove_column :comee_core_clients, :shipment_addresses, :string, array: true
|
6
6
|
end
|
7
7
|
end
|
@@ -4,7 +4,7 @@ class AddAdditionalFieldsToOrder < ActiveRecord::Migration[7.1]
|
|
4
4
|
add_column :comee_core_sales_orders, :consolidator_date, :date
|
5
5
|
add_column :comee_core_customer_orders, :voyage_no, :string
|
6
6
|
add_column :comee_core_sales_orders, :voyage_no, :string
|
7
|
-
add_column :comee_core_customer_orders, :shipping_arrangement, :
|
8
|
-
add_column :comee_core_sales_orders, :shipping_arrangement, :
|
7
|
+
add_column :comee_core_customer_orders, :shipping_arrangement, :string
|
8
|
+
add_column :comee_core_sales_orders, :shipping_arrangement, :string
|
9
9
|
end
|
10
10
|
end
|
data/lib/comee/core/version.rb
CHANGED
@@ -15,6 +15,6 @@ FactoryBot.define do
|
|
15
15
|
status { 0 }
|
16
16
|
consolidator_date { Date.current }
|
17
17
|
voyage_no { Faker::Alphanumeric.alpha(number: 10) }
|
18
|
-
shipping_arrangement { Comee::Core::CustomerOrder
|
18
|
+
shipping_arrangement { Comee::Core::CustomerOrder::OWN }
|
19
19
|
end
|
20
20
|
end
|
@@ -21,7 +21,7 @@ FactoryBot.define do
|
|
21
21
|
status { Comee::Core::SalesOrder.statuses[:draft] }
|
22
22
|
consolidator_date { Date.current }
|
23
23
|
voyage_no { Faker::Alphanumeric.alpha(number: 10) }
|
24
|
-
shipping_arrangement { Comee::Core::SalesOrder
|
24
|
+
shipping_arrangement { Comee::Core::SalesOrder::OWN }
|
25
25
|
purchase_status { Comee::Core::SalesOrder.purchase_statuses[:unprocessed] }
|
26
26
|
total_price { 0 }
|
27
27
|
amount_paid { 0 }
|
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.3.
|
4
|
+
version: 0.3.9
|
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-
|
11
|
+
date: 2024-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|