Add notify_vendor_when_paid option

This commit is contained in:
Hillel Coren 2023-01-08 11:36:37 +02:00
parent e338970131
commit b87ccffca4
5 changed files with 51 additions and 2 deletions

View File

@ -120,6 +120,7 @@ abstract class CompanyEntity extends Object
invoiceTaskLock: false,
convertPaymentCurrency: false,
convertExpenseCurrency: false,
notifyVendorWhenPaid: false,
groups: BuiltList<GroupEntity>(),
taxRates: BuiltList<TaxRateEntity>(),
taskStatuses: BuiltList<TaskStatusEntity>(),
@ -304,6 +305,9 @@ abstract class CompanyEntity extends Object
@BuiltValueField(wireName: 'convert_expense_currency')
bool get convertExpenseCurrency;
@BuiltValueField(wireName: 'notify_vendor_when_paid')
bool get notifyVendorWhenPaid;
BuiltList<GroupEntity> get groups;
BuiltList<ActivityEntity> get activities;
@ -716,6 +720,7 @@ abstract class CompanyEntity extends Object
..matomoId = ''
..convertPaymentCurrency = false
..convertExpenseCurrency = false
..notifyVendorWhenPaid = false
..systemLogs.replace(BuiltList<SystemLogEntity>())
..subscriptions.replace(BuiltList<SubscriptionEntity>())
..recurringExpenses.replace(BuiltList<ExpenseEntity>())

View File

