Fix stock quantity column in product report

This commit is contained in:
Hillel Coren 2023-01-26 11:54:15 +02:00
parent b9cf440c6c
commit 5693ece1a3
3 changed files with 10 additions and 4 deletions

View File

@ -105,7 +105,10 @@ class EntityPresenter {
].contains(field);
static bool isFieldAmount(String field) {
return ['quantity'].contains(field);
return [
'quantity',
'stock_quantity',
].contains(field);
}
static bool isFieldNumeric(String field) {

View File

@ -149,7 +149,7 @@ ReportResult productReport(
);
break;
case ProductReportFields.stock_quantity:
value = product.stockQuantity;
value = product.stockQuantity.toDouble();
break;
case ProductReportFields.notification_threshold:
value = productNotificationThreshold(
@ -174,7 +174,10 @@ ReportResult productReport(
if (value.runtimeType == bool) {
row.add(product.getReportBool(value: value));
} else if (column == ProductReportFields.quantity) {
} else if ([
ProductReportFields.quantity,
ProductReportFields.stock_quantity
].contains(column)) {
row.add(product.getReportDouble(
value: value,
currencyId: userCompany.company.currencyId,

View File

@ -1355,7 +1355,7 @@ class ReportResult {
} else if (columnType == ReportColumnType.number) {
final currencyId = values['${column}_currency_id'];
value = formatNumber(values[column], context,
formatNumberType: column == 'quantity'
formatNumberType: column.toLowerCase().contains('quantity')
? FormatNumberType.double
: FormatNumberType.money,
currencyId: