spree_repeat_order 2.1.8 → 2.1.9

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
  SHA1:
3
- metadata.gz: 57184e323e58d8638e9bdaa9a19b70cff0bf56cc
4
- data.tar.gz: c03f7fcf6042f94310e9b4adf7b8e7ae556aef6a
3
+ metadata.gz: 04436e609fc6f705279b8e3b507e5fd48bffbe4b
4
+ data.tar.gz: d103b903923a36eb621f78a02ea4f3a202577642
5
5
  SHA512:
6
- metadata.gz: 03d37c679d485b77231ad435d46a6d3819307b4d5575d0c197788c3ea4e6cc447d65b2a1a8e9b2b2590eb63d0d22db97466706e0f5e6bf7e44a3f3e6f7446b08
7
- data.tar.gz: 1f6c9ab54b52050e975c974e3ac049d55f49b053408a9601d44883adb0624497e4d0de205db35c0df9153f6095cb61f754cb028cc2ed53c4fee5e0f6541878d4
6
+ metadata.gz: 605549dd0a3fabc6fc0bb1d6c5e7d31bcebcc6e454b367d1b3a6a4f3ca9c6934b5147189b43407be69e261877389c5eaea23f23ca9bad0108a175326606ef847
7
+ data.tar.gz: 0dfa769e43efcb4354b86f710c482198cd77e48cf14509a5d73b365c73d259da729868101f252bebb2bd5e4054a1724502fb04a38b8fe3e93ac59a53e5ba6fca
@@ -0,0 +1,11 @@
1
+ Spree::LineItem.class_eval do
2
+
3
+ def reload_price
4
+ if variant
5
+ self.price = variant.price
6
+ self.cost_price = variant.cost_price
7
+ self.currency = variant.currency
8
+ end
9
+ end
10
+
11
+ end
@@ -6,7 +6,11 @@ module Spree
6
6
  def duplicate_order(past_order, new_order)
7
7
  new_line_items = []
8
8
  past_order.line_items.each do |line_item|
9
- new_line_items << line_item.dup if (line_item.product && line_item.product.available? && !line_item.product.deleted?)
9
+ if (line_item.product && line_item.product.available? && !line_item.product.deleted?)
10
+ new_line_item = line_item.dup
11
+ new_line_item.reload_price
12
+ new_line_items << new_line_item
13
+ end
10
14
  end
11
15
 
12
16
  new_order.line_items = new_line_items
@@ -35,6 +35,8 @@ describe Spree::Admin::RepeatedOrdersController do
35
35
 
36
36
  before :each do
37
37
  Spree::Order.stub(:find_by).and_return(past_order)
38
+ line_item_clone_1.stub(:reload_price)
39
+ line_item_clone_2.stub(:reload_price)
38
40
  end
39
41
 
40
42
  it 'should create new order with old order items' do
@@ -2,7 +2,7 @@
2
2
  Gem::Specification.new do |s|
3
3
  s.platform = Gem::Platform::RUBY
4
4
  s.name = 'spree_repeat_order'
5
- s.version = '2.1.8'
5
+ s.version = '2.1.9'
6
6
  s.summary = 'Makes it possible to repeat an existing order with one click'
7
7
  s.description = ''
8
8
  s.required_ruby_version = '>= 2.0.0'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_repeat_order
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.8
4
+ version: 2.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Francisco Trindade
@@ -210,6 +210,7 @@ files:
210
210
  - app/assets/stylesheets/store/spree_repeat_order.css
211
211
  - app/controllers/spree/admin/repeated_orders_controller.rb
212
212
  - app/controllers/spree/repeated_orders_controller.rb
213
+ - app/models/spree/line_item_decorator.rb
213
214
  - app/overrides/my_account_table.rb
214
215
  - app/overrides/repeat_order_button.rb
215
216
  - app/views/spree/admin/orders/_repeat_button.haml