comee_core 0.2.88 → 0.2.89

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/comee/core/clients_controller.rb +2 -2
  3. data/app/models/comee/core/client.rb +1 -1
  4. data/app/models/comee/core/client_address.rb +11 -0
  5. data/app/serializers/comee/core/client_serializer.rb +2 -2
  6. data/db/migrate/20230728014322_create_comee_core_products.rb +1 -0
  7. data/db/migrate/20230728122618_create_comee_core_suppliers.rb +3 -0
  8. data/db/migrate/20230728123039_create_comee_core_clients.rb +7 -0
  9. data/db/migrate/20230728123823_create_comee_core_purchase_orders.rb +1 -0
  10. data/db/migrate/20230728123827_create_comee_core_purchase_order_items.rb +1 -0
  11. data/db/migrate/20230811102708_create_comee_core_customer_order_items.rb +1 -0
  12. data/db/migrate/20230812190652_create_comee_core_sales_orders.rb +1 -0
  13. data/db/migrate/20230812212844_create_comee_core_sales_order_items.rb +1 -0
  14. data/db/migrate/20230813235946_create_comee_core_master_prices.rb +5 -0
  15. data/db/migrate/20231125115522_create_comee_core_customs_details.rb +4 -0
  16. data/db/migrate/20231207153420_create_comee_core_shipment_items.rb +1 -0
  17. data/db/migrate/20240314111117_create_comee_core_purchase_requisitions.rb +1 -0
  18. data/db/migrate/20240503040722_create_comee_core_client_addresses.rb +2 -0
  19. data/lib/comee/core/version.rb +1 -1
  20. data/spec/factories/comee/core/client_addresses.rb +1 -0
  21. data/spec/factories/comee/core/clients.rb +1 -0
  22. metadata +2 -9
  23. data/db/migrate/20240425121701_add_purchase_status_to_sales_order_and_purchase_requisition.rb +0 -6
  24. data/db/migrate/20240515173010_add_serial_no_to_line_items.rb +0 -6
  25. data/db/migrate/20240601094028_add_additional_fields.rb +0 -32
  26. data/db/migrate/20240602171355_add_order_reference_to_purchase_order.rb +0 -5
  27. data/db/migrate/20240604142805_add_serial_no_to_purchase_order_items.rb +0 -5
  28. data/db/migrate/20240604155157_add_fields_to_customs_details.rb +0 -8
  29. data/db/migrate/20240608094721_add_package_type_to_shipment_item.rb +0 -5
  30. /data/db/migrate/{20231125111539_create_comee_core_lookups.rb → 20230728011539_create_comee_core_lookups.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0130a43666a70736bf713ceca90adf41dc646683367083cb39923aeb9deefa7c
4
- data.tar.gz: 1817df779fd04f49e533a4c6c1ce444396a501a30a9a825e84026a36bd890ccf
3
+ metadata.gz: 666b82ff696734f80ccde6a6b51557e9df23afa60db6af636f6eca114fc49780
4
+ data.tar.gz: 46ff70008ebec1049c4e2d6867ca21fcb09c63089f02818574746a1f78ff4942
5
5
  SHA512:
6
- metadata.gz: 93ec1272995413a3ed4629ca0c30fb2870c19c524660534f20616942abc3b531696c947ab2a82ebe065684f68c0073c21ad37fdce39ac331cd213f04648a9ed0
7
- data.tar.gz: ef32d4bc6d8ffabe0295516f5585908be70bb54078db6169f12867a1007040ed8315c87aa94de294528c658c32786e7a76620642ea1870ce205f4aba8f4b26cb
6
+ metadata.gz: b25259eb51765fedd7e9067bd5466456f1e85c2dd5baee69def285442ae59aa7779449fa533e0e757390a0a7536e783a2e6ce5c41b95fa6a41b35b0f242822bc
7
+ data.tar.gz: bc02daf64bea899ca7462b29ad47bd6001c919b00e67949774eb928db309c84b154e70e4dd3a46022c4bbd47fbbf53d298a8e1af0f65b3f9818275b2a8abe123
@@ -56,8 +56,8 @@ module Comee
56
56
  private
57
57
 
58
58
  def model_params
59
- params.require(:payload).permit(:code, :name, :address, :locale, :user_id, :parent_id, :currency, :subsidiary,
60
- :country_id, :tax_code, :vat_number, consignees: [])
59
+ params.require(:payload).permit(:code, :name, :match_code, :address, :locale, :user_id, :parent_id, :currency,
60
+ :subsidiary, :country_id, :tax_code, :vat_number, consignees: [])
61
61
  end
62
62
 
63
63
  def agent_params
@@ -9,7 +9,7 @@ module Comee
9
9
  has_and_belongs_to_many :agents, join_table: :comee_core_clients_agents
10
10
  has_many :client_warehouses
11
11
 
12
- validates :code, :name, :address, :locale, presence: true
12
+ validates :code, :name, :match_code, :address, :locale, presence: true
13
13
  validates :code, uniqueness: true
14
14
 
15
15
  delegate(:name, to: :user, prefix: true, allow_nil: true)
@@ -12,6 +12,17 @@ module Comee
12
12
 
13
13
  validates :name, :address_line1, :address_type, presence: true
14
14
  validates :address_type, inclusion: {in: ADDRESS_TYPES}
15
+
16
+ validate :validate_default
17
+
18
+ def validate_default
19
+ return unless client && address_type
20
+
21
+ default_count = ClientAddress.where(address_type: address_type, client: client, default: true).count
22
+ return if default_count.zero?
23
+
24
+ errors.add(:default, "cannot be set to true. There is already a default address for this client and address type.")
25
+ end
15
26
  end
16
27
  end
17
28
  end
@@ -1,8 +1,8 @@
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, :parent_id, :consignees, :shipment_addresses,
5
- :tax_code, :vat_number, :currency
4
+ attributes :id, :code, :name, :match_code, :address, :locale, :user_id, :user_name, :parent_id, :consignees,
5
+ :shipment_addresses, :tax_code, :vat_number, :currency
6
6
  belongs_to :parent
7
7
  belongs_to :country
8
8
  has_many :agents
@@ -4,6 +4,7 @@ class CreateComeeCoreProducts < ActiveRecord::Migration[7.0]
4
4
  t.string :code, null: false
5
5
  t.string :name, null: false
6
6
  t.string :description
7
+ t.string :customs_description, null: false
7
8
  t.boolean :leaf, null: false, default: true
8
9
  t.string :ancestry
9
10
  t.jsonb :preferred_units, null: false, default: []
@@ -5,6 +5,9 @@ class CreateComeeCoreSuppliers < ActiveRecord::Migration[7.0]
5
5
  t.string :name, null: false
6
6
  t.string :address, null: false
7
7
  t.string :locale, null: false, default: "en"
8
+ t.string :payment_terms, null: false, default: "30 Days Net"
9
+ t.string :vat_number
10
+ t.string :tax_code
8
11
  t.references :currency,
9
12
  null: true,
10
13
  index: {name: "currency_on_ccs_indx"},
@@ -7,8 +7,11 @@ class CreateComeeCoreClients < ActiveRecord::Migration[7.0]
7
7
  foreign_key: {to_table: :comee_core_users}
8
8
  t.string :code, null: false
9
9
  t.string :name, null: false
10
+ t.string :match_code, null: false
10
11
  t.string :address, null: false
11
12
  t.string :locale, null: false, default: "en"
13
+ t.string :tax_code
14
+ t.string :vat_number
12
15
  t.references :parent,
13
16
  null: true,
14
17
  index: {name: "so_on_ccc_indx"},
@@ -19,6 +22,10 @@ class CreateComeeCoreClients < ActiveRecord::Migration[7.0]
19
22
  null: true,
20
23
  index: {name: "currency_on_ccc_indx"},
21
24
  foreign_key: {to_table: :comee_core_currencies}
25
+ t.references :country,
26
+ null: true,
27
+ index: {name: "country_on_ccc_indx"},
28
+ foreign_key: {to_table: :comee_core_lookups}
22
29
 
23
30
  t.boolean :subsidiary, default: false
24
31
  t.timestamps
@@ -2,6 +2,7 @@ class CreateComeeCorePurchaseOrders < ActiveRecord::Migration[7.1]
2
2
  def change
3
3
  create_table :comee_core_purchase_orders do |t|
4
4
  t.string :po_number, null: false
5
+ t.string :order_reference
5
6
  t.references :supplier,
6
7
  null: false,
7
8
  index: {name: "suppliers_on_ccpo_indx"},
@@ -1,6 +1,7 @@
1
1
  class CreateComeeCorePurchaseOrderItems < ActiveRecord::Migration[7.1]
2
2
  def change
3
3
  create_table :comee_core_purchase_order_items do |t|
4
+ t.integer :serial_no, null: false, default: 1
4
5
  t.references :purchase_order,
5
6
  null: false,
6
7
  index: {name: "pos_on_ccpoitm_indx"},
@@ -14,6 +14,7 @@ class CreateComeeCoreCustomerOrderItems < ActiveRecord::Migration[7.1]
14
14
  index: {name: "unit_on_cccuoi_indx"},
15
15
  foreign_key: {to_table: :comee_core_units}
16
16
  t.string :customer_item_no, null: false
17
+ t.integer :serial_no, null: false, default: 1
17
18
  t.string :customer_item_description, null: false
18
19
  t.float :quantity, null: false, default: 0
19
20
  t.float :price, null: false, default: 0
@@ -29,6 +29,7 @@ class CreateComeeCoreSalesOrders < ActiveRecord::Migration[7.0]
29
29
  t.string :delivery_term
30
30
  t.float :payment_penalty, default: 0
31
31
  t.integer :status, null: false, default: 0
32
+ t.integer :purchase_status, null: false, default: 0
32
33
  t.float :total_price, default: 0.0
33
34
  t.float :amount_paid, default: 0.0
34
35
  t.string :pallete_note
@@ -26,6 +26,7 @@ class CreateComeeCoreSalesOrderItems < ActiveRecord::Migration[7.0]
26
26
  index: {name: "poi_on_ccsoi_indx"},
27
27
  foreign_key: {to_table: :comee_core_purchase_order_items}
28
28
  t.string :customer_item_no, null: false
29
+ t.integer :serial_no, null: false, default: 1
29
30
  t.string :customer_item_description, null: false
30
31
  t.float :quantity, null: false
31
32
  t.float :quantity_delivered, null: false, default: 0
@@ -10,6 +10,11 @@ class CreateComeeCoreMasterPrices < ActiveRecord::Migration[7.0]
10
10
  t.boolean :primary, null: false, default: false
11
11
  t.float :margin, null: false, default: 0
12
12
  t.integer :lead_time
13
+ t.string :state_of_origin
14
+ t.references :country_of_origin,
15
+ null: true,
16
+ index: {name: "coo_on_ccmp_indx"},
17
+ foreign_key: {to_table: :comee_core_lookups}
13
18
  t.references :product,
14
19
  null: false,
15
20
  index: {name: "product_on_ccmp_indx"},
@@ -27,6 +27,10 @@ class CreateComeeCoreCustomsDetails < ActiveRecord::Migration[7.1]
27
27
  t.string :closure_mark4
28
28
  t.string :closure_mark5
29
29
  t.jsonb :transportation_route
30
+ t.string :mode_of_transport_at_border
31
+ t.string :mode_of_transport_nationality
32
+ t.string :type_of_identification
33
+ t.string :nationality
30
34
 
31
35
  t.timestamps
32
36
  end
@@ -13,6 +13,7 @@ class CreateComeeCoreShipmentItems < ActiveRecord::Migration[7.1]
13
13
  t.string :pallet_no
14
14
  t.string :consignee
15
15
  t.string :order_number, null: false
16
+ t.string :package_type, default: "PX - Palette"
16
17
 
17
18
  t.timestamps
18
19
  end
@@ -6,6 +6,7 @@ class CreateComeeCorePurchaseRequisitions < ActiveRecord::Migration[7.1]
6
6
  t.date :delivery_date
7
7
  t.string :remark
8
8
  t.integer :status, null: false, default: 0
9
+ t.integer :purchase_status, null: false, default: 0
9
10
  t.float :total_price, null: false, default: 0
10
11
 
11
12
  t.timestamps
@@ -5,6 +5,7 @@ class CreateComeeCoreClientAddresses < ActiveRecord::Migration[7.1]
5
5
  null: false,
6
6
  index: {name: "cl_on_ccca_indx"},
7
7
  foreign_key: {to_table: :comee_core_clients}
8
+ t.string :name, null: false
8
9
  t.string :address_line1, null: false
9
10
  t.string :street
10
11
  t.string :city
@@ -15,6 +16,7 @@ class CreateComeeCoreClientAddresses < ActiveRecord::Migration[7.1]
15
16
  foreign_key: {to_table: :comee_core_lookups}
16
17
  t.string :postal_code
17
18
  t.string :address_type, null: false
19
+ t.boolean :default, default: false
18
20
 
19
21
  t.timestamps
20
22
  end
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.2.88".freeze
3
+ VERSION = "0.2.89".freeze
4
4
  end
5
5
  end
@@ -9,5 +9,6 @@ FactoryBot.define do
9
9
  country
10
10
  postal_code { Faker::Address.postcode }
11
11
  address_type { Comee::Core::ClientAddress::SHIPPING_ADDRESS }
12
+ default { false }
12
13
  end
13
14
  end
@@ -3,6 +3,7 @@ FactoryBot.define do
3
3
  user
4
4
  sequence(:code) { |n| "#{Faker::Alphanumeric.unique.alpha(number: 8)}-#{n}" }
5
5
  name { Faker::Name.name }
6
+ match_code { Faker::Name.name }
6
7
  address { Faker::Address.full_address }
7
8
  locale { "en" }
8
9
  parent { nil }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: comee_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.88
4
+ version: 0.2.89
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
@@ -433,6 +433,7 @@ files:
433
433
  - db/migrate/20230727091518_create_comee_core_fulfillment_centers.rb
434
434
  - db/migrate/20230727153013_create_comee_core_units.rb
435
435
  - db/migrate/20230728011037_create_comee_core_currencies.rb
436
+ - db/migrate/20230728011539_create_comee_core_lookups.rb
436
437
  - db/migrate/20230728014322_create_comee_core_products.rb
437
438
  - db/migrate/20230728122618_create_comee_core_suppliers.rb
438
439
  - db/migrate/20230728123039_create_comee_core_clients.rb
@@ -458,7 +459,6 @@ files:
458
459
  - db/migrate/20231121132709_create_comee_core_quotation_request_items.rb
459
460
  - db/migrate/20231122094424_create_comee_core_external_rfqs.rb
460
461
  - db/migrate/20231124120907_create_active_storage_tables.active_storage.rb
461
- - db/migrate/20231125111539_create_comee_core_lookups.rb
462
462
  - db/migrate/20231125115522_create_comee_core_customs_details.rb
463
463
  - db/migrate/20231206082503_create_comee_core_unit_conversions.rb
464
464
  - db/migrate/20231207153420_create_comee_core_shipment_items.rb
@@ -483,14 +483,7 @@ files:
483
483
  - db/migrate/20240328132713_create_comee_core_payment_orders.rb
484
484
  - db/migrate/20240328132921_create_comee_core_supplier_payments.rb
485
485
  - db/migrate/20240407083617_create_comee_core_email_settings.rb
486
- - db/migrate/20240425121701_add_purchase_status_to_sales_order_and_purchase_requisition.rb
487
486
  - db/migrate/20240503040722_create_comee_core_client_addresses.rb
488
- - db/migrate/20240515173010_add_serial_no_to_line_items.rb
489
- - db/migrate/20240601094028_add_additional_fields.rb
490
- - db/migrate/20240602171355_add_order_reference_to_purchase_order.rb
491
- - db/migrate/20240604142805_add_serial_no_to_purchase_order_items.rb
492
- - db/migrate/20240604155157_add_fields_to_customs_details.rb
493
- - db/migrate/20240608094721_add_package_type_to_shipment_item.rb
494
487
  - lib/comee/core.rb
495
488
  - lib/comee/core/engine.rb
496
489
  - lib/comee/core/version.rb
@@ -1,6 +0,0 @@
1
- class AddPurchaseStatusToSalesOrderAndPurchaseRequisition < ActiveRecord::Migration[7.1]
2
- def change
3
- add_column :comee_core_sales_orders, :purchase_status, :integer, default: 0
4
- add_column :comee_core_purchase_requisitions, :purchase_status, :integer, default: 0
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- class AddSerialNoToLineItems < ActiveRecord::Migration[7.1]
2
- def change
3
- add_column :comee_core_customer_order_items, :serial_no, :integer, null: false, default: 1
4
- add_column :comee_core_sales_order_items, :serial_no, :integer, null: false, default: 1
5
- end
6
- end
@@ -1,32 +0,0 @@
1
- class AddAdditionalFields < ActiveRecord::Migration[7.1]
2
- def change
3
- add_column :comee_core_client_addresses, :name, :string, null: false, default: "Default"
4
- add_column :comee_core_products, :customs_description, :string, null: true
5
- add_column :comee_core_suppliers, :payment_terms, :string, null: false, default: "30 Days Net"
6
- add_column :comee_core_suppliers, :vat_number, :string, null: true
7
- add_column :comee_core_suppliers, :tax_code, :string, null: true
8
- add_column :comee_core_clients, :tax_code, :string, null: true
9
- add_column :comee_core_clients, :vat_number, :string, null: true
10
- add_column :comee_core_master_prices, :state_of_origin, :string, null: true
11
- add_reference :comee_core_master_prices,
12
- :country_of_origin,
13
- null: true,
14
- index: {name: "coo_on_ccmp_indx"},
15
- foreign_key: {to_table: :comee_core_lookups}
16
- add_reference :comee_core_clients,
17
- :country,
18
- null: true,
19
- index: {name: "country_on_ccc_indx"},
20
- foreign_key: {to_table: :comee_core_lookups}
21
- reversible do |dir|
22
- dir.up do
23
- execute <<-SQL
24
- UPDATE comee_core_products
25
- SET customs_description = description
26
- SQL
27
- end
28
- end
29
-
30
- change_column_null :comee_core_products, :customs_description, false
31
- end
32
- end
@@ -1,5 +0,0 @@
1
- class AddOrderReferenceToPurchaseOrder < ActiveRecord::Migration[7.1]
2
- def change
3
- add_column :comee_core_purchase_orders, :order_reference, :string, null: true
4
- end
5
- end
@@ -1,5 +0,0 @@
1
- class AddSerialNoToPurchaseOrderItems < ActiveRecord::Migration[7.1]
2
- def change
3
- add_column :comee_core_purchase_order_items, :serial_no, :integer, null: false, default: 1
4
- end
5
- end
@@ -1,8 +0,0 @@
1
- class AddFieldsToCustomsDetails < ActiveRecord::Migration[7.1]
2
- def change
3
- add_column :comee_core_customs_details, :mode_of_transport_at_border, :string
4
- add_column :comee_core_customs_details, :mode_of_transport_nationality, :string
5
- add_column :comee_core_customs_details, :type_of_identification, :string
6
- add_column :comee_core_customs_details, :nationality, :string
7
- end
8
- end
@@ -1,5 +0,0 @@
1
- class AddPackageTypeToShipmentItem < ActiveRecord::Migration[7.1]
2
- def change
3
- add_column :comee_core_shipment_items, :package_type, :string, default: "PX - Palette"
4
- end
5
- end