Should be divided by scale if the smallest unit

This commit is contained in:
Jean-Baptiste Bellet
2022-01-10 11:27:18 +01:00
parent 4c508a5bf9
commit c5beff249e

View File

@@ -182,6 +182,8 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
if $scope.selectedUnitsProduct.hasOwnProperty("group_buy_unit_size") && $scope.selectedUnitsProduct.group_buy_unit_size > 0 &&
$scope.selectedUnitsProduct.hasOwnProperty("variant_unit") &&
( $scope.selectedUnitsProduct.variant_unit == "weight" || $scope.selectedUnitsProduct.variant_unit == "volume" )
scale = $scope.getScale($scope.selectedUnitsProduct, $scope.selectedUnitsVariant)
sumOfUnitValues = sumOfUnitValues / scale if scale == 28.35 # divide by scale if smallest unit
$scope.roundToThreeDecimals(sumOfUnitValues / $scope.selectedUnitsProduct.group_buy_unit_size * $scope.selectedUnitsVariant.unit_value)
else
''