comee_core 0.2.2 → 0.2.4

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: dee86ba54d03d24746b9bee9206b141b1fe630e4f25197073e6da4b400a4bbca
4
- data.tar.gz: 8626a1eebf4ee8ad7f236e5832598f5a41ee3cc3a5c9d0238d307f3a219062fb
3
+ metadata.gz: 533b12b534893ae3a9ab0fe5976dfa979948f08d81d4d9f0358198b2f4107cc5
4
+ data.tar.gz: bddaa2611d2356cd19a8baad4aa6a4ef43166ffb88ac3d5bbba0a13638f769a1
5
5
  SHA512:
6
- metadata.gz: 6a140b4c3860bc2c115297768421772b749a9ca23560027b2f2e3d7bee0a63c60397badc4b4aea3d12ab85edb7161289c9c4cb2387cea8f9da1efd5616671a03
7
- data.tar.gz: c9b452eaedcf75e2a42265dfd4eed794f32b7fbce5febacf51014716ca2c13aae0509bc7f698760d3ab47268def7fc928255bdc33b3e11e9fc7981d73cf09518
6
+ metadata.gz: 9398df564bb22dd6bf7be8e9951d0c3889c398557e674087a61594dd3c166c553b56527fa70ef0abc735c7edcf837b2211ea222c62fa4578631e96f40b3581f6
7
+ data.tar.gz: 84b0d8c2415dc761605629ba662722f09789c13a1dda2c77d8966677427b5dd674e50a81990bb4fc71f26a8a271f928da4df8a443800ae72dc7114817d17d092
@@ -2,6 +2,7 @@ module Comee
2
2
  module Core
3
3
  class Invoice < ApplicationRecord
4
4
  belongs_to :sales_order
5
+ belongs_to :pod
5
6
  has_many :invoice_items
6
7
 
7
8
  has_noticed_notifications model_name: "Comee::Core::Notification"
@@ -10,9 +11,12 @@ module Comee
10
11
  enum :payment_status, {not_paid: 0, partially_paid: 1, fully_paid: 2, overpaid: 3}
11
12
 
12
13
  validates :invoice_no, presence: true, uniqueness: true
13
- validates :date_issued, :payment_term, :status, :payment_status, presence: true
14
+ validates :status, :payment_status, presence: true
14
15
  validates :total_price, numericality: {greater_than_or_equal_to: 0, allow_nil: true}
15
16
 
17
+ delegate(:order_number, to: :sales_order, prefix: false)
18
+ delegate(:reference_no, to: :pod, prefix: true)
19
+
16
20
  def self.ransackable_attributes(_auth_object = nil)
17
21
  %w[
18
22
  id
@@ -3,6 +3,7 @@ module Comee
3
3
  class Pod < ApplicationRecord
4
4
  enum :status, {draft: 0, confirmed: 1, signed: 2}
5
5
  has_many :shipment_instruction_items
6
+ has_many :invoices
6
7
 
7
8
  validates :reference_no, :status, presence: true
8
9
  end
@@ -6,6 +6,10 @@ class CreateComeeCoreInvoices < ActiveRecord::Migration[7.0]
6
6
  null: false,
7
7
  index: {name: "co_on_cci_indx"},
8
8
  foreign_key: {to_table: :comee_core_sales_orders}
9
+ t.references :pod,
10
+ null: false,
11
+ index: {name: "pod_on_cci_indx"},
12
+ foreign_key: {to_table: :comee_core_pods}
9
13
  t.date :date_issued
10
14
  t.date :due_date
11
15
  t.float :total_price
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.2.2".freeze
3
+ VERSION = "0.2.4".freeze
4
4
  end
5
5
  end
@@ -2,6 +2,7 @@ FactoryBot.define do
2
2
  factory :invoice, class: "Comee::Core::Invoice" do
3
3
  invoice_no { Faker::Alphanumeric.alpha(number: 8) }
4
4
  sales_order
5
+ pod
5
6
  date_issued { Date.current }
6
7
  due_date { Date.current.advance(days: 10) }
7
8
  total_price { 0 }
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.2
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henock L.