Commit Graph

97 Commits

Author SHA1 Message Date
Matt-Yorkley
ead0e1c08d Store attributes list in constant 2019-06-25 10:20:59 +01:00
Matt-Yorkley
85b3d7dac5 Move attribute check to method 2019-06-25 10:19:05 +01:00
Matt-Yorkley
84040fd2a6 Allow import to proceed when updating a product and description is set 2019-06-25 10:19:05 +01:00
Kristina Lim
cf11ef8ba2 Ignore parameter list length for ProductImport::EntryValidator
This can be done in a separate PR. More tests might be needed when
extracting to a class.
2019-06-10 04:20:04 +08:00
Kristina Lim
8c69ee67b8 Refactor code for validating variant in reference to existing product 2019-06-10 04:20:04 +08:00
Kristina Lim
70614de955 Require product import rows to match unit of preceding rows 2019-06-10 04:20:03 +08:00
Kristina Lim
5d282f7e9f Update code layout in ProductImporter method 2019-06-10 04:20:03 +08:00
Kristina Lim
73b388da87 Simplify product import all_entries method 2019-06-10 04:20:03 +08:00
Kristina Lim
38519b2bae Simplify building of product import entries for range 2019-06-10 04:19:50 +08:00
Kristina Lim
37101a6b64 Extract build_entries_from_rows for product import 2019-06-09 23:38:36 +08:00
luisramos0
86b0d71c7e Result of rubocop auto-correct and rebuilding rubocop_manual_todo 2019-05-28 12:57:29 +01:00
Matt-Yorkley
dee9521f77 shipping_category now required for products 2019-05-05 12:00:46 +01:00
luisramos0
ecc60f3b61 Merge branch 'master' into 2-0-stable-Mar29 2019-04-05 15:47:46 +01:00
Pau Pérez Fabregat
c515a8f115 Merge pull request #3537 from Matt-Yorkley/pi/on_demand_error
Fix nil values in on_hand column
2019-04-03 11:56:06 +02:00
luisramos0
a36722cebf Merge branch '2-0-stable' into 2-0-remove-variant-count-on-hand 2019-02-26 12:47:11 +00:00
Pau Pérez Fabregat
aed9c41b0d Merge pull request #3394 from mkllnk/3021-update-soft-delete
[Spree upgrade] 3021 update soft delete
2019-02-25 11:58:41 +01:00
luisramos0
5d51ad71b0 Merge branch 'master' into 2-0-stable-Feb20 2019-02-20 14:32:36 +00:00
Luis Ramos
34acaa4e03 Merge pull request #3425 from mkllnk/2783-product-importer-spec
Apply import defaults to variants of new products in Spree 2
2019-02-20 13:34:57 +00:00
Maikel Linke
99f0be2f1c Remove unnecessary scope Variant.not_deleted
Spree made that scope default so that we don't need to define or call
it. There might be cases in which we were showing deleted variants and
now we are not, but I have not idea how to find them.

Related Spree commit:
- cd3add960e
2019-02-19 14:25:18 +11:00
luisramos0
f0842fcbe5 Convert all calls to variant.count_on_hand to variant.on_hand 2019-02-18 21:54:07 +00:00
Matt-Yorkley
09655b9f88 Fix nil values in on_hand column 2019-02-16 01:05:20 +00:00
Matt-Yorkley
0c5cc23415 Fix hash merge for recording already created products by name 2019-02-14 21:38:18 +00:00
luisramos0
c652cfe4d5 Merge branch 'master' into 2-0-stable-Feb12 2019-02-12 16:03:33 +00:00
Luis Ramos
dd44d6a0ca Merge pull request #3355 from luisramos0/2-0-pord-importer-spec
[Spree Upgrade] Phase 2 - Fix product_importer spec
2019-02-11 15:28:47 +00:00
Maikel Linke
dbfcbc6db9 Apply import defaults to variants of new products
Spree 2 doesn't have `Product#on_hand=` any more. We actually can't save
stock levels without saving the product first which creates a stock
item.

