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