comee_core 0.2.75 → 0.2.76

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: b084265603916c466600ccc3fff6d9ef6ff4cf1f1b99c0737f73b3bcce1fba9f
4
- data.tar.gz: da7a721c46628d8431e6c50805bb492ff4549c820545e3c0530b6c117dd0f3ff
3
+ metadata.gz: 300022f87054a7910cee755a85daa8b02afb1131fc313fb7335b3169094d9cd6
4
+ data.tar.gz: 322deb26131db4347a067ccccc1226648cad60012da51414bc388f49c8e909d1
5
5
  SHA512:
6
- metadata.gz: 1f0687b490d5f5edb11b517ef53ab9f54e8257fcda886dc4e38aa95cad7760d404e4c1d12188eaa90ed1a46b384ef57a8f0269acf8f5921e496d6dee5d27912b
7
- data.tar.gz: 918d7e7b9212b734d530064c34a974b986645593414d7dd9f6282c6a2e0f1d6c477862c1cd0526faf1faae262b56ea4363f4f13627254f9a3de51681f24c40a3
6
+ metadata.gz: c71677f694e85591ae9f3c556393b2b1fac636cf4832c5da7cddcf855eb83294b1d5dfedd6416fc7d7a9c89bcce28883eda72ab6a5fae723a399ab1a2fb46f9d
7
+ data.tar.gz: d8478bc7889140d81851f51da46a3d07b121564d71d5eb5bc0bc7612772b893bab2090bf6baa34271696d4ebc9741813dcde76fb981c1074fd3e132e15a04c3c
@@ -5,12 +5,13 @@ module Comee
5
5
 
6
6
  def index
7
7
  super do
8
- Client.includes(:parent, :agents, :contacts, :client_warehouses, :user, :currency).all
8
+ Client.includes(:parent, :agents, :contacts, :client_warehouses, :country, :user, :currency).all
9
9
  end
10
10
  end
11
11
 
12
12
  def filter
13
- clients = Client.includes(:parent, :agents, :contacts, :client_warehouses, :user, :currency).ransack(params[:q]).result
13
+ clients = Client.includes(:parent, :agents, :contacts, :client_warehouses, :country, :user, :currency)
14
+ .ransack(params[:q]).result
14
15
  render_content(clients)
15
16
  end
16
17
 
@@ -56,7 +57,7 @@ module Comee
56
57
 
57
58
  def model_params
58
59
  params.require(:payload).permit(:code, :name, :address, :locale, :user_id, :parent_id, :currency, :subsidiary,
59
- consignees: [])
60
+ :country_id, :tax_code, :vat_number, consignees: [])
60
61
  end
61
62
 
62
63
  def agent_params
@@ -45,9 +45,9 @@ module Comee
45
45
  private
46
46
 
47
47
  def model_params
48
- params.required(:payload).permit(:code, :name, :description, :parent_id, :thumbnail_image, :source_id, :weight,
49
- :weight_unit_id, :dimensions, :hs_code, :hs_description, images: [],
50
- preferred_units: %i[id code label])
48
+ params.required(:payload)
49
+ .permit(:code, :name, :description, :customs_description, :parent_id, :thumbnail_image, :source_id, :weight,
50
+ :weight_unit_id, :dimensions, :hs_code, :hs_description, images: [], preferred_units: %i[id code label])
51
51
  end
52
52
 
53
53
  def price_params
@@ -17,7 +17,7 @@ module Comee
17
17
  private
18
18
 
19
19
  def model_params
20
- params.require(:payload).permit(:code, :name, :address, :locale, :currency_id)
20
+ params.require(:payload).permit(:code, :name, :address, :locale, :payment_terms, :currency_id)
21
21
  end
22
22
  end
23
23
  end
@@ -3,6 +3,7 @@ module Comee
3
3
  class Client < ApplicationRecord
4
4
  belongs_to :user, optional: true
