Purchase orders
This commit is contained in:
parent
1f255fbb9f
commit
3d7a309aab
|
|
@ -133,6 +133,7 @@ abstract class InvoiceEntity extends Object
|
|||
String id,
|
||||
AppState state,
|
||||
ClientEntity client,
|
||||
VendorEntity vendor,
|
||||
UserEntity user,
|
||||
EntityType entityType,
|
||||
}) {
|
||||
|
|
@ -161,7 +162,7 @@ abstract class InvoiceEntity extends Object
|
|||
taxAmount: 0,
|
||||
poNumber: '',
|
||||
projectId: '',
|
||||
vendorId: '',
|
||||
vendorId: vendor?.id ?? '',
|
||||
date: convertDateTimeToSqlDate(),
|
||||
dueDate: '',
|
||||
publicNotes: '',
|
||||
|
|
@ -211,11 +212,16 @@ abstract class InvoiceEntity extends Object
|
|||
usesInclusiveTaxes: company?.settings?.enableInclusiveTaxes ?? false,
|
||||
documents: BuiltList<DocumentEntity>(),
|
||||
activities: BuiltList<ActivityEntity>(),
|
||||
invitations: client == null
|
||||
? BuiltList<InvitationEntity>()
|
||||
: BuiltList(client.emailContacts
|
||||
invitations: client != null
|
||||
? BuiltList(client.emailContacts
|
||||
.map((contact) => InvitationEntity(clientContactId: contact.id))
|
||||
.toList()),
|
||||
.toList())
|
||||
: vendor != null
|
||||
? BuiltList(vendor.emailContacts
|
||||
.map((contact) =>
|
||||
InvitationEntity(vendorContactId: contact.id))
|
||||
.toList())
|
||||
: BuiltList<InvitationEntity>(),
|
||||
updatedAt: 0,
|
||||
archivedAt: 0,
|
||||
isDeleted: false,
|
||||
|
|
|
|||
|
|
@ -203,6 +203,10 @@ abstract class VendorEntity extends Object
|
|||
actions.add(EntityAction.edit);
|
||||
}
|
||||
|
||||
if (userCompany.canCreate(EntityType.purchaseOrder)) {
|
||||
actions.add(EntityAction.newPurchaseOrder);
|
||||
}
|
||||
|
||||
if (userCompany.canCreate(EntityType.expense)) {
|
||||
actions.add(EntityAction.newExpense);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -288,6 +288,16 @@ void handleVendorAction(
|
|||
case EntityAction.edit:
|
||||
editEntity(entity: vendor);
|
||||
break;
|
||||
case EntityAction.newPurchaseOrder:
|
||||
createEntity(
|
||||
context: context,
|
||||
entity: InvoiceEntity(
|
||||
state: state,
|
||||
vendor: vendor,
|
||||
entityType: EntityType.purchaseOrder,
|
||||
),
|
||||
);
|
||||
break;
|
||||
case EntityAction.newExpense:
|
||||
createEntity(
|
||||
context: context,
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ IconData getEntityActionIcon(EntityAction entityAction) {
|
|||
case EntityAction.newRecurringInvoice:
|
||||
case EntityAction.newRecurringQuote:
|
||||
case EntityAction.newRecurringExpense:
|
||||
case EntityAction.newPurchaseOrder:
|
||||
case EntityAction.invoiceTask:
|
||||
case EntityAction.invoiceExpense:
|
||||
case EntityAction.invoiceProject:
|
||||
|
|
|
|||
Loading…
Reference in New Issue