comee_core 0.1.10 → 0.1.12
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/clients_controller.rb +13 -0
- data/app/models/comee/core/client.rb +2 -0
- data/app/models/comee/core/client_order_item.rb +3 -0
- data/app/models/comee/core/invoice.rb +19 -0
- data/app/models/comee/core/invoice_item.rb +5 -1
- data/app/serializers/comee/core/client_serializer.rb +7 -0
- data/config/routes.rb +1 -0
- data/lib/comee/core/version.rb +1 -1
- data/spec/factories/comee/core/invoices.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7530cbd96ea9cc406bcfb8ef5c890a8cdfa31d5f43c3d09c07afba8c4c0ce3c
|
4
|
+
data.tar.gz: e8a22cb3298284e49c74ead3edc5fe1168c03e9029f15c3a270c2d6df6414cf3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 463c027f00ad2b09037e091b4fe2cdbfc5b0139c9f3856f81e8f3dde30bf88c3cf1e23d70a56c2acee2f122d7e4ece7d83ade7b9713736b92e1ee7ce62684f95
|
7
|
+
data.tar.gz: 4f6b18b777eaeff508c4c00e23396d9ab1abf740fde0cb155abf00ee2d2ba99eba9d8fbef882b41b0eafea779f1205cc8c08cff0a0ee92308b3e8ddc39e16aea
|
@@ -12,12 +12,31 @@ module Comee
|
|
12
12
|
validates :date_issued, :payment_term, :status, :payment_status, presence: true
|
13
13
|
validates :additional_charges, :total_price, numericality: {greater_than_or_equal_to: 0, allow_nil: true}
|
14
14
|
|
15
|
+
delegate(:order_number, to: :client_order)
|
16
|
+
|
15
17
|
def update_invoice_total
|
16
18
|
self.additional_charges ||= 0
|
17
19
|
self.total_price ||= 0
|
18
20
|
self.total_price -= additional_charges_was if additional_charges_was && additional_charges_changed?
|
19
21
|
self.total_price += additional_charges
|
20
22
|
end
|
23
|
+
|
24
|
+
def self.ransackable_attributes(auth_object = nil)
|
25
|
+
[
|
26
|
+
"client_order_id",
|
27
|
+
"invoice_no",
|
28
|
+
"date_issued",
|
29
|
+
"ship_name",
|
30
|
+
"delivery_date",
|
31
|
+
"voyage_no",
|
32
|
+
"status",
|
33
|
+
"payment_status"
|
34
|
+
]
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.ransackable_associations(auth_object = nil)
|
38
|
+
[]
|
39
|
+
end
|
21
40
|
end
|
22
41
|
end
|
23
42
|
end
|
@@ -7,7 +7,11 @@ module Comee
|
|
7
7
|
belongs_to :client_order_item
|
8
8
|
belongs_to :invoice
|
9
9
|
|
10
|
-
validates :quantity, :unit_price,
|
10
|
+
validates :quantity, :unit_price, presence: true, numericality: {greater_than: 0}
|
11
|
+
validates :total_price, numericality: {greater_than_or_equal_to: 0, allow_nil: true}
|
12
|
+
|
13
|
+
delegate(:product_code, to: :client_order_item)
|
14
|
+
delegate(:product_name, to: :client_order_item)
|
11
15
|
|
12
16
|
def update_invoice_total
|
13
17
|
invoice.total_price = InvoiceItem.where(invoice: invoice).map(&:total_price).sum
|
data/config/routes.rb
CHANGED
data/lib/comee/core/version.rb
CHANGED
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.1.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henock L.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-09-
|
11
|
+
date: 2023-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -232,6 +232,7 @@ files:
|
|
232
232
|
- Rakefile
|
233
233
|
- app/controllers/comee/core/access_controller.rb
|
234
234
|
- app/controllers/comee/core/application_controller.rb
|
235
|
+
- app/controllers/comee/core/clients_controller.rb
|
235
236
|
- app/controllers/comee/core/currencies_controller.rb
|
236
237
|
- app/controllers/comee/core/notifications_controller.rb
|
237
238
|
- app/controllers/comee/core/product_types_controller.rb
|
@@ -262,6 +263,7 @@ files:
|
|
262
263
|
- app/models/comee/core/unit.rb
|
263
264
|
- app/models/comee/core/user.rb
|
264
265
|
- app/notifications/comee/core/new_order_notification.rb
|
266
|
+
- app/serializers/comee/core/client_serializer.rb
|
265
267
|
- app/serializers/comee/core/currency_serializer.rb
|
266
268
|
- app/serializers/comee/core/product_serializer.rb
|
267
269
|
- app/serializers/comee/core/product_type_serializer.rb
|