comee_core 0.2.3 → 0.2.5

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: c3e3cec335fce496f7b2a857329c5c098631310a7bcfa3d2e21a62fc38041c56
4
- data.tar.gz: 3dc1d1f162ea1179e5f51f5ab0213a264a336b9400f7af90b7b1fa998f638340
3
+ metadata.gz: 709ba512de5167e177d2bd3590f8e63cfc327736b9701763cf43da56e55ec1b7
4
+ data.tar.gz: d5a59cda7b72aa7eb070d3fe7e8dac183aa037aed22e950023d22912801991c0
5
5
  SHA512:
6
- metadata.gz: 561f02819a07e98ba47fe8d0b522c54639b201d29fb2ba7720eae53e86e7de480ad06d86c16f49b316157ce5cbcbca15c3620bd121cbf91b253b424910a896b7
7
- data.tar.gz: fe59c449c4d1120992b3cb2c5d0cde23f3fe84945b58b9e74e766b0ea8bd4ddab6c4ebe78324c9ffc66e9bcdef22e89fd1933d8a055e58fb13b55790fccd766b
6
+ metadata.gz: ee1d492b05abb3e6e2ec223931ffee4616a3c3894a8b707dd0ae3e4bc8930e57c532860ed2084cd43beea39d2b7a3ba427ac29ca650b13e4ec8ea77b098dc786
7
+ data.tar.gz: facd7621610fa761f80e0137743eb9ad6b66d090fd0c5264f82e123141b468808e1e7059c76fc64a4f55e0b32b3f4af32e4612fad123a6f351a8ebadfdc8f1bc
@@ -0,0 +1,9 @@
1
+ module Comee
2
+ module Core
3
+ class AdditionalItem < ApplicationRecord
4
+ belongs_to :invoice
5
+
6
+ validates :quantity, :unit_price, presence: true, numericality: {greater_than: 0}
7
+ end
8
+ end
9
+ end
@@ -4,6 +4,7 @@ module Comee
4
4
  belongs_to :sales_order
5
5
  belongs_to :pod
6
6
  has_many :invoice_items
7
+ has_many :additional_items
7
8
 
8
9
  has_noticed_notifications model_name: "Comee::Core::Notification"
9
10
 
@@ -11,9 +12,12 @@ module Comee
11
12
  enum :payment_status, {not_paid: 0, partially_paid: 1, fully_paid: 2, overpaid: 3}
12
13
 
13
14
  validates :invoice_no, presence: true, uniqueness: true
14
- validates :date_issued, :payment_term, :status, :payment_status, presence: true
15
+ validates :status, :payment_status, presence: true
15
16
  validates :total_price, numericality: {greater_than_or_equal_to: 0, allow_nil: true}
16
17
 
18
+ delegate(:order_number, to: :sales_order, prefix: false)
19
+ delegate(:reference_no, to: :pod, prefix: true)
20
+
17
21
  def self.ransackable_attributes(_auth_object = nil)
18
22
  %w[
19
23
  id
@@ -0,0 +1,15 @@
1
+ class CreateComeeCoreAdditionalItems < ActiveRecord::Migration[7.1]
2
+ def change
3
+ create_table :comee_core_additional_items do |t|
4
+ t.references :invoice,
5
+ null: false,
6
+ index: {name: "invoice_on_ccai_indx"},
7
+ foreign_key: {to_table: :comee_core_invoices}
8
+ t.float :quantity, null: false, default: 1
9
+ t.float :unit_price, null: false
10
+ t.float :total_price, null: false
11
+
12
+ t.timestamps
13
+ end
14
+ end
15
+ end
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.2.3".freeze
3
+ VERSION = "0.2.5".freeze
4
4
  end
5
5
  end
@@ -0,0 +1,8 @@
1
+ FactoryBot.define do
2
+ factory :additional_item, class: "Comee::Core::AdditionalItem" do
3
+ invoice
4
+ quantity { 1 }
5
+ unit_price { 1.5 }
6
+ total_price { quantity * unit_price }
7
+ end
8
+ end
@@ -10,5 +10,9 @@ FactoryBot.define do
10
10
  notifications_sent { 0 }
11
11
  status { Comee::Core::Invoice.statuses[:draft] }
12
12
  payment_status { Comee::Core::Invoice.payment_statuses[:not_paid] }
13
+
14
+ trait :approved do
15
+ status { Comee::Core::Invoice.statuses[:approved] }
16
+ end
13
17
  end
14
18
  end
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.3
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.
@@ -299,6 +299,7 @@ files:
299
299
  - app/jobs/comee_core/application_job.rb
300
300
  - app/mailers/comee/core/application_mailer.rb
301
301
  - app/mailers/comee/core/supplier_mailer.rb
302
+ - app/models/comee/core/additional_item.rb
302
303
  - app/models/comee/core/agent.rb
303
304
  - app/models/comee/core/application_record.rb
304
305
  - app/models/comee/core/back_order.rb
@@ -429,11 +430,13 @@ files:
429
430
  - db/migrate/20240109185931_create_comee_core_time_slots.rb
430
431
  - db/migrate/20240111112140_create_comee_core_pickup_schedules.rb
431
432
  - db/migrate/20240119100125_create_comee_core_client_warehouses.rb
433
+ - db/migrate/20240124161320_create_comee_core_additional_items.rb
432
434
  - lib/comee/core.rb
433
435
  - lib/comee/core/engine.rb
434
436
  - lib/comee/core/version.rb
435
437
  - lib/comee_core.rb
436
438
  - lib/tasks/comee_core_tasks.rake
439
+ - spec/factories/comee/core/additional_items.rb
437
440
  - spec/factories/comee/core/agents.rb
438
441
  - spec/factories/comee/core/back_order_items.rb
439
442
  - spec/factories/comee/core/back_orders.rb