This hacky solution overwrites the attribute in the entry so that it
gets copied to the variant later on. I think a better solution needs
some refactoring as proposed in:
https://github.com/openfoodfoundation/openfoodnetwork/issues/2783#issuecomment-459601530
2019-02-05 15:41:19 +11:00
luisramos0
80af7c770b Remove rescue from products_reset_strategy in product import: if setting count_on_hand fails the import will raise a RuntimeError 2019-02-01 08:32:45 +00:00
luisramos0
4b9be6f1a8 Change product import's product_reset_strategy from depending on the inexistent variant.count_on_hand DB field and instead make individual calls to variant.count_on_hand= defined in VariantStock.
Also, added spec to test return value of the reset method: it should return number of updated records.
2019-02-01 08:22:50 +00:00
luisramos0
6d2765e352 Convert if statement in case statement in product import entry validator 2019-01-29 23:53:37 +00:00
luisramos0
cc4825290b Fix type conversion problem in product import entry validator 2019-01-29 15:45:22 +00:00
luisramos0
ab2397785b Adapted product import EntryProcessor and EntryValidator to new VariantStock logic where on_hand is set at variant level (not at product level) and only after saving the variant 2019-01-29 14:55:18 +00:00
Matt-Yorkley
a3b9936f37 Improve matching inventory using 'items' unit type 2019-01-17 09:33:39 +00:00
Maikel
abe4f78e5c Merge pull request #2988 from Matt-Yorkley/pi/utf8
Pi/utf8
2019-01-09 15:39:05 +11:00
Kristina Lim
df51d137dc Update some code style for product import 2018-12-10 03:30:52 +08:00
Kristina Lim
cec50e81f5 Make product import set correct VO stock settings 2018-12-10 03:30:46 +08:00
Kristina Lim
0de829017a Refactor finding or initializing VO for product import 2018-12-10 03:30:39 +08:00
Matt-Yorkley
a5407d780c Include unexpected validation errors 2018-11-21 19:16:07 +00:00
Matt-Yorkley
9011f5d9a2 Rescue ArgumentError and give user feedback 2018-11-07 18:48:08 +00:00
Matt-Yorkley
b5c6ecb45a Explicitly use UTF-8 encoding when opening spreadsheet files 2018-11-07 16:50:24 +00:00
Maikel
d63670d675 Merge pull request #2846 from Matt-Yorkley/pi/rename_enterprise_fields
[Product Import] Rename enterprise fields and update template
2018-10-30 15:11:02 +11:00
Pau Pérez Fabregat
590091c42a Merge pull request #2842 from Matt-Yorkley/pi/missing_variable
Fix missing local variable in EntryProcessor
2018-10-16 13:19:23 +02:00
Matt-Yorkley
a2828ea305 Use :for_hubs scope 2018-10-12 17:00:19 +01:00
Matt-Yorkley
123d1963ad Remove duplicate method 2018-10-12 17:00:19 +01:00
Matt-Yorkley
3cb43121d5 Refactor long lines for new character limit 2018-10-12 17:00:18 +01:00
Matt-Yorkley
bd4f0507ce Adjustments for new Settings and ResetAbsent classes 2018-10-12 16:57:13 +01:00
Matt-Yorkley
1c85de6f58 Use producer and distributor for field names 2018-10-12 16:57:13 +01:00
Matt-Yorkley
5c2b5377bc Assign supplier_id when saving new product to products list 2018-10-12 16:57:13 +01:00
Matt-Yorkley
e7a909e828 Rename supplier to enterprise 2018-10-12 16:57:13 +01:00
Matt-Yorkley
57c6530e46 DRY code and use more flexible I18n 2018-10-11 16:38:14 +01:00
Pau Pérez Fabregat
f5573f419b Merge pull request #2778 from coopdevs/refactor-entry-processor
Refactor entry processor
2018-10-08 17:11:23 +02:00
Matt-Yorkley
b78716c283 Fix missing local variable 2018-10-08 14:49:29 +01:00