Support entity actions in reports
This commit is contained in:
parent
15bcca30bb
commit
599955c980
|
|
@ -216,8 +216,8 @@ abstract class DocumentEntity extends Object
|
|||
}
|
||||
}
|
||||
|
||||
if (userCompany.canCreate(EntityType.document)) {
|
||||
actions.add(EntityAction.clone);
|
||||
if (!isDeleted && multiselect) {
|
||||
actions.add(EntityAction.documents);
|
||||
}
|
||||
|
||||
if (actions.isNotEmpty && actions.last != null) {
|
||||
|
|
|
|||
|
|
@ -265,16 +265,6 @@ class FilterDocumentsByCustom4 implements PersistUI {
|
|||
|
||||
void handleDocumentAction(
|
||||
BuildContext context, List<BaseEntity> documents, EntityAction action) {
|
||||
assert(
|
||||
[
|
||||
EntityAction.restore,
|
||||
EntityAction.archive,
|
||||
EntityAction.delete,
|
||||
EntityAction.toggleMultiselect
|
||||
].contains(action) ||
|
||||
documents.length == 1,
|
||||
'Cannot perform this action on more than one document');
|
||||
|
||||
if (documents.isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -338,6 +328,17 @@ void handleDocumentAction(
|
|||
entities: [document],
|
||||
);
|
||||
break;
|
||||
case EntityAction.documents:
|
||||
store.dispatch(
|
||||
DownloadDocumentsRequest(
|
||||
documentIds: documentIds,
|
||||
completer: snackBarCompleter<Null>(
|
||||
context,
|
||||
localization.exportedData,
|
||||
),
|
||||
),
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -216,16 +216,6 @@ class FilterTaxRatesByState implements PersistUI {
|
|||
|
||||
void handleTaxRateAction(
|
||||
BuildContext context, List<BaseEntity> taxRates, EntityAction action) {
|
||||
assert(
|
||||
[
|
||||
EntityAction.restore,
|
||||
EntityAction.archive,
|
||||
EntityAction.delete,
|
||||
EntityAction.toggleMultiselect
|
||||
].contains(action) ||
|
||||
taxRates.length == 1,
|
||||
'Cannot perform this action on more than one tax rate');
|
||||
|
||||
if (taxRates.isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -274,16 +274,6 @@ class FilterVendorsByCustom4 implements PersistUI {
|
|||
|
||||
void handleVendorAction(
|
||||
BuildContext context, List<BaseEntity> vendors, EntityAction action) {
|
||||
assert(
|
||||
[
|
||||
EntityAction.restore,
|
||||
EntityAction.archive,
|
||||
EntityAction.delete,
|
||||
EntityAction.toggleMultiselect
|
||||
].contains(action) ||
|
||||
vendors.length == 1,
|
||||
'Cannot perform this action on more than one vendor');
|
||||
|
||||
if (vendors.isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,6 +161,7 @@ ReportResult documentReport(
|
|||
final row = _getRow(client, document);
|
||||
if (row != null) {
|
||||
data.add(row);
|
||||
entities.add(document);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -170,6 +171,7 @@ ReportResult documentReport(
|
|||
final row = _getRow(product, document);
|
||||
if (row != null) {
|
||||
data.add(row);
|
||||
entities.add(document);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -179,6 +181,7 @@ ReportResult documentReport(
|
|||
final row = _getRow(invoice, document);
|
||||
if (row != null) {
|
||||
data.add(row);
|
||||
entities.add(document);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue