xsys 0.11.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/lib/xsys/model/product.rb +29 -39
- data/lib/xsys/model/shop.rb +4 -10
- data/lib/xsys/model/stock.rb +1 -1
- data/lib/xsys/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a827bdbae0d2ad9595a966e968404f083f61b5ab
|
4
|
+
data.tar.gz: 21f0a0a3917fcac505deaa3e44625842729d6bdd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1f6e51742a4d44094f8bf14d0332356e7a1afe7e3d9d21978c312644a5ea05cc45fcbacdcda8c411153fe940d30f51cd8d0f1c2f315bac64e41c118486ec2d2
|
7
|
+
data.tar.gz: bd9dc492e2315e52630e516275ac7146e5ffcb9a5aacdf692968b42bfbeba7502cb9124547f43979b20bf75ca70209b735b18d1912ede0087bebd02dacb09167
|
data/CHANGELOG.md
CHANGED
@@ -302,10 +302,14 @@
|
|
302
302
|
|
303
303
|
* Added has availability_date attribute to products
|
304
304
|
|
305
|
-
## v0.11
|
305
|
+
## v0.11.0
|
306
306
|
|
307
307
|
* Changed stock to show reserved, available quantity and removed shop fields
|
308
308
|
|
309
309
|
## v0.11.1
|
310
310
|
|
311
311
|
* Added shop_service
|
312
|
+
|
313
|
+
## v0.12.0
|
314
|
+
|
315
|
+
* Fixes for products and stocks
|
data/lib/xsys/model/product.rb
CHANGED
@@ -2,15 +2,13 @@ module Xsys
|
|
2
2
|
module Model
|
3
3
|
class Product
|
4
4
|
def self.attr_list
|
5
|
-
[:id, :name, :sellable, :product_category_id,
|
6
|
-
:
|
7
|
-
:
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:has_stock_on_hold, :availability_date
|
13
|
-
]
|
5
|
+
[:id, :name, :sellable, :product_category_id, :product_provider_id, :vat_rate,
|
6
|
+
:taxed_cost, :vat_cost, :total_cost, :pending_ordered_quantity, :stocks, :prices,
|
7
|
+
:category, :provider, :last_total_cost, :last_taxed_cost, :cost_update_date,
|
8
|
+
:cost_update_time, :last_cost_update_date, :last_cost_update_time, :price_update_date,
|
9
|
+
:price_update_time, :online_stock, :product_size_code, :weight, :length, :width,
|
10
|
+
:height, :packages_quantity, :ean, :packages, :regular_price, :reduced_price,
|
11
|
+
:credit_card_price, :brand, :model, :has_stock_on_hold, :availability_date]
|
14
12
|
end
|
15
13
|
|
16
14
|
attr_reader *attr_list
|
@@ -42,46 +40,38 @@ module Xsys
|
|
42
40
|
end
|
43
41
|
end
|
44
42
|
|
45
|
-
def
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
result = 0
|
51
|
-
|
52
|
-
sellable_stocks.each do |stock|
|
53
|
-
result += stock.quantity
|
43
|
+
def stock_quantity(shop_codes=[])
|
44
|
+
if shop_codes.empty?
|
45
|
+
stocks.map(&:quantity).sum
|
46
|
+
else
|
47
|
+
stocks.find_all { |s| shop_codes.include?(s.code) }.map(&:quantity).sum
|
54
48
|
end
|
55
|
-
|
56
|
-
result
|
57
|
-
end
|
58
|
-
|
59
|
-
def service_stocks
|
60
|
-
stocks.find_all { |s| s.shop_service }
|
61
49
|
end
|
62
50
|
|
63
|
-
def
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
51
|
+
def stock_available(shop_codes=[])
|
52
|
+
if shop_codes.empty?
|
53
|
+
stocks.map(&:available).sum
|
54
|
+
else
|
55
|
+
stocks.find_all { |s| shop_codes.include?(s.code) }.map(&:available).sum
|
56
|
+
end
|
69
57
|
end
|
70
58
|
|
71
|
-
def
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
59
|
+
def stock_reserved(shop_codes=[])
|
60
|
+
if shop_codes.empty?
|
61
|
+
stocks.map(&:reserved).sum
|
62
|
+
else
|
63
|
+
stocks.find_all { |s| shop_codes.include?(s.code) }.map(&:reserved).sum
|
64
|
+
end
|
77
65
|
end
|
78
66
|
|
79
|
-
def stock_at(shop_code
|
80
|
-
|
67
|
+
def stock_at(shop_code)
|
68
|
+
stocks.find { |s|
|
81
69
|
s.shop_code.to_s.upcase == shop_code.to_s.upcase
|
82
70
|
}
|
71
|
+
end
|
83
72
|
|
84
|
-
|
73
|
+
def sellable_stocks
|
74
|
+
stocks.find_all { |x| x.sellable }
|
85
75
|
end
|
86
76
|
|
87
77
|
def price_date_for_list(price_list_id)
|
data/lib/xsys/model/shop.rb
CHANGED
@@ -2,10 +2,8 @@ module Xsys
|
|
2
2
|
module Model
|
3
3
|
class Shop
|
4
4
|
def self.attr_list
|
5
|
-
[:id, :code, :name, :
|
6
|
-
|
7
|
-
:position, :has_stock_control, :has_exhibition, :stock_sellable,
|
8
|
-
:stock_sellable, :enabled, :physical_shop_id, :last_update]
|
5
|
+
[:id, :code, :name, :commercial, :virtual, :stockable, :has_target,
|
6
|
+
:position, :has_stock_control, :stock_sellable, :enabled, :kind]
|
9
7
|
end
|
10
8
|
|
11
9
|
attr_reader *attr_list
|
@@ -32,16 +30,12 @@ module Xsys
|
|
32
30
|
stockable == true
|
33
31
|
end
|
34
32
|
|
35
|
-
def service?
|
36
|
-
service == true
|
37
|
-
end
|
38
|
-
|
39
33
|
def has_target?
|
40
34
|
has_target == true
|
41
35
|
end
|
42
36
|
|
43
|
-
def
|
44
|
-
|
37
|
+
def has_stock_control?
|
38
|
+
has_stock_control == true
|
45
39
|
end
|
46
40
|
|
47
41
|
def stock_sellable?
|
data/lib/xsys/model/stock.rb
CHANGED
data/lib/xsys/version.rb
CHANGED