comee_core 0.3.42 → 0.3.43

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: 5543b44e3e8230affe2c45fa5850176535bff3c1e52ae12e7943265db65e840d
4
- data.tar.gz: 8a53148bbf0c6a70e1efa88070820b5892bf871d24f8c50b7a2926626f652c04
3
+ metadata.gz: 4ff7350423a4f7d4bfbab481f69a78c1526754c515c6f58ccfd31f5e77b4eb60
4
+ data.tar.gz: 15b0575c52dcc8994efdba583b2455fa2375f1b87612e5fab71c765bdfe0f376
5
5
  SHA512:
6
- metadata.gz: 2224cc02486c9aa4e57429827fce56803b5ac5a2ef4b5fb28b5e5b464e1f1f4e00694b3be0b03111175a74787f5ccf22373d0c7e3a67441221af2bd3f42b375d
7
- data.tar.gz: e636c80554eb4262e96660fae38c767f2052d2553e89815bbc2faf6716eeb66ec56077679c22cb973829dfbf3f947e01c0f0039cab2fb782424f634be53cc355
6
+ metadata.gz: 85e67b19d45298a5da7fce3a0337516242fb073b05255836b313d9bacad96909b72582485b91f57d471de60e7756952cc025f22a95b77b599954215b185c08dc
7
+ data.tar.gz: a7b7c841130e5760d30b44ee997f4a275e1e28504cc84733b9c4fa228b2c905705e820fda9785c50ff67f99c88044026ecb68d9dcb5a61d93d66e91b1e858f15
@@ -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)).round(2)
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,5 @@
1
+ class AddDetailsToShipmentInstructionItem < ActiveRecord::Migration[7.1]
2
+ def change
3
+ add_column :comee_core_shipment_instruction_items, :details, :jsonb, null: false, default: {}
4
+ end
5
+ end
@@ -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
@@ -1,5 +1,5 @@
1
1
  module Comee
2
2
  module Core
3
- VERSION = "0.3.42".freeze
3
+ VERSION = "0.3.43".freeze
4
4
  end
5
5
  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.3.42
4
+ version: 0.3.43
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-04 00:00:00.000000000 Z
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