29 Commits

Author SHA1 Message Date
Gaetan Craig-Riou
b7f969eed9 Move the inventory feature check to ScopeVariantToHub
Per review, the check is done on the same enterprise as the one use to
initialize ScopeVariantToHub. So it makes sense to move the actual
feature check to ScopeVariantToHub#scope
2025-07-09 13:43:12 +10:00
Gaetan Craig-Riou
6937a133ae Move inventory enabled check to OpenFoodNetwork::ScopeVariantToHub 2025-07-09 11:35:26 +10:00
Gaetan Craig-Riou
29a24b7305 Scope variant to hub only when inventory enabled 2025-07-09 11:35:26 +10:00
cyrillefr
7812d5f58a Replace set_methods in order model 2025-04-24 09:29:40 +02:00
Filipe
cb9db54cd3 Merge pull request #13240 from rioug/13100-do-not-remove-fee-product-removed-from-OC
[Enterprise Fees] Keep fees on product when a product is removed from the order cycle
2025-04-20 21:57:56 +01:00
Gaetan Craig-Riou
1279ab21a6 Fix delete fee logic
A fee can be associated to both the incoming and outgoing exchange, the
previous logic did not account for that, resulting in the fee not being
correctly removed.
Now the delete logic also check for the metadata enterprise role to see
if any additional fee need to be removed.
2025-04-01 13:46:34 +11:00
Gaetan Craig-Riou
223faa5569 Move #recreate_all_fees! spec to HandleFeesService
Spree::Order just delegate Orders::HandleFeesService so there is no
point testing fees in the order spec
2025-04-01 13:46:34 +11:00
Gaetan Craig-Riou
b5bc6b84d7 Update Orders::HandleFeesService#recreate_all_fees!
We now update or create line item fees instead of deleting them and
recreating them. This is to cover the case when a product has been
removed from an Order Cycle but we want to keep the fee already applied
on existing order. This was an issue only if the existing order got
updated after the product was removed.
2025-04-01 13:46:34 +11:00
David Cook
e02ef08b06 Consolidate translations for hidden field
The string '< Hidden >' was agreed on as a good default, so we will use the hidden_field key.
I also moved the definition in en.yml up to the more general area at the start of admin.reports section (before it was hidden between report-specific keys.
2025-03-31 16:24:07 +11:00
David Cook
729dc9d658 Move mask logic to separate module
And cross-reference similar files so we don't miss it next time\!
2025-03-31 16:16:27 +11:00
David Cook
47b6888fe6 Display customer emails & phone numbers to suppliers
when permitted.

The MaskDataService is used by the report framework, so this should affect all reports. It would be nice to test all reports, but I figured it wasn't worth it (already we only test one report for masking names).
2025-03-31 16:16:27 +11:00
David Cook
98ab910fb4 Refactor 2025-03-31 16:16:27 +11:00
Gaetan Craig-Riou
11e08dcc26 Revert "Update line items enterprise fee instead of deleting and recreating " 2025-03-19 09:40:02 +11:00
Filipe
e524b3ddb1 Merge pull request #13197 from dacook/reload-payments-12693
Fix obscure issue when choosing payment method in checkout
2025-03-18 12:04:33 +00:00
Filipe
b3c7968e50 Merge pull request #13144 from rioug/13100-removed-fee-when-product-removed
Update line items enterprise fee instead of deleting and recreating
2025-03-14 10:12:50 +00:00
David Cook
f37742d84a Prevent exception when payment has been cleared
Note that in the real world, this avoids a crash, but still requires the user to click the button two more times before it will work, with no hints as to why. So not a great help.
2025-03-11 16:19:21 +11:00
Gaetan Craig-Riou
0480ddb59c Add comment 2025-03-11 10:41:32 +11:00
Gaetan Craig-Riou
9c45801e37 Code formatting 2025-03-11 10:31:28 +11:00
Gaetan Craig-Riou
8116ad986e Delete fees when fee are removed from the Order Cycle
This is to be consistent with the current behavior
2025-02-19 15:34:39 +11:00
Gaetan Craig-Riou
67ad532908 Handle scenario where the enterprise fee has been deleted 2025-02-19 15:34:32 +11:00
Gaetan Craig-Riou
46315c4045 Update Orders::HandleFeesService#recreate_all_fees!
We now update or create line item fees instead of deleting them and
recreating them. This is to cover the case when a product has been
removed from an Order Cycle but we want to keep the fee already applied
on existing order. This was an issue only if the existing order got
updated after the product was removed.
2025-02-19 15:13:26 +11:00
Gaetan Craig-Riou
4a63efd342 Remove redundant || 2025-02-17 16:50:18 +11:00
Gaetan Craig-Riou
db3534e621 Per review, fix memoization 2025-02-10 14:47:37 +11:00
Gaetan Craig-Riou
7d62a7f5dd Add CheckStockService#update_line_items
Update line item if any related variant has run out of stock or has had
stock reduced
2025-02-04 15:39:47 +11:00
Gaetan Craig-Riou
a7cde069c6 Add Orders::CheckStockService and spec
Move sufficient_stock? to Orders::CheckStockService
2025-02-04 15:39:40 +11:00
Maikel Linke
fcbaefb2c8 Update each backorder only once in bulk cancel 2024-12-11 12:40:46 +11:00
Maikel Linke
9ca1b48d2e Move backorder amendment out of order callback
Triggering it for each order is inefficient when we cancel them in bulk.
The callback doesn't allow us to optimise this.
2024-12-11 12:40:46 +11:00
Anthony Musyoki
25e3f30f97 Fix Rubocop Rails issue: Rails/FindEach 2024-03-20 15:34:30 +03:00
Feruz Oripov
9d919938f3 Group Order && OrderCycle related services and specs 2024-03-16 19:07:08 +05:00