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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9cf7c91a847172c08d9e35c46340095ff403ffb61939a5a7b69f830fa2394228
4
- data.tar.gz: 55174a1b2a8a304b3ee99995b98efdd52557889b5d57b3623e016df11a29e34a
3
+ metadata.gz: 369ec987be59ed7d3d293ebfd5c22f6d5062ac3b7c596ab27eef192b37c3db2c
4
+ data.tar.gz: cf4ec8c1046d2a1a5fe5f6942c0a3819466c888e3df4052378dd499b1f772a09
5
5
  SHA512:
6
- metadata.gz: b1b2f94a733c313e13ff4ad02c1a2189561d21beef7be6c9cf9089e5320950811b4ddaddf51e7c50e54eefd2918793b3b57b22d1978007df27fcbf8955fdea80
7
- data.tar.gz: c6e916957bae4a9f6b29643c2f92e73d362e62b74a84610d0d2750b3e0465b3c8d1f4dba000d8d74d83d147fafc58a25dded8755eac92ba3e2b5139d75cd7c6c
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.country_of_origin.name
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, :integer
8
- add_column :comee_core_sales_orders, :shipping_arrangement, :integer
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
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.3.7".freeze
3
+ VERSION = "0.3.9".freeze
4
4
  end
5
5
  end
@@ -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.shipping_arrangements[:own] }
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.shipping_arrangements[:own] }
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.7
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-06-30 00:00:00.000000000 Z
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