comee_core 0.3.39 → 0.3.41
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_item.rb +1 -1
- data/db/migrate/20240803194006_change_reference_in_invoice_to_polymorphic.rb +20 -0
- data/lib/comee/core/version.rb +1 -1
- data/spec/factories/comee/core/credit_note_additional_items.rb +0 -4
- data/spec/factories/comee/core/credit_note_items.rb +2 -10
- data/spec/factories/comee/core/credit_notes.rb +6 -1
- data/spec/factories/comee/core/invoice_items.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 945ebcfda26158faf04eeb992d73078a05ece14bf999e93287d4f9a40a536f3e
|
4
|
+
data.tar.gz: b85605bbe210dafc52a8f1e0f29f572c5ee258cbc65bfa11bfaee65ab88edcc3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c67e379c9ae392240d543c73a99cb89f3084db1648df9ad2310fb5054589fb32a1cb8ab4a2270f1ceaa7f9eefcb018a19cf3c5d56c15de8b0ebb414f6048c76
|
7
|
+
data.tar.gz: 6d7578c2ebbf76fcba4ecf48e4ee43130f30a9b73ed5bd83d53e4cffafeb1d8f95dd4dbfbd451edbca971a4722cad75f5c55a8b3dea33aa8373b359ba0f349bf
|
@@ -0,0 +1,20 @@
|
|
1
|
+
class ChangeReferenceInInvoiceToPolymorphic < ActiveRecord::Migration[7.1]
|
2
|
+
def change
|
3
|
+
add_reference :comee_core_invoice_items,
|
4
|
+
:invoiceable,
|
5
|
+
polymorphic: true,
|
6
|
+
index: {name: "invoiceable_on_ccii_indx"}
|
7
|
+
reversible do |dir|
|
8
|
+
dir.up do
|
9
|
+
execute <<-SQL.squish
|
10
|
+
UPDATE comee_core_invoice_items
|
11
|
+
SET invoiceable_type = 'Comee::Core::ShipmentInstructionItem',
|
12
|
+
invoiceable_id = shipment_instruction_item_id
|
13
|
+
SQL
|
14
|
+
end
|
15
|
+
end
|
16
|
+
remove_reference :comee_core_invoice_items,
|
17
|
+
:shipment_instruction_item,
|
18
|
+
foreign_key: {to_table: :comee_core_shipment_instruction_items}
|
19
|
+
end
|
20
|
+
end
|
data/lib/comee/core/version.rb
CHANGED
@@ -1,17 +1,9 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :credit_note_item, class: "Comee::Core::CreditNoteItem" do
|
3
|
-
|
4
|
-
|
5
|
-
end
|
6
|
-
# association :credit_note, invoice: :invoice
|
7
|
-
# association :invoice_item, invoice: :invoice
|
3
|
+
credit_note
|
4
|
+
invoice_item { credit_note.invoice.invoice_items.first }
|
8
5
|
quantity { 10 }
|
9
6
|
unit_price { 2 }
|
10
7
|
total_price { quantity * unit_price }
|
11
|
-
|
12
|
-
after(:build) do |item, evaluator|
|
13
|
-
item.credit_note ||= create(:credit_note, invoice: evaluator.invoice)
|
14
|
-
item.invoice_item ||= create(:invoice_item, invoice: evaluator.invoice)
|
15
|
-
end
|
16
8
|
end
|
17
9
|
end
|
@@ -1,11 +1,16 @@
|
|
1
1
|
FactoryBot.define do
|
2
2
|
factory :credit_note, class: "Comee::Core::CreditNote" do
|
3
3
|
credit_note_no { nil }
|
4
|
-
invoice
|
5
4
|
total_price { 0 }
|
6
5
|
vat { 0 }
|
7
6
|
status { Comee::Core::CreditNote.statuses[:draft] }
|
8
7
|
date_issued { Date.current }
|
9
8
|
remark { Faker::Lorem.sentence }
|
9
|
+
|
10
|
+
after(:build) do |note, _|
|
11
|
+
invoice = create(:invoice)
|
12
|
+
create(:invoice_item, invoice: invoice)
|
13
|
+
note.invoice ||= invoice
|
14
|
+
end
|
10
15
|
end
|
11
16
|
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.
|
4
|
+
version: 0.3.41
|
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-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_model_serializers
|
@@ -534,6 +534,7 @@ files:
|
|
534
534
|
- db/migrate/20240731075328_create_comee_core_credit_notes.rb
|
535
535
|
- db/migrate/20240731080746_create_comee_core_credit_note_items.rb
|
536
536
|
- db/migrate/20240731081502_create_comee_core_credit_note_additional_items.rb
|
537
|
+
- db/migrate/20240803194006_change_reference_in_invoice_to_polymorphic.rb
|
537
538
|
- lib/comee/core.rb
|
538
539
|
- lib/comee/core/engine.rb
|
539
540
|
- lib/comee/core/version.rb
|