Skip to content

Commit f2f25eb

Browse files
aidasberesineviciusaidasberesinevicius
and
aidasberesinevicius
authored
[Shopify] Integration to use Sales Unit of Measure for inventory synchronization (#26707)
This pull request does not have a related issue as it's part of delivery for development agreed directly with @AndreiPanko Quick summary: We saw that the Sales Unit of Measure should be used for inventory synchronization but there is a bug that prevents it from doing it. In line 61, Item.???Sales Unit Of Measure??? will always be empty, because in the function in line 51, it is cleared. It means that if the statement in line 63 never is true, the Base Unit of Measure will always be used for inventory synchronization. Fixes #26719 Fixes [AB#539103](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/539103) Co-authored-by: aidasberesinevicius <[email protected]>
1 parent 1cd5eb1 commit f2f25eb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Apps/W1/Shopify/app/src/Inventory/Codeunits/ShpfyInventoryAPI.Codeunit.al

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ codeunit 30195 "Shpfy Inventory API"
3333
ShopifyVariant: Record "Shpfy Variant";
3434
StockCalculation: Interface "Shpfy Stock Calculation";
3535
UOM: Code[10];
36+
SalesUOM: Code[10];
3637
begin
3738
SetShop(ShopInventory."Shop Code");
3839
if ShopifyProduct.Get(ShopInventory."Product Id") and ShopifyVariant.Get(ShopInventory."Variant Id") then begin
@@ -48,6 +49,7 @@ codeunit 30195 "Shpfy Inventory API"
4849
end;
4950

5051
StockCalculationFactory(StockCalculation, ShopLocation."Stock Calculation");
52+
SalesUOM := Item."Sales Unit of Measure";
5153
Stock := StockCalculation.GetStock(Item);
5254

5355
case ShopifyVariant."UoM Option Id" of
@@ -58,7 +60,7 @@ codeunit 30195 "Shpfy Inventory API"
5860
3:
5961
UOM := CopyStr(ShopifyVariant."Option 3 Value", 1, MaxStrLen(UOM));
6062
else
61-
UOM := Item."Sales Unit of Measure";
63+
UOM := SalesUOM;
6264
end;
6365
if (UOM <> '') and (UOM <> Item."Base Unit of Measure") then
6466
if ItemUnitofMeasure.Get(Item."No.", UOM) then

0 commit comments

Comments
 (0)