Group by unit size is specific: it needs to be divided by scale if not the smallest unit

This commit is contained in:
Jean-Baptiste Bellet
2022-01-10 11:24:22 +01:00
parent da9c0f4b8c
commit 4c508a5bf9
2 changed files with 7 additions and 1 deletions

View File

@@ -161,6 +161,12 @@ angular.module("admin.lineItems").controller 'LineItemsCtrl', ($scope, $timeout,
$scope.getFormattedValueWithUnitName = (value, unitsProduct, unitsVariant, scale) ->
unit_name = VariantUnitManager.getUnitName(scale, unitsProduct.variant_unit)
$scope.roundToThreeDecimals(value) + " " + unit_name
$scope.getGroupBySizeFormattedValueWithUnitName = (value, unitsProduct, unitsVariant) ->
scale = $scope.getScale(unitsProduct, unitsVariant)
if scale
value = value / scale if scale != 28.35 && scale != 1 # divide by scale if not smallest unit
$scope.getFormattedValueWithUnitName(value, unitsProduct, unitsVariant, scale)
else
''

View File

@@ -70,7 +70,7 @@
.three.columns
.text-center
= t("admin.orders.bulk_management.group_buy_unit_size")
.text-center {{ formattedValueWithUnitName( selectedUnitsProduct.group_buy_unit_size, selectedUnitsProduct, selectedUnitsVariant ) }}
.text-center {{ getGroupBySizeFormattedValueWithUnitName(selectedUnitsProduct.group_buy_unit_size , selectedUnitsProduct, selectedUnitsVariant ) }}
.three.columns
.text-center
= t("admin.orders.bulk_management.total_qtt_ordered")