@ -173,6 +173,9 @@ class _$CompanyEntitySerializer implements StructuredSerializer<CompanyEntity> {
'convert_expense_currency',
serializers.serialize(object.convertExpenseCurrency,
specifiedType: const FullType(bool)),
'notify_vendor_when_paid',
serializers.serialize(object.notifyVendorWhenPaid,
specifiedType: const FullType(bool)),
'groups',
serializers.serialize(object.groups,
specifiedType:
@ -608,6 +611,10 @@ class _$CompanyEntitySerializer implements StructuredSerializer<CompanyEntity> {
result.convertExpenseCurrency = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
break;
case 'notify_vendor_when_paid':
result.notifyVendorWhenPaid = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
break;
case 'groups':
result.groups.replace(serializers.deserialize(value,
specifiedType: const FullType(
@ -1679,6 +1686,8 @@ class _$CompanyEntity extends CompanyEntity {
@override
final bool convertExpenseCurrency;
@override
final bool notifyVendorWhenPaid;
@override
final BuiltList<GroupEntity> groups;
@override
final BuiltList<ActivityEntity> activities;
@ -1849,6 +1858,7 @@ class _$CompanyEntity extends CompanyEntity {
this.invoiceTaskLock,
this.convertPaymentCurrency,
this.convertExpenseCurrency,
this.notifyVendorWhenPaid,
this.groups,
this.activities,
this.taxRates,
@ -2000,6 +2010,8 @@ class _$CompanyEntity extends CompanyEntity {
convertPaymentCurrency, 'CompanyEntity', 'convertPaymentCurrency');
BuiltValueNullFieldError.checkNotNull(
convertExpenseCurrency, 'CompanyEntity', 'convertExpenseCurrency');
BuiltValueNullFieldError.checkNotNull(
notifyVendorWhenPaid, 'CompanyEntity', 'notifyVendorWhenPaid');
BuiltValueNullFieldError.checkNotNull(groups, 'CompanyEntity', 'groups');
BuiltValueNullFieldError.checkNotNull(
activities, 'CompanyEntity', 'activities');
@ -2159,6 +2171,7 @@ class _$CompanyEntity extends CompanyEntity {
invoiceTaskLock == other.invoiceTaskLock &&
convertPaymentCurrency == other.convertPaymentCurrency &&
convertExpenseCurrency == other.convertExpenseCurrency &&
notifyVendorWhenPaid == other.notifyVendorWhenPaid &&
groups == other.groups &&
activities == other.activities &&
taxRates == other.taxRates &&
@ -2242,7 +2255,7 @@ class _$CompanyEntity extends CompanyEntity {
$jc(
$jc(
$jc(
$jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, enableCustomSurchargeTaxes1.hashCode), enableCustomSurchargeTaxes2.hashCode), enableCustomSurchargeTaxes3.hashCode), enableCustomSurchargeTaxes4.hashCode), sizeId.hashCode), industryId.hashCode), subdomain.hashCode), portalMode.hashCode), portalDomain.hashCode), updateProducts.hashCode), convertProductExchangeRate.hashCode), convertRateToClient.hashCode), fillProducts.hashCode), enableProductCost.hashCode), enableProductQuantity.hashCode), enableProductDiscount.hashCode), defaultTaskIsDateBased.hashCode), defaultQuantity.hashCode), showProductDetails.hashCode), clientCanRegister.hashCode), isLarge.hashCode), isDisabled.hashCode), enableShopApi.hashCode), companyKey.hashCode), firstDayOfWeek.hashCode), firstMonthOfYear.hashCode), numberOfInvoiceTaxRates.hashCode), numberOfItemTaxRates.hashCode), numberOfExpenseTaxRates.hashCode), expenseInclusiveTaxes.hashCode), sessionTimeout.hashCode), passwordTimeout.hashCode), oauthPasswordRequired.hashCode), markdownEnabled.hashCode), markdownEmailEnabled.hashCode), useCommaAsDecimalPlace.hashCode), reportIncludeDrafts.hashCode), reportIncludeDeleted.hashCode), useQuoteTermsOnConversion.hashCode), enableApplyingPayments.hashCode), trackInventory.hashCode), stockNotificationThreshold.hashCode), stockNotification.hashCode), invoiceTaskLock.hashCode), convertPaymentCurrency.hashCode), convertExpenseCurrency.hashCode), groups.hashCode), activities.hashCode), taxRates.hashCode), taskStatuses.hashCode), taskStatusMap.hashCode), companyGateways.hashCode), expenseCategories.hashCode), users.hashCode), clients.hashCode), products.hashCode), invoices.hashCode), recurringInvoices.hashCode), recurringExpenses.hashCode), payments.hashCode), quotes.hashCode), credits.hashCode), purchaseOrders.hashCode), bankAccounts.hashCode), transactions.hashCode), transactionRules.hashCode), tasks.hashCode), projects.hashCode), expenses.hashCode), vendors.hashCode), designs.hashCode), documents.hashCode), tokens.hashCode), webhooks.hashCode), subscriptions.hashCode), paymentTerms.hashCode), systemLogs.hashCode), clientRegistrationFields.hashCode), customFields.hashCode), slackWebhookUrl.hashCode), googleAnalyticsKey.hashCode), matomoUrl.hashCode), matomoId.hashCode), markExpensesInvoiceable.hashCode), markExpensesPaid.hashCode), invoiceExpenseDocuments.hashCode), invoiceTaskDocuments.hashCode),
$jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, enableCustomSurchargeTaxes1.hashCode), enableCustomSurchargeTaxes2.hashCode), enableCustomSurchargeTaxes3.hashCode), enableCustomSurchargeTaxes4.hashCode), sizeId.hashCode), industryId.hashCode), subdomain.hashCode), portalMode.hashCode), portalDomain.hashCode), updateProducts.hashCode), convertProductExchangeRate.hashCode), convertRateToClient.hashCode), fillProducts.hashCode), enableProductCost.hashCode), enableProductQuantity.hashCode), enableProductDiscount.hashCode), defaultTaskIsDateBased.hashCode), defaultQuantity.hashCode), showProductDetails.hashCode), clientCanRegister.hashCode), isLarge.hashCode), isDisabled.hashCode), enableShopApi.hashCode), companyKey.hashCode), firstDayOfWeek.hashCode), firstMonthOfYear.hashCode), numberOfInvoiceTaxRates.hashCode), numberOfItemTaxRates.hashCode), numberOfExpenseTaxRates.hashCode), expenseInclusiveTaxes.hashCode), sessionTimeout.hashCode), passwordTimeout.hashCode), oauthPasswordRequired.hashCode), markdownEnabled.hashCode), markdownEmailEnabled.hashCode), useCommaAsDecimalPlace.hashCode), reportIncludeDrafts.hashCode), reportIncludeDeleted.hashCode), useQuoteTermsOnConversion.hashCode), enableApplyingPayments.hashCode), trackInventory.hashCode), stockNotificationThreshold.hashCode), stockNotification.hashCode), invoiceTaskLock.hashCode), convertPaymentCurrency.hashCode), convertExpenseCurrency.hashCode), notifyVendorWhenPaid.hashCode), groups.hashCode), activities.hashCode), taxRates.hashCode), taskStatuses.hashCode), taskStatusMap.hashCode), companyGateways.hashCode), expenseCategories.hashCode), users.hashCode), clients.hashCode), products.hashCode), invoices.hashCode), recurringInvoices.hashCode), recurringExpenses.hashCode), payments.hashCode), quotes.hashCode), credits.hashCode), purchaseOrders.hashCode), bankAccounts.hashCode), transactions.hashCode), transactionRules.hashCode), tasks.hashCode), projects.hashCode), expenses.hashCode), vendors.hashCode), designs.hashCode), documents.hashCode), tokens.hashCode), webhooks.hashCode), subscriptions.hashCode), paymentTerms.hashCode), systemLogs.hashCode), clientRegistrationFields.hashCode), customFields.hashCode), slackWebhookUrl.hashCode), googleAnalyticsKey.hashCode), matomoUrl.hashCode), matomoId.hashCode), markExpensesInvoiceable.hashCode), markExpensesPaid.hashCode), invoiceExpenseDocuments.hashCode), invoiceTaskDocuments.hashCode),
invoiceTaskTimelog.hashCode),
invoiceTaskDatelog.hashCode),
invoiceTaskProject.hashCode),
@ -2313,6 +2326,7 @@ class _$CompanyEntity extends CompanyEntity {
..add('invoiceTaskLock', invoiceTaskLock)
..add('convertPaymentCurrency', convertPaymentCurrency)
..add('convertExpenseCurrency', convertExpenseCurrency)
..add('notifyVendorWhenPaid', notifyVendorWhenPaid)
..add('groups', groups)
..add('activities', activities)
..add('taxRates', taxRates)
@ -2602,6 +2616,11 @@ class CompanyEntityBuilder
set convertExpenseCurrency(bool convertExpenseCurrency) =>
_$this._convertExpenseCurrency = convertExpenseCurrency;
bool _notifyVendorWhenPaid;
bool get notifyVendorWhenPaid => _$this._notifyVendorWhenPaid;
set notifyVendorWhenPaid(bool notifyVendorWhenPaid) =>
_$this._notifyVendorWhenPaid = notifyVendorWhenPaid;
ListBuilder<GroupEntity> _groups;
ListBuilder<GroupEntity> get groups =>
_$this._groups ??= new ListBuilder<GroupEntity>();
@ -2972,6 +2991,7 @@ class CompanyEntityBuilder
_invoiceTaskLock = $v.invoiceTaskLock;
_convertPaymentCurrency = $v.convertPaymentCurrency;
_convertExpenseCurrency = $v.convertExpenseCurrency;
_notifyVendorWhenPaid = $v.notifyVendorWhenPaid;
_groups = $v.groups.toBuilder();
_activities = $v.activities.toBuilder();
_taxRates = $v.taxRates.toBuilder();
@ -3114,6 +3134,7 @@ class CompanyEntityBuilder
invoiceTaskLock: BuiltValueNullFieldError.checkNotNull(invoiceTaskLock, 'CompanyEntity', 'invoiceTaskLock'),
convertPaymentCurrency: BuiltValueNullFieldError.checkNotNull(convertPaymentCurrency, 'CompanyEntity', 'convertPaymentCurrency'),
convertExpenseCurrency: BuiltValueNullFieldError.checkNotNull(convertExpenseCurrency, 'CompanyEntity', 'convertExpenseCurrency'),
notifyVendorWhenPaid: BuiltValueNullFieldError.checkNotNull(notifyVendorWhenPaid, 'CompanyEntity', 'notifyVendorWhenPaid'),
groups: groups.build(),
activities: activities.build(),
taxRates: taxRates.build(),

View File

@ -88,6 +88,16 @@ class _ExpenseSettingsState extends State<ExpenseSettings> {
),
],
),
FormCard(children: <Widget>[
SwitchListTile(
activeColor: Theme.of(context).colorScheme.secondary,
title: Text(localization.notifyVendorWhenPaid),
value: company.notifyVendorWhenPaid ?? false,
subtitle: Text(localization.notifyVendorWhenPaidHelp),
onChanged: (value) => viewModel.onCompanyChanged(
company.rebuild((b) => b..notifyVendorWhenPaid = value)),
),
]),
if (company.numberOfItemTaxRates > 0)
FormCard(
children: [

View File

@ -418,7 +418,7 @@ class SettingsSearch extends StatelessWidget {
'auto_start_tasks',
'show_tasks_table',
'client_portal',
'lock_tasks',
'lock_invoiced_tasks',
],
],
kSettingsTaskStatuses: [
@ -431,6 +431,8 @@ class SettingsSearch extends StatelessWidget {
'should_be_invoiced',
'mark_paid',
'inclusive_taxes',
'convert_currency',
'notify_vendor_when_paid',
],
],
kSettingsExpenseCategories: [

View File

@ -16,6 +16,9 @@ mixin LocalizationsProvider on LocaleCodeAware {
static final Map<String, Map<String, String>> _localizedValues = {
'en': {
// STARTER: lang key - do not remove comment
'notify_vendor_when_paid': 'Notify Vendor When Paid',
'notify_vendor_when_paid_help':
'Send an email to the vendor when the expense is marked as paid',
'update_payment': 'Update Payment',
'markup': 'Markup',
'purchase_order_created': 'Purchase Order Created',
@ -92933,6 +92936,14 @@ mixin LocalizationsProvider on LocaleCodeAware {
_localizedValues[localeCode]['update_payment'] ??
_localizedValues['en']['update_payment'];
String get notifyVendorWhenPaid =>
_localizedValues[localeCode]['notify_vendor_when_paid'] ??
_localizedValues['en']['notify_vendor_when_paid'];
String get notifyVendorWhenPaidHelp =>
_localizedValues[localeCode]['notify_vendor_when_paid_help'] ??
_localizedValues['en']['notify_vendor_when_paid_help'];
// STARTER: lang field - do not remove comment
String lookup(String key) {