5
5
  belongs_to :parent, class_name: "Comee::Core::Client", optional: true
6
+ belongs_to :country, -> { where(lookup_type: :country) }, class_name: "Comee::Core::Lookup", optional: true
6
7
  belongs_to :currency, optional: true
7
8
  has_and_belongs_to_many :contacts, join_table: :comee_core_clients_contacts
8
9
  has_and_belongs_to_many :agents, join_table: :comee_core_clients_agents
@@ -10,7 +10,7 @@ module Comee
10
10
  belongs_to :client
11
11
  belongs_to :country, -> { where(lookup_type: :country) }, class_name: "Comee::Core::Lookup"
12
12
 
13
- validates :address_line1, :address_type, presence: true
13
+ validates :name, :address_line1, :address_type, presence: true
14
14
  validates :address_type, inclusion: {in: ADDRESS_TYPES}
15
15
  end
16
16
  end
@@ -5,6 +5,7 @@ module Comee
5
5
  belongs_to :supplier
6
6
  belongs_to :previous_price, class_name: "Comee::Core::MasterPrice", optional: true
7
7
  belongs_to :next_price, class_name: "Comee::Core::MasterPrice", optional: true
8
+ belongs_to :country_of_origin, -> { where(lookup_type: :country) }, class_name: "Comee::Core::Lookup", optional: true
8
9
  belongs_to :product_lookup, optional: true
9
10
 
10
11
  validates :purchase_price, :selling_price, presence: true
@@ -11,7 +11,7 @@ module Comee
11
11
  belongs_to :weight_unit, class_name: "Comee::Core::Unit", optional: true
12
12
 
13
13
  validates :code, presence: true, uniqueness: true
14
- validates :name, presence: true
14
+ validates :name, :customs_description, presence: true
15
15
 
16
16
  scope :leafs, -> { where(leaf: true) }
17
17
 
@@ -30,7 +30,7 @@ module Comee
30
30
  end
31
31
 
32
32
  def self.ransackable_attributes(_auth_object = nil)
33
- %w[id code name description leaf]
33
+ %w[id code name description customs_description leaf]
34
34
  end
35
35
 
36
36
  def self.ransackable_associations(_auth_object = nil)
@@ -6,7 +6,7 @@ module Comee
6
6
  has_and_belongs_to_many :contacts, join_table: :comee_core_suppliers_contacts
7
7
 
8
8
  validates :code, presence: true, uniqueness: true
9
- validates :name, :address, :locale, presence: true
9
+ validates :name, :address, :locale, :payment_terms, presence: true
10
10
 
11
11
  def self.ransackable_attributes(_auth_object = nil)
12
12
  %w[id user_id code address locale]
@@ -1,7 +1,7 @@
1
1
  module Comee
2
2
  module Core
3
3
  class ClientAddressSerializer < ActiveModel::Serializer
4
- attributes :id, :address_line1, :street, :city, :state, :country_id, :postal_code, :address_type, :client_id
4
+ attributes :id, :name, :address_line1, :street, :city, :state, :country_id, :postal_code, :address_type, :client_id
5
5
 
6
6
  belongs_to :client
7
7
  belongs_to :country
@@ -2,8 +2,9 @@ module Comee
2
2
  module Core
3
3
  class ClientSerializer < ActiveModel::Serializer
4
4
  attributes :id, :code, :name, :address, :locale, :user_id, :user_name, :parent_id, :consignees, :shipment_addresses,
5
- :currency
5
+ :tax_code, :vat_number, :currency
6
6
  belongs_to :parent
7
+ belongs_to :country
7
8
  has_many :agents
8
9
  has_many :contacts
9
10
  has_many :client_warehouses
@@ -2,11 +2,12 @@ module Comee
2
2
  module Core
3
3
  class MasterPriceSerializer < ActiveModel::Serializer
