Forráskód Böngészése

fix(core): Remove redundant constraint when creating allocations

Fixes #2563. In an earlier version, before the concept of "allocations" was introduced,
this method created "Sales" rather than "Allocations". As such, it had the
constraint that the `order.active` must be `false` in order to create a Sale. Since
we switched this to Allocations, this constraint no longer makes sense. For instance,
a custom OrderProcess may introduce a new state before the order becomes inactive,
yet which should allocated stock.
Michael Bromley 2 éve
szülő
commit
52c084129f

+ 0 - 1
packages/core/src/i18n/messages/en.json

@@ -6,7 +6,6 @@
     "cannot-delete-sole-superadmin": "The sole SuperAdmin cannot be deleted",
     "cannot-locate-customer-for-user": "Cannot locate a Customer for the user",
     "cannot-modify-role": "The role \"{ roleCode }\" cannot be modified",
-    "cannot-create-sales-for-active-order": "Cannot create a Sale for an Order which is still active",
     "cannot-move-collection-into-self": "Cannot move a Collection into itself",
     "cannot-transition-payment-from-to": "Cannot transition Payment from \"{ fromState }\" to \"{ toState }\"",
     "cannot-transition-refund-from-to": "Cannot transition Refund from \"{ fromState }\" to \"{ toState }\"",

+ 0 - 3
packages/core/src/service/services/stock-movement.service.ts

@@ -137,9 +137,6 @@ export class StockMovementService {
      * increased, indicating that this quantity of stock is allocated and cannot be sold.
      */
     async createAllocationsForOrder(ctx: RequestContext, order: Order): Promise<Allocation[]> {
-        if (order.active !== false) {
-            throw new InternalServerError('error.cannot-create-allocations-for-active-order');
-        }
         const lines = order.lines.map(orderLine => ({
             orderLineId: orderLine.id,
             quantity: orderLine.quantity,