comee_core 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/comee/core/sales_orders_controller.rb +1 -1
- data/app/controllers/comee/core/shipment_items_controller.rb +1 -1
- data/app/models/comee/core/invoice.rb +2 -12
- data/app/models/comee/core/invoice_item.rb +2 -10
- data/app/models/comee/core/item_status.rb +1 -1
- data/app/models/comee/core/shipment_item.rb +1 -1
- data/app/serializers/comee/core/sales_order_serializer.rb +1 -1
- data/app/serializers/comee/core/shipment_item_serializer.rb +2 -1
- data/app/services/comee/core/customer_order_service.rb +1 -0
- data/db/migrate/20230812190652_create_comee_core_sales_orders.rb +1 -0
- data/db/migrate/20231207153420_create_comee_core_shipment_items.rb +2 -0
- data/db/migrate/{20230915205522_create_comee_core_invoices.rb → 20240105205522_create_comee_core_invoices.rb} +3 -6
- data/db/migrate/{20230915205648_create_comee_core_invoice_items.rb → 20240105205648_create_comee_core_invoice_items.rb} +8 -4
- data/lib/comee/core/version.rb +1 -1
- data/spec/factories/comee/core/invoice_items.rb +3 -2
- data/spec/factories/comee/core/invoices.rb +2 -5
- data/spec/factories/comee/core/sales_orders.rb +1 -0
- data/spec/factories/comee/core/shipment_items.rb +2 -0
- metadata +5 -5
- /data/db/migrate/{20240103074619_create_comee_core_pods.rb → 20240104074619_create_comee_core_pods.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dee86ba54d03d24746b9bee9206b141b1fe630e4f25197073e6da4b400a4bbca
|
4
|
+
data.tar.gz: 8626a1eebf4ee8ad7f236e5832598f5a41ee3cc3a5c9d0238d307f3a219062fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a140b4c3860bc2c115297768421772b749a9ca23560027b2f2e3d7bee0a63c60397badc4b4aea3d12ab85edb7161289c9c4cb2387cea8f9da1efd5616671a03
|
7
|
+
data.tar.gz: c9b452eaedcf75e2a42265dfd4eed794f32b7fbce5febacf51014716ca2c13aae0509bc7f698760d3ab47268def7fc928255bdc33b3e11e9fc7981d73cf09518
|
@@ -60,7 +60,7 @@ module Comee
|
|
60
60
|
def model_params
|
61
61
|
params.require(:payload).permit(:order_number, :customer_order_id, :payment_penalty, :payment_term, :delivery_term, :status,
|
62
62
|
:fulfillment_center_id, :total_price, :amount_paid, :pallete_note, :handover_date, :remark,
|
63
|
-
:client_id, files: [])
|
63
|
+
:consignee, :client_id, files: [])
|
64
64
|
end
|
65
65
|
|
66
66
|
def back_order_params
|
@@ -1,27 +1,17 @@
|
|
1
1
|
module Comee
|
2
2
|
module Core
|
3
3
|
class Invoice < ApplicationRecord
|
4
|
-
before_save :update_invoice_total
|
5
4
|
belongs_to :sales_order
|
6
5
|
has_many :invoice_items
|
7
6
|
|
8
7
|
has_noticed_notifications model_name: "Comee::Core::Notification"
|
9
8
|
|
10
9
|
enum :status, {draft: 0, approved: 1}
|
11
|
-
enum :payment_status, {
|
10
|
+
enum :payment_status, {not_paid: 0, partially_paid: 1, fully_paid: 2, overpaid: 3}
|
12
11
|
|
13
12
|
validates :invoice_no, presence: true, uniqueness: true
|
14
13
|
validates :date_issued, :payment_term, :status, :payment_status, presence: true
|
15
|
-
validates :
|
16
|
-
|
17
|
-
delegate(:order_number, to: :sales_order)
|
18
|
-
|
19
|
-
def update_invoice_total
|
20
|
-
self.additional_charges ||= 0
|
21
|
-
self.total_price ||= 0
|
22
|
-
self.total_price -= additional_charges_was if additional_charges_was && additional_charges_changed?
|
23
|
-
self.total_price += additional_charges
|
24
|
-
end
|
14
|
+
validates :total_price, numericality: {greater_than_or_equal_to: 0, allow_nil: true}
|
25
15
|
|
26
16
|
def self.ransackable_attributes(_auth_object = nil)
|
27
17
|
%w[
|
@@ -2,21 +2,13 @@ module Comee
|
|
2
2
|
module Core
|
3
3
|
class InvoiceItem < ApplicationRecord
|
4
4
|
before_save { self.total_price = unit_price * quantity }
|
5
|
-
after_save :update_invoice_total
|
6
5
|
|
7
|
-
belongs_to :
|
6
|
+
belongs_to :shipment_instruction_item
|
8
7
|
belongs_to :invoice
|
8
|
+
belongs_to :unit
|
9
9
|
|
10
10
|
validates :quantity, :unit_price, presence: true, numericality: {greater_than: 0}
|
11
11
|
validates :total_price, numericality: {greater_than_or_equal_to: 0, allow_nil: true}
|
12
|
-
|
13
|
-
delegate(:product_code, to: :sales_order_item)
|
14
|
-
delegate(:product_name, to: :sales_order_item)
|
15
|
-
|
16
|
-
def update_invoice_total
|
17
|
-
invoice.total_price = InvoiceItem.where(invoice: invoice).map(&:total_price).sum
|
18
|
-
invoice.save!
|
19
|
-
end
|
20
12
|
end
|
21
13
|
end
|
22
14
|
end
|
@@ -2,7 +2,7 @@ module Comee
|
|
2
2
|
module Core
|
3
3
|
class ItemStatus < ApplicationRecord
|
4
4
|
INITIALIZED = "Initialized".freeze
|
5
|
-
DELIVERY_NOTE_CREATED = "Delivery
|
5
|
+
DELIVERY_NOTE_CREATED = "Delivery Note Created".freeze
|
6
6
|
COMPLETELY_PICKED_AND_PACKED = "Completely Picked & Packed".freeze
|
7
7
|
PARTIALLY_PICKED_AND_PACKED = "Partially Picked & Packed".freeze
|
8
8
|
|
@@ -6,7 +6,7 @@ module Comee
|
|
6
6
|
belongs_to :sales_order_item
|
7
7
|
has_many :item_statuses
|
8
8
|
|
9
|
-
validates :handover_date, :delivery_date, :shipment_status, :status, presence: true
|
9
|
+
validates :handover_date, :delivery_date, :shipment_status, :status, :order_number, presence: true
|
10
10
|
validates :quantity, presence: true, numericality: {greater_than: 0}
|
11
11
|
|
12
12
|
def self.ransackable_attributes(_auth_object = nil)
|
@@ -2,7 +2,7 @@ module Comee
|
|
2
2
|
module Core
|
3
3
|
class SalesOrderSerializer < ActiveModel::Serializer
|
4
4
|
attributes :id, :order_number, :payment_penalty, :status, :total_price, :payment_term, :delivery_term, :amount_paid,
|
5
|
-
:pallete_note, :handover_date, :remark, :parent_client_name, :created_by, :files_url, :customs_detail
|
5
|
+
:pallete_note, :handover_date, :remark, :parent_client_name, :created_by, :files_url, :customs_detail, :consignee
|
6
6
|
belongs_to :customer_order
|
7
7
|
belongs_to :client
|
8
8
|
belongs_to :fulfillment_center
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module Comee
|
2
2
|
module Core
|
3
3
|
class ShipmentItemSerializer < ActiveModel::Serializer
|
4
|
-
attributes :id, :quantity, :shipment_status, :status, :handover_date, :delivery_date, :pallet_no
|
4
|
+
attributes :id, :quantity, :shipment_status, :status, :handover_date, :delivery_date, :pallet_no, :consignee,
|
5
|
+
:order_number
|
5
6
|
belongs_to :sales_order_item
|
6
7
|
end
|
7
8
|
end
|
@@ -14,6 +14,7 @@ class CreateComeeCoreSalesOrders < ActiveRecord::Migration[7.0]
|
|
14
14
|
null: false,
|
15
15
|
index: {name: "client_on_ccso_indx"},
|
16
16
|
foreign_key: {to_table: :comee_core_clients}
|
17
|
+
t.string :consignee
|
17
18
|
t.string :parent_client_name
|
18
19
|
t.string :payment_term
|
19
20
|
t.string :delivery_term
|
@@ -6,13 +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.date :date_issued
|
10
|
-
t.
|
11
|
-
t.date :delivery_date
|
12
|
-
t.string :voyage_no
|
13
|
-
t.float :additional_charges
|
9
|
+
t.date :date_issued
|
10
|
+
t.date :due_date
|
14
11
|
t.float :total_price
|
15
|
-
t.string :payment_term
|
12
|
+
t.string :payment_term
|
16
13
|
t.integer :notifications_sent
|
17
14
|
t.integer :status, null: false, default: 0
|
18
15
|
t.integer :payment_status, null: false, default: 0
|
@@ -1,13 +1,17 @@
|
|
1
1
|
class CreateComeeCoreInvoiceItems < ActiveRecord::Migration[7.0]
|
2
2
|
def change
|
3
3
|
create_table :comee_core_invoice_items do |t|
|
4
|
-
t.references :
|
4
|
+
t.references :shipment_instruction_item,
|
5
5
|
null: false,
|
6
|
-
index: {name: "
|
7
|
-
foreign_key: {to_table: :
|
6
|
+
index: {name: "sii_on_ccii_indx"},
|
7
|
+
foreign_key: {to_table: :comee_core_shipment_instruction_items}
|
8
|
+
t.references :unit,
|
9
|
+
null: false,
|
10
|
+
index: {name: "unit_on_ccii_indx"},
|
11
|
+
foreign_key: {to_table: :comee_core_units}
|
8
12
|
t.float :quantity, null: false
|
9
13
|
t.float :unit_price, null: false
|
10
|
-
t.float :total_price
|
14
|
+
t.float :total_price
|
11
15
|
t.references :invoice,
|
12
16
|
null: false,
|
13
17
|
index: {name: "invoice_on_ccii_indx"},
|
data/lib/comee/core/version.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :invoice_item, class: "Comee::Core::InvoiceItem" do
|
3
|
-
|
3
|
+
shipment_instruction_item
|
4
|
+
unit
|
4
5
|
quantity { 10 }
|
5
6
|
unit_price { 5 }
|
6
|
-
total_price {
|
7
|
+
total_price { quantity * unit_price }
|
7
8
|
invoice
|
8
9
|
end
|
9
10
|
end
|
@@ -3,14 +3,11 @@ FactoryBot.define do
|
|
3
3
|
invoice_no { Faker::Alphanumeric.alpha(number: 8) }
|
4
4
|
sales_order
|
5
5
|
date_issued { Date.current }
|
6
|
-
|
7
|
-
delivery_date { Date.current.advance(days: -7) }
|
8
|
-
voyage_no { Faker::Alphanumeric.alpha(number: 10) }
|
9
|
-
additional_charges { 0 }
|
6
|
+
due_date { Date.current.advance(days: 10) }
|
10
7
|
total_price { 0 }
|
11
8
|
payment_term { Faker::Lorem.sentence }
|
12
9
|
notifications_sent { 0 }
|
13
10
|
status { Comee::Core::Invoice.statuses[:draft] }
|
14
|
-
payment_status {
|
11
|
+
payment_status { Comee::Core::Invoice.payment_statuses[:not_paid] }
|
15
12
|
end
|
16
13
|
end
|
@@ -11,6 +11,7 @@ FactoryBot.define do
|
|
11
11
|
amount_paid { 0 }
|
12
12
|
status { Comee::Core::SalesOrder.statuses[:draft] }
|
13
13
|
pallete_note { Faker::Lorem.sentence }
|
14
|
+
consignee { Faker::Name.name }
|
14
15
|
remark { Faker::Lorem.sentence }
|
15
16
|
parent_client_name { Faker::Name.name }
|
16
17
|
created_by { Faker::Name.name }
|
@@ -7,5 +7,7 @@ FactoryBot.define do
|
|
7
7
|
handover_date { Date.current.advance(days: 3) }
|
8
8
|
delivery_date { Date.current.advance(days: 6) }
|
9
9
|
pallet_no { Faker::Alphanumeric.alpha(number: 10) }
|
10
|
+
consignee { Faker::Name.name }
|
11
|
+
order_number { sales_order_item.sales_order.order_number }
|
10
12
|
end
|
11
13
|
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.
|
4
|
+
version: 0.2.2
|
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-01-
|
11
|
+
date: 2024-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -405,8 +405,6 @@ files:
|
|
405
405
|
- db/migrate/20230813041307_create_comee_core_product_lookups.rb
|
406
406
|
- db/migrate/20230813235946_create_comee_core_master_prices.rb
|
407
407
|
- db/migrate/20230814151601_create_comee_core_client_prices.rb
|
408
|
-
- db/migrate/20230915205522_create_comee_core_invoices.rb
|
409
|
-
- db/migrate/20230915205648_create_comee_core_invoice_items.rb
|
410
408
|
- db/migrate/20230929115336_create_comee_core_order_sources.rb
|
411
409
|
- db/migrate/20230929130910_create_comee_core_client_orders.rb
|
412
410
|
- db/migrate/20231003073316_create_comee_core_inventories.rb
|
@@ -422,9 +420,11 @@ files:
|
|
422
420
|
- db/migrate/20231206082503_create_comee_core_unit_conversions.rb
|
423
421
|
- db/migrate/20231207153420_create_comee_core_shipment_items.rb
|
424
422
|
- db/migrate/20231207235542_create_comee_core_item_statuses.rb
|
425
|
-
- db/migrate/
|
423
|
+
- db/migrate/20240104074619_create_comee_core_pods.rb
|
426
424
|
- db/migrate/20240104131607_create_comee_core_shipment_instructions.rb
|
427
425
|
- db/migrate/20240104143246_create_comee_core_shipment_instruction_items.rb
|
426
|
+
- db/migrate/20240105205522_create_comee_core_invoices.rb
|
427
|
+
- db/migrate/20240105205648_create_comee_core_invoice_items.rb
|
428
428
|
- db/migrate/20240109185749_create_comee_core_transport_availability.rb
|
429
429
|
- db/migrate/20240109185931_create_comee_core_time_slots.rb
|
430
430
|
- db/migrate/20240111112140_create_comee_core_pickup_schedules.rb
|
File without changes
|