Skip to content

Commit

Permalink
fix(core): Remove redundant constraint when creating allocations
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
michaelbromley committed Dec 11, 2023
1 parent ee04032 commit 52c0841
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 4 deletions.
1 change: 0 additions & 1 deletion packages/core/src/i18n/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 }\"",
Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/service/services/stock-movement.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 52c0841

Please sign in to comment.