comee_core 0.3.7 → 0.3.8
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/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 +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6d50f09b407c09781cabe411155b912767ec73af304b20810a58a9632eb13e46
|
4
|
+
data.tar.gz: e0e7bb2f1540a1b922088327e04786589da49cf8b6f9f3e5e37d172a5f462643
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ce44d97aed3a16468341eeda2d707d93c92c776a062491ecb204327b9877892bc812b5ab5e9bc6ba655f25e3f16aa710da2bde7104b624bff07948e29eeeac8
|
7
|
+
data.tar.gz: 193244d3ff7f49f941cfa77c3165af55180437ad3b2837fe358e42aebe62072259e1d91a6ae9623fc250477a146081a072946ad131b153ea723c54c3b9822cb4
|
@@ -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},
|
@@ -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 }
|