comee_core 0.3.42 → 0.3.44
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/comee/core/invoice.rb +4 -2
- data/app/models/comee/core/shipment_instruction_item.rb +11 -0
- data/app/serializers/comee/core/shipment_instruction_item_serializer.rb +1 -1
- data/db/migrate/20240805085256_add_details_to_shipment_instruction_item.rb +5 -0
- data/db/migrate/20240805093326_update_details_column_in_shipment_instruction_items.rb +14 -0
- data/lib/comee/core/version.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: 90b9fd38243f244ee92d50b0f697840aa98dca81e68255ec87553f711436d462
|
4
|
+
data.tar.gz: 8301b49b91fadb81b7b47136ca8293e8427768952a0e2ffca87cab96f8bb8ecf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aeb36d887f7074afc497dc4a8e1e5567a008d35aba4046aea6b9de14beee1771786221aec51ea4045dd927c7719cf7fccbbed8768932a9c2fd5f5888feb4437d
|
7
|
+
data.tar.gz: 1d39c2bc2298531800e5183aa745ddbaf959f92e00a2a223e2d9b770e114b31adca2e9bb40b1f0649f180de68d31cecb906608b6a36768e7dcbdb8ed26e552e6
|
@@ -44,7 +44,7 @@ module Comee
|
|
44
44
|
if: -> { advance? }
|
45
45
|
|
46
46
|
delegate(:order_number, to: :sales_order, prefix: false)
|
47
|
-
delegate(:reference_no, to: :pod, prefix: true)
|
47
|
+
delegate(:reference_no, to: :pod, prefix: true, allow_nil: true)
|
48
48
|
|
49
49
|
def delivery?
|
50
50
|
invoice_type == DELIVERY
|
@@ -75,7 +75,9 @@ module Comee
|
|
75
75
|
def calculate_total
|
76
76
|
items = InvoiceItem.where(invoice_id: id)
|
77
77
|
additionals = AdditionalItem.where(invoice_id: id)
|
78
|
-
(items.sum(:total_price) + additionals.sum(:total_price))
|
78
|
+
total = (items.sum(:total_price) + additionals.sum(:total_price))
|
79
|
+
total *= (pct_advanced / 100) if advance?
|
80
|
+
total.round(2)
|
79
81
|
end
|
80
82
|
|
81
83
|
def calculate_amount_paid
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Comee
|
2
2
|
module Core
|
3
3
|
class ShipmentInstructionItem < ApplicationRecord
|
4
|
+
before_save :set_details, if: proc { |item| item.details.empty? }
|
5
|
+
|
4
6
|
belongs_to :shipment_instruction
|
5
7
|
belongs_to :shipment_item
|
6
8
|
belongs_to :unit
|
@@ -9,6 +11,15 @@ module Comee
|
|
9
11
|
|
10
12
|
validates :pallet_no, presence: true
|
11
13
|
validates :length, :width, :height, :weight, :quantity, :price, presence: true, numericality: {greater_than: 0}
|
14
|
+
|
15
|
+
def set_details
|
16
|
+
self.details = {
|
17
|
+
customer_item_no: shipment_item.sales_order_item.customer_item_no,
|
18
|
+
customer_item_description: shipment_item.sales_order_item.customer_item_description,
|
19
|
+
customer_item_alias: shipment_item.sales_order_item.customer_item_alias,
|
20
|
+
use_alias: shipment_item.sales_order_item.use_alias
|
21
|
+
}
|
22
|
+
end
|
12
23
|
end
|
13
24
|
end
|
14
25
|
end
|
@@ -2,7 +2,7 @@ module Comee
|
|
2
2
|
module Core
|
3
3
|
class ShipmentInstructionItemSerializer < ActiveModel::Serializer
|
4
4
|
attributes :id, :delivery_note_no, :pallet_no, :goods_issue_date, :length, :width, :height, :weight, :quantity, :price,
|
5
|
-
:pod_id
|
5
|
+
:pod_id, :details
|
6
6
|
belongs_to :unit
|
7
7
|
belongs_to :shipment_item
|
8
8
|
belongs_to :pod
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class UpdateDetailsColumnInShipmentInstructionItems < ActiveRecord::Migration[7.1]
|
2
|
+
def up
|
3
|
+
Comee::Core::ShipmentInstructionItem.reset_column_information
|
4
|
+
Comee::Core::ShipmentInstructionItem.find_each do |item|
|
5
|
+
details = {
|
6
|
+
customer_item_no: item.shipment_item.sales_order_item.customer_item_no,
|
7
|
+
customer_item_description: item.shipment_item.sales_order_item.customer_item_description,
|
8
|
+
customer_item_alias: item.shipment_item.sales_order_item.customer_item_alias,
|
9
|
+
use_alias: item.shipment_item.sales_order_item.use_alias
|
10
|
+
}
|
11
|
+
item.update_column(:details, details)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
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.3.
|
4
|
+
version: 0.3.44
|
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-08-
|
11
|
+
date: 2024-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -536,6 +536,8 @@ files:
|
|
536
536
|
- db/migrate/20240731081502_create_comee_core_credit_note_additional_items.rb
|
537
537
|
- db/migrate/20240803194006_change_reference_in_invoice_to_polymorphic.rb
|
538
538
|
- db/migrate/20240803231700_update_invoice_fields.rb
|
539
|
+
- db/migrate/20240805085256_add_details_to_shipment_instruction_item.rb
|
540
|
+
- db/migrate/20240805093326_update_details_column_in_shipment_instruction_items.rb
|
539
541
|
- lib/comee/core.rb
|
540
542
|
- lib/comee/core/engine.rb
|
541
543
|
- lib/comee/core/version.rb
|