From 7ef9fa108059bde5aca17d1164b90eb10c77aedc Mon Sep 17 00:00:00 2001 From: Rajneesh Gupta Date: Sat, 10 Oct 2020 09:00:55 +0100 Subject: [PATCH 1/7] update inventory-cli-reference.md incorrect info since the cli command inventory:reservation:create-compensations yet not accepting the -c & -i argument , I rectified few points here for incorrect message string and the arguments. --- src/guides/v2.3/inventory/inventory-cli-reference.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/guides/v2.3/inventory/inventory-cli-reference.md b/src/guides/v2.3/inventory/inventory-cli-reference.md index 07ff8e6ae04..5350360317c 100644 --- a/src/guides/v2.3/inventory/inventory-cli-reference.md +++ b/src/guides/v2.3/inventory/inventory-cli-reference.md @@ -92,12 +92,9 @@ bin/magento inventory:reservation:create-compensations Command options: -- `-c`, `--complete-orders` - Creates reservations for completed order inconsistencies. -- `-i`, `--incomplete-orders` - Creates reservations for incomplete order inconsistencies. - `-r`, `--raw` - Returns raw output. -- `-d`, `--dry-run` - Simulates reservation creation without applying reservations. -If the format of the request is incorrect, the following message displays: A list of compensations needs to be defined as argument or STDIN. +If the format of the request is incorrect, the following message displays: Error while parsing argument "your_incorrect_format_argument". Given argument does not match pattern "/(?P.*):(?P.*):(?P.*):(?P.*)/". As the command creates reservations, it displays messages indicating the updates by SKU, order, and stock. From 2927e387752d6269bcd7fb4611b7e7b78c4532a4 Mon Sep 17 00:00:00 2001 From: Margaret Eker Date: Wed, 14 Oct 2020 13:05:03 -0500 Subject: [PATCH 2/7] Format error message as terminal text --- src/guides/v2.3/inventory/inventory-cli-reference.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/guides/v2.3/inventory/inventory-cli-reference.md b/src/guides/v2.3/inventory/inventory-cli-reference.md index 5350360317c..ffcc471aaab 100644 --- a/src/guides/v2.3/inventory/inventory-cli-reference.md +++ b/src/guides/v2.3/inventory/inventory-cli-reference.md @@ -94,7 +94,11 @@ Command options: - `-r`, `--raw` - Returns raw output. -If the format of the request is incorrect, the following message displays: Error while parsing argument "your_incorrect_format_argument". Given argument does not match pattern "/(?P.*):(?P.*):(?P.*):(?P.*)/". +If the format of the request is incorrect, the following message displays: + +```terminal +Error while parsing argument "your_incorrect_format_argument". Given argument does not match pattern "/(?P.*):(?P.*):(?P.*):(?P.*)/". +``` As the command creates reservations, it displays messages indicating the updates by SKU, order, and stock. From b48328fda13c6821f6bbf8c1865490e78a18a325 Mon Sep 17 00:00:00 2001 From: Margaret Eker Date: Wed, 14 Oct 2020 13:10:15 -0500 Subject: [PATCH 3/7] Remove trailing space --- .../v2.3/inventory/inventory-cli-reference.md | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) diff --git a/src/guides/v2.3/inventory/inventory-cli-reference.md b/src/guides/v2.3/inventory/inventory-cli-reference.md index ffcc471aaab..c695b7fa391 100644 --- a/src/guides/v2.3/inventory/inventory-cli-reference.md +++ b/src/guides/v2.3/inventory/inventory-cli-reference.md @@ -1,6 +1,10 @@ --- group: inventory title: Inventory CLI reference +functional_areas: + - Configuration--- +group: inventory +title: Inventory CLI reference functional_areas: - Configuration - System @@ -90,6 +94,148 @@ To create reservations, provide compensations using the format `.*):(?P.*):(?P.*):(?P.*)/". +``` + +As the command creates reservations, it displays messages indicating the updates by SKU, order, and stock. + +```terminal +bin/magento inventory:reservation:create-compensations 172:bike-123:+2.000000:1 + +Following reservations were created: +- Product bike-123 was compensated by +2.000000 for stock 1 +``` + +You can run both commands by piping `list-inconsistencies` and `create-compensations` to detect inconsistencies and immediately create compensations. Use the `-r` command option to generate and submit the raw data to `create-compensations`. + +```bash +bin/magento inventory:reservation:list-inconsistencies -r | bin/magento inventory:reservation:create-compensations +``` + +Example response: + +```terminal +bin/magento inventory:reservation:list-inconsistencies -r | bin/magento inventory:reservation:create-compensations + +Following reservations were created: +- Product bike-123 was compensated by +2.000000 for stock 1 +- Product bikehat-456 was compensated by +1.000000 for stock 1 +``` + +After updates complete, run the list command to verify: + +```terminal +bin/magento inventory:reservation:list-inconsistencies -r + +No order inconsistencies were found. +``` + +## Import geocodes + +{{site.data.var.im}} provides the [Distance Priority](https://docs.magento.com/m2/ce/user_guide/catalog/inventory-configure-distance-priority.html) algorithm, which helps determine the best option for shipping a full or partial order. The algorithm uses GPS information or geocodes to calculate the distance between the source (a warehouse or other physical location) of each item in an order and the shipping address. Based on those results, the algorithm recommends which source should be used to ship out each item in the order. + +The merchant selects the provider of the GPS or geocode data required to calculate distances: + +- **Google MAP** uses [Google Maps Platform](https://cloud.google.com/maps-platform) services to calculate the distance and time between the shipping destination address and source locations. This option requires a Google billing plan and may incur charges through Google. + +- **Offline calculation** calculates the distance using data downloaded from [geonames.org](https://www.geonames.org/) and imported into Magento with a command. This option is free of charge. + +{% include config/cli-inventory.md %} + + - System + - Setup +--- + +{{site.data.var.im}} provides commands to manage inventory data and configuration settings. + +These commands include: + +- Checking and resolving reservation inconsistencies affecting salable quantity +- Adding geocodes for the Distance Priority algorithm + +## Resolve reservations inconsistencies + +[Reservations]({{ page.baseurl }}/inventory/reservations.html) place a salable quantity hold for product SKUs per stock. When you ship, add products, cancel, or refund an order, compensation reservations enter to place or clear these holds. + +{{site.data.var.im}} provides two commands to check and resolve reservation inconsistencies: + +- [`inventory:reservation:list-inconsistencies`](#list-inconsistencies-command) +- [`inventory:reservation:create-compensations`](#create-compensations-command) + +### What causes reservation inconsistencies? + +{{site.data.var.im}} generates reservations for key events: + +- Order placement (initial reservation) +- Order shipment (compensation reservation) +- Refund order or issue a credit memo (compensation reservation) +- Order cancellation (compensation reservation) + +Reservation inconsistencies may occur when {{site.data.var.im}} loses the initial reservation and enters too many reservation compensations (overcompensating and leading to inconsistent amounts), or correctly places the initial reservation but loses compensational reservations. + +The following configurations and events can cause reservation inconsistencies: + +- **Upgrade Magento to 2.3.x with orders not in a final state (Complete, Canceled, or Closed).** {{site.data.var.im}} will create compensational reservations for these orders, but it will not enter or have the initial reservation that deducts from the salable quantity. We recommend using these commands after upgrading to Magento v2.3.x from 2.1.x or 2.2.x. If you have pending orders, the commands correctly update your salable quantity and reservations for sales and order fulfillment. +- **You do not manage stock then later change this configuration.** You may start using 2.3.x with **Manage Stock** set to "No" in the Magento configuration. Magento does not place reservations at order placement and shipment events. If you later enable the **Manage Stock** configuration and some orders were created at that time, the Salable Qty would be corrupted with compensation reservation when you handle and fulfill that order. +- **You re-assign the Stock for a Website while orders submit to that website**. The initial reservation enters for the initial stock and all compensational reservation enter to the new stock. +- **The sum total of all reservations may not resolve to `0`.** All reservations in the scope of an Order in a final state (Complete, Canceled, Closed) should resolve to `0`, clearing all salable quantity holds. + +### List inconsistencies command + +The `list-inconsistencies` command detects and lists all reservation inconsistencies. Use the command options to check only completed or incomplete orders, or all. + +```bash +bin/magento inventory:reservation:list-inconsistencies +``` + +Command options: + +- `-c`, `--complete-orders` - Returns inconsistencies for completed orders. Incorrect reservations may still be on hold for completed orders. +- `-i`, `--incomplete-orders` - Returns inconsistencies for incomplete orders (partially shipped, unshipped). Incorrect reservations may hold too much or not enough salable quantity for the orders. +- `-r`, `--raw` - Raw output. + +Responses using `-r` return in `:::` format: + +- Order ID indicates the scope of the inconsistency. +- SKU indicates the product with the inconsistency. +- Quantity sets the amount to enter for the reservation compensation. +- Stock ID defines to scope for stock, which uses the reservations to calculate salable quantity. + +Examples: + +```terminal +bin/magento inventory:reservation:list-inconsistencies + +Inconsistencies found on following entries: +Order 172: +- Product bike-123 should be compensated by +2.000000 for stock 1 +``` + +```terminal +bin/magento inventory:reservation:list-inconsistencies -r + +172:bike-123:+2.000000:1 +``` + +If no issues are found, this message returns: No order inconsistencies were found. + +### Create compensations command + +The `create-compensations` command creates compensation reservations. Depending on the issue, new reservations are created to either place or release a hold on salable quantity. + +To create reservations, provide compensations using the format `:::` such as `172:bike-123:+2.000000:1`. + +```bash +bin/magento inventory:reservation:create-compensations +``` + Command options: - `-r`, `--raw` - Returns raw output. From c1c6998aabed71bfa10b7941e0d3b161f01984a0 Mon Sep 17 00:00:00 2001 From: Margaret Eker Date: Wed, 14 Oct 2020 13:29:59 -0500 Subject: [PATCH 4/7] Remove duplicated content and fix syntax errors --- .../v2.3/inventory/inventory-cli-reference.md | 148 +----------------- 1 file changed, 1 insertion(+), 147 deletions(-) diff --git a/src/guides/v2.3/inventory/inventory-cli-reference.md b/src/guides/v2.3/inventory/inventory-cli-reference.md index c695b7fa391..ee6ede9b01f 100644 --- a/src/guides/v2.3/inventory/inventory-cli-reference.md +++ b/src/guides/v2.3/inventory/inventory-cli-reference.md @@ -1,10 +1,6 @@ --- group: inventory title: Inventory CLI reference -functional_areas: - - Configuration--- -group: inventory -title: Inventory CLI reference functional_areas: - Configuration - System @@ -98,149 +94,7 @@ Command option: - `-r`, `--raw` - Returns raw output. -If the format of the request is incorrect, the following message displays: - -```terminal -Error while parsing argument "your_incorrect_format_argument". Given argument does not match pattern "/(?P.*):(?P.*):(?P.*):(?P.*)/". -``` - -As the command creates reservations, it displays messages indicating the updates by SKU, order, and stock. - -```terminal -bin/magento inventory:reservation:create-compensations 172:bike-123:+2.000000:1 - -Following reservations were created: -- Product bike-123 was compensated by +2.000000 for stock 1 -``` - -You can run both commands by piping `list-inconsistencies` and `create-compensations` to detect inconsistencies and immediately create compensations. Use the `-r` command option to generate and submit the raw data to `create-compensations`. - -```bash -bin/magento inventory:reservation:list-inconsistencies -r | bin/magento inventory:reservation:create-compensations -``` - -Example response: - -```terminal -bin/magento inventory:reservation:list-inconsistencies -r | bin/magento inventory:reservation:create-compensations - -Following reservations were created: -- Product bike-123 was compensated by +2.000000 for stock 1 -- Product bikehat-456 was compensated by +1.000000 for stock 1 -``` - -After updates complete, run the list command to verify: - -```terminal -bin/magento inventory:reservation:list-inconsistencies -r - -No order inconsistencies were found. -``` - -## Import geocodes - -{{site.data.var.im}} provides the [Distance Priority](https://docs.magento.com/m2/ce/user_guide/catalog/inventory-configure-distance-priority.html) algorithm, which helps determine the best option for shipping a full or partial order. The algorithm uses GPS information or geocodes to calculate the distance between the source (a warehouse or other physical location) of each item in an order and the shipping address. Based on those results, the algorithm recommends which source should be used to ship out each item in the order. - -The merchant selects the provider of the GPS or geocode data required to calculate distances: - -- **Google MAP** uses [Google Maps Platform](https://cloud.google.com/maps-platform) services to calculate the distance and time between the shipping destination address and source locations. This option requires a Google billing plan and may incur charges through Google. - -- **Offline calculation** calculates the distance using data downloaded from [geonames.org](https://www.geonames.org/) and imported into Magento with a command. This option is free of charge. - -{% include config/cli-inventory.md %} - - - System - - Setup ---- - -{{site.data.var.im}} provides commands to manage inventory data and configuration settings. - -These commands include: - -- Checking and resolving reservation inconsistencies affecting salable quantity -- Adding geocodes for the Distance Priority algorithm - -## Resolve reservations inconsistencies - -[Reservations]({{ page.baseurl }}/inventory/reservations.html) place a salable quantity hold for product SKUs per stock. When you ship, add products, cancel, or refund an order, compensation reservations enter to place or clear these holds. - -{{site.data.var.im}} provides two commands to check and resolve reservation inconsistencies: - -- [`inventory:reservation:list-inconsistencies`](#list-inconsistencies-command) -- [`inventory:reservation:create-compensations`](#create-compensations-command) - -### What causes reservation inconsistencies? - -{{site.data.var.im}} generates reservations for key events: - -- Order placement (initial reservation) -- Order shipment (compensation reservation) -- Refund order or issue a credit memo (compensation reservation) -- Order cancellation (compensation reservation) - -Reservation inconsistencies may occur when {{site.data.var.im}} loses the initial reservation and enters too many reservation compensations (overcompensating and leading to inconsistent amounts), or correctly places the initial reservation but loses compensational reservations. - -The following configurations and events can cause reservation inconsistencies: - -- **Upgrade Magento to 2.3.x with orders not in a final state (Complete, Canceled, or Closed).** {{site.data.var.im}} will create compensational reservations for these orders, but it will not enter or have the initial reservation that deducts from the salable quantity. We recommend using these commands after upgrading to Magento v2.3.x from 2.1.x or 2.2.x. If you have pending orders, the commands correctly update your salable quantity and reservations for sales and order fulfillment. -- **You do not manage stock then later change this configuration.** You may start using 2.3.x with **Manage Stock** set to "No" in the Magento configuration. Magento does not place reservations at order placement and shipment events. If you later enable the **Manage Stock** configuration and some orders were created at that time, the Salable Qty would be corrupted with compensation reservation when you handle and fulfill that order. -- **You re-assign the Stock for a Website while orders submit to that website**. The initial reservation enters for the initial stock and all compensational reservation enter to the new stock. -- **The sum total of all reservations may not resolve to `0`.** All reservations in the scope of an Order in a final state (Complete, Canceled, Closed) should resolve to `0`, clearing all salable quantity holds. - -### List inconsistencies command - -The `list-inconsistencies` command detects and lists all reservation inconsistencies. Use the command options to check only completed or incomplete orders, or all. - -```bash -bin/magento inventory:reservation:list-inconsistencies -``` - -Command options: - -- `-c`, `--complete-orders` - Returns inconsistencies for completed orders. Incorrect reservations may still be on hold for completed orders. -- `-i`, `--incomplete-orders` - Returns inconsistencies for incomplete orders (partially shipped, unshipped). Incorrect reservations may hold too much or not enough salable quantity for the orders. -- `-r`, `--raw` - Raw output. - -Responses using `-r` return in `:::` format: - -- Order ID indicates the scope of the inconsistency. -- SKU indicates the product with the inconsistency. -- Quantity sets the amount to enter for the reservation compensation. -- Stock ID defines to scope for stock, which uses the reservations to calculate salable quantity. - -Examples: - -```terminal -bin/magento inventory:reservation:list-inconsistencies - -Inconsistencies found on following entries: -Order 172: -- Product bike-123 should be compensated by +2.000000 for stock 1 -``` - -```terminal -bin/magento inventory:reservation:list-inconsistencies -r - -172:bike-123:+2.000000:1 -``` - -If no issues are found, this message returns: No order inconsistencies were found. - -### Create compensations command - -The `create-compensations` command creates compensation reservations. Depending on the issue, new reservations are created to either place or release a hold on salable quantity. - -To create reservations, provide compensations using the format `:::` such as `172:bike-123:+2.000000:1`. - -```bash -bin/magento inventory:reservation:create-compensations -``` - -Command options: - -- `-r`, `--raw` - Returns raw output. - -If the format of the request is incorrect, the following message displays: +If the format of the request is incorrect, the following message displays: ```terminal Error while parsing argument "your_incorrect_format_argument". Given argument does not match pattern "/(?P.*):(?P.*):(?P.*):(?P.*)/". From f999567e3060dd4a256aeeeb24b2a79e72049a8f Mon Sep 17 00:00:00 2001 From: Margaret Eker Date: Thu, 15 Oct 2020 10:20:44 -0500 Subject: [PATCH 5/7] Added examples and missing option - Added the `bunchsize` option to the inventory:reservation:list-inconsistencies command. - Added " Detect inconsistencies and create compensations" section with examples to run piped commands for incomplete and complete orders. --- .../v2.3/inventory/inventory-cli-reference.md | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/guides/v2.3/inventory/inventory-cli-reference.md b/src/guides/v2.3/inventory/inventory-cli-reference.md index ee6ede9b01f..b9148f8b154 100644 --- a/src/guides/v2.3/inventory/inventory-cli-reference.md +++ b/src/guides/v2.3/inventory/inventory-cli-reference.md @@ -53,6 +53,7 @@ Command options: - `-c`, `--complete-orders` - Returns inconsistencies for completed orders. Incorrect reservations may still be on hold for completed orders. - `-i`, `--incomplete-orders` - Returns inconsistencies for incomplete orders (partially shipped, unshipped). Incorrect reservations may hold too much or not enough salable quantity for the orders. +- `-b`, `--bunchsize` - Defines how many orders to load at once. - `-r`, `--raw` - Raw output. Responses using `-r` return in `:::` format: @@ -109,7 +110,9 @@ Following reservations were created: - Product bike-123 was compensated by +2.000000 for stock 1 ``` -You can run both commands by piping `list-inconsistencies` and `create-compensations` to detect inconsistencies and immediately create compensations. Use the `-r` command option to generate and submit the raw data to `create-compensations`. +### Detect inconsistencies and create compensations + +You can detect inconsistences and immediately create compensations by using a pipe to run both the `list-inconsistencies` and `create-compensations`. Use the `-r` command option to generate and submit the raw data to `create-compensations`. ```bash bin/magento inventory:reservation:list-inconsistencies -r | bin/magento inventory:reservation:create-compensations @@ -117,9 +120,11 @@ bin/magento inventory:reservation:list-inconsistencies -r | bin/magento inventor Example response: -```terminal +```bash bin/magento inventory:reservation:list-inconsistencies -r | bin/magento inventory:reservation:create-compensations +``` +```terminal Following reservations were created: - Product bike-123 was compensated by +2.000000 for stock 1 - Product bikehat-456 was compensated by +1.000000 for stock 1 @@ -127,12 +132,22 @@ Following reservations were created: After updates complete, run the list command to verify: -```terminal +```bash bin/magento inventory:reservation:list-inconsistencies -r No order inconsistencies were found. ``` +You can also pipe the commands to detect inconsistencies and create compensations for only incomplete (`-i`) or complete (`-c`) orders. + +```bash +bin/magento inventory:reservation:list-inconsistencies -r -i | bin/magento inventory:reservation:create-compensations +``` + +```bash +bin/magento inventory:reservation:list-inconsistencies -r -c | bin/magento inventory:reservation:create-compensations +``` + ## Import geocodes {{site.data.var.im}} provides the [Distance Priority](https://docs.magento.com/m2/ce/user_guide/catalog/inventory-configure-distance-priority.html) algorithm, which helps determine the best option for shipping a full or partial order. The algorithm uses GPS information or geocodes to calculate the distance between the source (a warehouse or other physical location) of each item in an order and the shipping address. Based on those results, the algorithm recommends which source should be used to ship out each item in the order. From ba4b963742fb729fec3a1caac47c40899e7fb9c1 Mon Sep 17 00:00:00 2001 From: Margaret Eker Date: Thu, 15 Oct 2020 13:43:10 -0500 Subject: [PATCH 6/7] Apply suggestions from code review Co-authored-by: Kevin Harper --- src/guides/v2.3/inventory/inventory-cli-reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/guides/v2.3/inventory/inventory-cli-reference.md b/src/guides/v2.3/inventory/inventory-cli-reference.md index b9148f8b154..bd249b9b398 100644 --- a/src/guides/v2.3/inventory/inventory-cli-reference.md +++ b/src/guides/v2.3/inventory/inventory-cli-reference.md @@ -53,7 +53,7 @@ Command options: - `-c`, `--complete-orders` - Returns inconsistencies for completed orders. Incorrect reservations may still be on hold for completed orders. - `-i`, `--incomplete-orders` - Returns inconsistencies for incomplete orders (partially shipped, unshipped). Incorrect reservations may hold too much or not enough salable quantity for the orders. -- `-b`, `--bunchsize` - Defines how many orders to load at once. +- `-b`, `--bunch-size` - Defines how many orders to load at once. - `-r`, `--raw` - Raw output. Responses using `-r` return in `:::` format: From 92ac095c97dd1433d7501f689c931216efaf48a1 Mon Sep 17 00:00:00 2001 From: Margaret Eker Date: Thu, 15 Oct 2020 13:44:13 -0500 Subject: [PATCH 7/7] Updates based on review feedback --- src/guides/v2.3/inventory/inventory-cli-reference.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/guides/v2.3/inventory/inventory-cli-reference.md b/src/guides/v2.3/inventory/inventory-cli-reference.md index bd249b9b398..39f5dabbb1c 100644 --- a/src/guides/v2.3/inventory/inventory-cli-reference.md +++ b/src/guides/v2.3/inventory/inventory-cli-reference.md @@ -134,7 +134,9 @@ After updates complete, run the list command to verify: ```bash bin/magento inventory:reservation:list-inconsistencies -r +``` +```terminal No order inconsistencies were found. ```