4
4
  attributes :id, :purchase_price, :selling_price, :valid_from, :valid_to, :primary, :margin, :lead_time, :status,
5
- :price_status
5
+ :price_status, :state_of_origin
6
6
  belongs_to :product
7
7
  belongs_to :supplier
8
8
  belongs_to :product_lookup
9
9
  belongs_to :unit
10
+ belongs_to :country_of_origin
10
11
  end
11
12
  end
12
13
  end
@@ -1,8 +1,8 @@
1
1
  module Comee
2
2
  module Core
3
3
  class ProductSerializer < ActiveModel::Serializer
4
- attributes :id, :code, :name, :description, :thumbnail_image_url, :images_url, :preferred_units, :weight,
5
- :dimensions, :hs_code, :hs_description, :parent_id
4
+ attributes :id, :code, :name, :description, :customs_description, :thumbnail_image_url, :images_url, :preferred_units,
5
+ :weight, :dimensions, :hs_code, :hs_description, :parent_id
6
6
  belongs_to :source
7
7
  belongs_to :weight_unit
8
8
  end
@@ -1,7 +1,7 @@
1
1
  module Comee
2
2
  module Core
3
3
  class SupplierSerializer < ActiveModel::Serializer
4
- attributes :id, :code, :name, :address, :locale, :user_id
4
+ attributes :id, :code, :name, :address, :locale, :user_id, :payment_terms
5
5
  belongs_to :currency
6
6
  end
7
7
  end
@@ -0,0 +1,32 @@
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 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.2.75".freeze
3
+ VERSION = "0.2.76".freeze
4
4
  end
5
5
  end
@@ -1,6 +1,7 @@
1
1
  FactoryBot.define do
2
2
  factory :client_address, class: "Comee::Core::ClientAddress" do
3
3
  client
4
+ name { Faker::Name.name }
4
5
  address_line1 { Faker::Address.street_address }
5
6
  street { Faker::Address.street_name }
6
7
  city { Faker::Address.city }
@@ -1,11 +1,12 @@
1
1
  FactoryBot.define do
2
2
  factory :product, class: "Comee::Core::Product" do
3
3
  transient do
4
- root { Comee::Core::Product.where(code: "ROOT", name: "Products", leaf: false).first_or_create }
4
+ root { Comee::Core::Product.where(code: "ROOT", name: "Products", customs_description: "Products", leaf: false).first_or_create }
5
5
  end
6
6
  sequence(:code) { |n| "#{Faker::Alphanumeric.unique.alpha(number: 6)}-#{n}" }
7
7
  name { Faker::Name.name }
8
8
  description { Faker::Lorem.sentence }
9
+ customs_description { Faker::Lorem.sentence }
9
10
  leaf { true }
10
11
  ancestry { root.id.to_s }
11
12
  preferred_units { [] }
@@ -4,6 +4,9 @@ FactoryBot.define do
4
4
  name { Faker::Name.name }
5
5
  address { Faker::Address.full_address }
6
6
  locale { "en" }
7
+ payment_terms { Faker::Lorem.word }
8
+ vat_number { Faker::Alphanumeric.alpha(number: 8) }
9
+ tax_code { Faker::Alphanumeric.alpha(number: 8) }
7
10
  user
8
11
  currency
9
12
  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.75
4
+ version: 0.2.76
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-05-29 00:00:00.000000000 Z
11
+ date: 2024-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers
@@ -470,6 +470,7 @@ files:
470
470
  - db/migrate/20240425121701_add_purchase_status_to_sales_order_and_purchase_requisition.rb
471
471
  - db/migrate/20240503040722_create_comee_core_client_addresses.rb
472
472
  - db/migrate/20240515173010_add_serial_no_to_line_items.rb
473
+ - db/migrate/20240601094028_add_additional_fields.rb
473
474
  - lib/comee/core.rb
474
475
  - lib/comee/core/engine.rb
475
476
  - lib/comee/core/version.rb