Commit Graph

140 Commits

Author SHA1 Message Date
luisramos0
5184fa540c Adapt enterprise_relationship permitting and permitted_by scopes to rails 4 2019-07-03 20:18:00 +01:00
luisramos0
7bd32d4967 Fix usage of variant.on_hand in subscriptions order factory, we now take on_demand into account
This fixes a problem introduced in 12eab1bfa9 (diff-c3c4192f302cc77e9a8547012fe86ddb), since then variant.on_hand does not return infinity if variant is on_demand
2019-06-25 14:47:47 +01:00
Matt-Yorkley
08b2b19d5e Improve handling of invalid characters in uploaded CSV files 2019-06-19 09:29:59 +01:00
Kristina Lim
ea8d189d6c Bulk update OC variant changes in OC form 2019-05-28 21:27:43 +08:00
luisramos0
86b0d71c7e Result of rubocop auto-correct and rebuilding rubocop_manual_todo 2019-05-28 12:57:29 +01:00
Luis Ramos
4afa0cdca1 Merge pull request #3589 from kristinalim/fix/2788-ship_address_changed
2788 [Subscriptions] Fix address issues when syncing subscriptions and orders
2019-05-03 23:48:32 +01:00
Kristina Lim
19726061e4 Make Order#address_from_distributor public 2019-05-01 07:17:50 +08:00
Kristina Lim
92dc43d7a2 Make OrderUpdater#shipping_address_from_distributor public 2019-05-01 07:16:56 +08:00
Kristina Lim
0933d53134 Extract method OrderSyncer#update_ship_address_for 2019-05-01 07:16:56 +08:00
Kristina Lim
14d407879c Rename method OrderSyncer#update_ship_address_for
This method has become only a small part of the logic for updating the
order's ship address. This no longer follows the method naming
convention within OrderSyncer where update_*_for describes almost the
complete logic for updating the association.

This is renamed in preparation for extraction of the complete update
logic for ship_address. The new method will be named
update_ship_address_for.
2019-05-01 07:16:56 +08:00
Kristina Lim
6952f4ecd1 Improve readability of conditions in OrderSyncer 2019-05-01 07:16:55 +08:00
Kristina Lim
78aa9da2cf Uncomment and update OrderSyncer failing specs
This still achieves a logic issue before the Spree upgrade, where
switching from pick-up to delivery affects whether simultaneous changes
to shipping address are ignored or not.

This behaviour can be fixed in a separate PR.
2019-05-01 07:16:54 +08:00
luisramos0
fce3d69345 Add flash and warning to the cart page when item becomes unavailable 2019-04-13 21:39:41 +01:00
luisramos0
59ec52babe Refactor order_cycle_distributed_variants, better method names and simpler code 2019-04-11 22:15:24 +01:00
luisramos0
44b0592223 Move OrdercycleDistributedVariants from lib/open_food_network to app/services 2019-04-11 21:37:08 +01:00
luisramos0
96ee527f0c Rename distribution_change_validator to order_cycle_distributed_variants 2019-04-11 21:14:01 +01:00
luisramos0
c1d14686a6 Merge branch 'master' into 2-0-stable-Mar22 2019-03-22 10:55:17 +00:00
Pau Pérez Fabregat
846e6fdd90 Merge pull request #3560 from kristinalim/fix/2788-shipping_method_id_in_shipments
2696,2788 [Spree Upgrade] Fix use of shipping method ID for subscriptions
2019-03-22 11:08:23 +01:00
Kristina Lim
94606025c9 Separate call and call! for AdvanceOrderService 2019-03-21 20:34:51 +08:00
Pau Pérez Fabregat
2a3a935c16 Merge pull request #3570 from luisramos0/byebye-prod-distributions
Delete dead feature product distributions
2019-03-20 09:01:23 +01:00
luisramos0
60ee17204b Merge branch 'master' into 2-0-stable-Mar16 2019-03-16 16:17:38 +00:00
Kristina Lim
7505dd0410 Make order sync for shipping methods readable 2019-03-15 07:59:54 +11:00
Pau Pérez Fabregat
13b2115a29 Merge pull request #3581 from coopdevs/cache-stylistic-improvements
Cache stylistic improvements
2019-03-13 19:05:38 +01:00
luisramos0
2de6c46834 Make order.order_cycle required in cart_service. There’s no more exception for that without product_distributions. 2019-03-13 12:24:40 +00:00
Kristina Lim
8782f2087c Use service in admin/payments#create
This separates logic for bang and non-bang versions of
Spree::Order#next.

The different conditions used in both methods (state == "completed" vs
order.completed?) have implications in whether a transition is attempted
or not.
2019-03-13 17:00:31 +11:00
Kristina Lim
a261d912ea Simplify order sync logic for shipping methods 2019-03-13 12:45:54 +08:00
Kristina Lim
9316096d4d Fix updating of the shipping method for an order 2019-03-13 12:45:54 +08:00
Kristina Lim
5b5d1967fd Fix queries for pending order shipment in OrderSyncer 2019-03-13 12:45:53 +08:00
Kristina Lim
54991f8191 Retain shipping method when transitioning order 2019-03-13 12:45:53 +08:00
Kristina Lim
7a8bf76123 Move transitioning of order in admin/orders#edit to service 2019-03-13 12:45:50 +08:00
Kristina Lim
f42eb3dab1 Create shipment when creating a order for a subscription
A spec has been added to check that the attributes for the order states
after "cart" ("address", "delivery", "payment") are retained if the
order is transitioned to completion, BUT currently this is passing
because it is the only shipping method available.
2019-03-12 18:31:27 +08:00
Kristina Lim
0306cc7ca7 Set shipping method when creating order for subscription 2019-03-12 18:31:26 +08:00
Pau Perez
931cb89a9d Move new class to services and rename it 2019-03-11 18:28:25 +01:00
luisramos0
351555d4e2 Remove unused methods from add_to_cart helper and distribution change validator 2019-03-02 12:55:08 +00: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
luisramos0
8ee14ccb4b Make variants_stock_levels return variants on_demand values 2019-02-19 11:56:02 +00:00
Maikel Linke
b4d1e48693 Update soft-delete of variants
Spree changed their way of soft-deleting variants from calling `delete`
to calling `destroy`. We don't need our own implementation any more.
2019-02-19 14:25:18 +11:00
Maikel Linke
cdb49f88b0 Move Variant deletion into its own service
This keeps the override of Spree's model leaner. More importantly, it
prepares us for using `destroy` instead of `delete`.

In the past, `Product#delete` soft-deleted the product, but didn't
delete the variants. When we use `Product#destroy` to soft-delete the
product, it will also call destroy on the variants. If the model doesn't
allow the deletion of the last variant, it will fail. So when a product
is deleted we want to allow the deletion of all variants. But the user
should not be allowed to delete the last variant. That's why I'm moving
the check to the controller level.

Related commits:

- e6c7acdff3
- 2b47c9145a
- b9f19d5777 (diff-412c5af2ec1ba9f6643f6df5a673c1d4R105)
2019-02-19 14:25:18 +11:00
Maikel
1b45033e33 Merge pull request #3506 from Matt-Yorkley/pi/parse_bom
Sanitize non-parsable BOM characters inserted by Excel
2019-02-19 11:24:11 +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
9705c249ac Sanitize no-parsable BOM characters inserted by Excel 2019-02-18 13:13:37 +00:00
Maikel
d4589cc2f4 Merge pull request #3444 from mkllnk/3437-supplier-name-on-invoice
3437 supplier name on invoice
2019-02-15 16:31:29 +11:00
luisramos0
c652cfe4d5 Merge branch 'master' into 2-0-stable-Feb12 2019-02-12 16:03:33 +00:00
Maikel Linke
5ee3dbf9f2 Re-use renderer object 2019-02-07 10:12:06 +11:00
Maikel Linke
d97fa60c31 Remove code duplication and test PDF creation 2019-02-06 14:53:05 +11:00
luisramos0
729feb16f1 Merge branch 'master' into 2-0-stable-jan-29th 2019-01-29 12:38:34 +00:00
Kristina Lim
9965e95c65 Refactor methods in SubscriptionVariantsService 2019-01-26 02:03:55 +08:00
Kristina Lim
b691d727a7 Move OFN::SubscriptionService to SubscriptionVariantsService 2019-01-26 02:03:55 +08:00