From d87056597ea7dc25447d41c727ce3600f69b364a Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 8 Jul 2024 09:59:15 +0300 Subject: [PATCH 1/3] Add hasExpenseTaxes getter --- lib/data/models/company_model.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/data/models/company_model.dart b/lib/data/models/company_model.dart index cef8480bc7..449bc82a28 100644 --- a/lib/data/models/company_model.dart +++ b/lib/data/models/company_model.dart @@ -610,6 +610,8 @@ abstract class CompanyEntity extends Object bool get hasItemTaxes => numberOfItemTaxRates > 0; + bool get hasExpenseTaxes => numberOfExpenseTaxRates > 0; + bool get hasTaxes => hasInvoiceTaxes || hasItemTaxes; bool get isSmall => !isLarge; From 3a92e2c3e32c1963cc75bfb493b04f239481d5db Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 8 Jul 2024 15:30:39 +0300 Subject: [PATCH 2/3] Fix for e-invoice login error --- lib/data/models/company_model.dart | 10 +++++----- lib/data/models/company_model.g.dart | 28 ---------------------------- lib/data/models/invoice_model.dart | 8 ++++---- lib/data/models/invoice_model.g.dart | 27 --------------------------- lib/data/models/serializers.g.dart | 8 -------- 5 files changed, 9 insertions(+), 72 deletions(-) diff --git a/lib/data/models/company_model.dart b/lib/data/models/company_model.dart index 449bc82a28..e579106527 100644 --- a/lib/data/models/company_model.dart +++ b/lib/data/models/company_model.dart @@ -175,7 +175,7 @@ abstract class CompanyEntity extends Object transactions: BuiltList(), transactionRules: BuiltList(), schedules: BuiltList(), - eInvoice: BuiltMap(), + //eInvoice: BuiltMap(), ); } @@ -518,8 +518,8 @@ abstract class CompanyEntity extends Object @BuiltValueField(wireName: 'e_invoice_certificate_passphrase') String get eInvoiceCertificatePassphrase; - @BuiltValueField(wireName: 'e_invoice') - BuiltMap get eInvoice; + //@BuiltValueField(wireName: 'e_invoice') + //BuiltMap get eInvoice; String get displayName => settings.name ?? ''; @@ -891,8 +891,8 @@ abstract class CompanyEntity extends Object ..bankAccounts.replace(BuiltList()) ..transactions.replace(BuiltList()) ..transactionRules.replace(BuiltList()) - ..schedules.replace(BuiltList()) - ..eInvoice.replace(BuiltMap()); + ..schedules.replace(BuiltList()); + //..eInvoice.replace(BuiltMap()) static Serializer get serializer => _$companyEntitySerializer; } diff --git a/lib/data/models/company_model.g.dart b/lib/data/models/company_model.g.dart index 282b44a98b..854d8c405f 100644 --- a/lib/data/models/company_model.g.dart +++ b/lib/data/models/company_model.g.dart @@ -416,10 +416,6 @@ class _$CompanyEntitySerializer implements StructuredSerializer { 'e_invoice_certificate_passphrase', serializers.serialize(object.eInvoiceCertificatePassphrase, specifiedType: const FullType(String)), - 'e_invoice', - serializers.serialize(object.eInvoice, - specifiedType: const FullType(BuiltMap, - const [const FullType(String), const FullType(dynamic)])), 'created_at', serializers.serialize(object.createdAt, specifiedType: const FullType(int)), @@ -1013,11 +1009,6 @@ class _$CompanyEntitySerializer implements StructuredSerializer { result.eInvoiceCertificatePassphrase = serializers.deserialize(value, specifiedType: const FullType(String))! as String; break; - case 'e_invoice': - result.eInvoice.replace(serializers.deserialize(value, - specifiedType: const FullType(BuiltMap, - const [const FullType(String), const FullType(dynamic)]))!); - break; case 'isChanged': result.isChanged = serializers.deserialize(value, specifiedType: const FullType(bool)) as bool?; @@ -1936,8 +1927,6 @@ class _$CompanyEntity extends CompanyEntity { @override final String eInvoiceCertificatePassphrase; @override - final BuiltMap eInvoice; - @override final bool? isChanged; @override final int createdAt; @@ -2075,7 +2064,6 @@ class _$CompanyEntity extends CompanyEntity { required this.hasEInvoiceCertificate, required this.hasEInvoiceCertificatePassphrase, required this.eInvoiceCertificatePassphrase, - required this.eInvoice, this.isChanged, required this.createdAt, required this.updatedAt, @@ -2304,8 +2292,6 @@ class _$CompanyEntity extends CompanyEntity { r'CompanyEntity', 'hasEInvoiceCertificatePassphrase'); BuiltValueNullFieldError.checkNotNull(eInvoiceCertificatePassphrase, r'CompanyEntity', 'eInvoiceCertificatePassphrase'); - BuiltValueNullFieldError.checkNotNull( - eInvoice, r'CompanyEntity', 'eInvoice'); BuiltValueNullFieldError.checkNotNull( createdAt, r'CompanyEntity', 'createdAt'); BuiltValueNullFieldError.checkNotNull( @@ -2442,7 +2428,6 @@ class _$CompanyEntity extends CompanyEntity { hasEInvoiceCertificatePassphrase == other.hasEInvoiceCertificatePassphrase && eInvoiceCertificatePassphrase == other.eInvoiceCertificatePassphrase && - eInvoice == other.eInvoice && isChanged == other.isChanged && createdAt == other.createdAt && updatedAt == other.updatedAt && @@ -2574,7 +2559,6 @@ class _$CompanyEntity extends CompanyEntity { _$hash = $jc(_$hash, hasEInvoiceCertificate.hashCode); _$hash = $jc(_$hash, hasEInvoiceCertificatePassphrase.hashCode); _$hash = $jc(_$hash, eInvoiceCertificatePassphrase.hashCode); - _$hash = $jc(_$hash, eInvoice.hashCode); _$hash = $jc(_$hash, isChanged.hashCode); _$hash = $jc(_$hash, createdAt.hashCode); _$hash = $jc(_$hash, updatedAt.hashCode); @@ -2707,7 +2691,6 @@ class _$CompanyEntity extends CompanyEntity { ..add('hasEInvoiceCertificatePassphrase', hasEInvoiceCertificatePassphrase) ..add('eInvoiceCertificatePassphrase', eInvoiceCertificatePassphrase) - ..add('eInvoice', eInvoice) ..add('isChanged', isChanged) ..add('createdAt', createdAt) ..add('updatedAt', updatedAt) @@ -3318,12 +3301,6 @@ class CompanyEntityBuilder set eInvoiceCertificatePassphrase(String? eInvoiceCertificatePassphrase) => _$this._eInvoiceCertificatePassphrase = eInvoiceCertificatePassphrase; - MapBuilder? _eInvoice; - MapBuilder get eInvoice => - _$this._eInvoice ??= new MapBuilder(); - set eInvoice(MapBuilder? eInvoice) => - _$this._eInvoice = eInvoice; - bool? _isChanged; bool? get isChanged => _$this._isChanged; set isChanged(bool? isChanged) => _$this._isChanged = isChanged; @@ -3484,7 +3461,6 @@ class CompanyEntityBuilder _hasEInvoiceCertificate = $v.hasEInvoiceCertificate; _hasEInvoiceCertificatePassphrase = $v.hasEInvoiceCertificatePassphrase; _eInvoiceCertificatePassphrase = $v.eInvoiceCertificatePassphrase; - _eInvoice = $v.eInvoice.toBuilder(); _isChanged = $v.isChanged; _createdAt = $v.createdAt; _updatedAt = $v.updatedAt; @@ -3647,7 +3623,6 @@ class CompanyEntityBuilder hasEInvoiceCertificate: BuiltValueNullFieldError.checkNotNull(hasEInvoiceCertificate, r'CompanyEntity', 'hasEInvoiceCertificate'), hasEInvoiceCertificatePassphrase: BuiltValueNullFieldError.checkNotNull(hasEInvoiceCertificatePassphrase, r'CompanyEntity', 'hasEInvoiceCertificatePassphrase'), eInvoiceCertificatePassphrase: BuiltValueNullFieldError.checkNotNull(eInvoiceCertificatePassphrase, r'CompanyEntity', 'eInvoiceCertificatePassphrase'), - eInvoice: eInvoice.build(), isChanged: isChanged, createdAt: BuiltValueNullFieldError.checkNotNull(createdAt, r'CompanyEntity', 'createdAt'), updatedAt: BuiltValueNullFieldError.checkNotNull(updatedAt, r'CompanyEntity', 'updatedAt'), @@ -3736,9 +3711,6 @@ class CompanyEntityBuilder taxConfig.build(); _$failedField = 'taxData'; taxData.build(); - - _$failedField = 'eInvoice'; - eInvoice.build(); } catch (e) { throw new BuiltValueNestedFieldError( r'CompanyEntity', _$failedField, e.toString()); diff --git a/lib/data/models/invoice_model.dart b/lib/data/models/invoice_model.dart index 2a8f99affe..fda442e59f 100644 --- a/lib/data/models/invoice_model.dart +++ b/lib/data/models/invoice_model.dart @@ -252,7 +252,7 @@ abstract class InvoiceEntity extends Object saveDefaultTerms: false, saveDefaultFooter: false, taxData: TaxDataEntity(), - eInvoice: BuiltMap(), + //eInvoice: BuiltMap(), ); } @@ -578,8 +578,8 @@ abstract class InvoiceEntity extends Object @BuiltValueField(wireName: 'tax_info') TaxDataEntity get taxData; - @BuiltValueField(wireName: 'e_invoice') - BuiltMap get eInvoice; + //@BuiltValueField(wireName: 'e_invoice') + //BuiltMap get eInvoice; bool get isApproved { if (isQuote && @@ -1561,7 +1561,7 @@ abstract class InvoiceEntity extends Object ..autoBillEnabled = false ..nextSendDatetime = '' ..taxData.replace(TaxDataEntity()) - ..eInvoice.replace(BuiltMap()) + //..eInvoice.replace(BuiltMap()) ..subscriptionId = ''; static Serializer get serializer => _$invoiceEntitySerializer; diff --git a/lib/data/models/invoice_model.g.dart b/lib/data/models/invoice_model.g.dart index 7a7e064f75..bc63bedaba 100644 --- a/lib/data/models/invoice_model.g.dart +++ b/lib/data/models/invoice_model.g.dart @@ -285,10 +285,6 @@ class _$InvoiceEntitySerializer implements StructuredSerializer { 'tax_info', serializers.serialize(object.taxData, specifiedType: const FullType(TaxDataEntity)), - 'e_invoice', - serializers.serialize(object.eInvoice, - specifiedType: const FullType(BuiltMap, - const [const FullType(String), const FullType(dynamic)])), 'created_at', serializers.serialize(object.createdAt, specifiedType: const FullType(int)), @@ -708,11 +704,6 @@ class _$InvoiceEntitySerializer implements StructuredSerializer { result.taxData.replace(serializers.deserialize(value, specifiedType: const FullType(TaxDataEntity))! as TaxDataEntity); break; - case 'e_invoice': - result.eInvoice.replace(serializers.deserialize(value, - specifiedType: const FullType(BuiltMap, - const [const FullType(String), const FullType(dynamic)]))!); - break; case 'loadedAt': result.loadedAt = serializers.deserialize(value, specifiedType: const FullType(int)) as int?; @@ -1591,8 +1582,6 @@ class _$InvoiceEntity extends InvoiceEntity { @override final TaxDataEntity taxData; @override - final BuiltMap eInvoice; - @override final int? loadedAt; @override final bool? isChanged; @@ -1683,7 +1672,6 @@ class _$InvoiceEntity extends InvoiceEntity { required this.saveDefaultTerms, required this.saveDefaultFooter, required this.taxData, - required this.eInvoice, this.loadedAt, this.isChanged, required this.createdAt, @@ -1794,8 +1782,6 @@ class _$InvoiceEntity extends InvoiceEntity { BuiltValueNullFieldError.checkNotNull( saveDefaultFooter, r'InvoiceEntity', 'saveDefaultFooter'); BuiltValueNullFieldError.checkNotNull(taxData, r'InvoiceEntity', 'taxData'); - BuiltValueNullFieldError.checkNotNull( - eInvoice, r'InvoiceEntity', 'eInvoice'); BuiltValueNullFieldError.checkNotNull( createdAt, r'InvoiceEntity', 'createdAt'); BuiltValueNullFieldError.checkNotNull( @@ -1881,7 +1867,6 @@ class _$InvoiceEntity extends InvoiceEntity { saveDefaultTerms == other.saveDefaultTerms && saveDefaultFooter == other.saveDefaultFooter && taxData == other.taxData && - eInvoice == other.eInvoice && isChanged == other.isChanged && createdAt == other.createdAt && updatedAt == other.updatedAt && @@ -1963,7 +1948,6 @@ class _$InvoiceEntity extends InvoiceEntity { _$hash = $jc(_$hash, saveDefaultTerms.hashCode); _$hash = $jc(_$hash, saveDefaultFooter.hashCode); _$hash = $jc(_$hash, taxData.hashCode); - _$hash = $jc(_$hash, eInvoice.hashCode); _$hash = $jc(_$hash, isChanged.hashCode); _$hash = $jc(_$hash, createdAt.hashCode); _$hash = $jc(_$hash, updatedAt.hashCode); @@ -2046,7 +2030,6 @@ class _$InvoiceEntity extends InvoiceEntity { ..add('saveDefaultTerms', saveDefaultTerms) ..add('saveDefaultFooter', saveDefaultFooter) ..add('taxData', taxData) - ..add('eInvoice', eInvoice) ..add('loadedAt', loadedAt) ..add('isChanged', isChanged) ..add('createdAt', createdAt) @@ -2358,12 +2341,6 @@ class InvoiceEntityBuilder _$this._taxData ??= new TaxDataEntityBuilder(); set taxData(TaxDataEntityBuilder? taxData) => _$this._taxData = taxData; - MapBuilder? _eInvoice; - MapBuilder get eInvoice => - _$this._eInvoice ??= new MapBuilder(); - set eInvoice(MapBuilder? eInvoice) => - _$this._eInvoice = eInvoice; - int? _loadedAt; int? get loadedAt => _$this._loadedAt; set loadedAt(int? loadedAt) => _$this._loadedAt = loadedAt; @@ -2479,7 +2456,6 @@ class InvoiceEntityBuilder _saveDefaultTerms = $v.saveDefaultTerms; _saveDefaultFooter = $v.saveDefaultFooter; _taxData = $v.taxData.toBuilder(); - _eInvoice = $v.eInvoice.toBuilder(); _loadedAt = $v.loadedAt; _isChanged = $v.isChanged; _createdAt = $v.createdAt; @@ -2588,7 +2564,6 @@ class InvoiceEntityBuilder saveDefaultTerms: BuiltValueNullFieldError.checkNotNull(saveDefaultTerms, r'InvoiceEntity', 'saveDefaultTerms'), saveDefaultFooter: BuiltValueNullFieldError.checkNotNull(saveDefaultFooter, r'InvoiceEntity', 'saveDefaultFooter'), taxData: taxData.build(), - eInvoice: eInvoice.build(), loadedAt: loadedAt, isChanged: isChanged, createdAt: BuiltValueNullFieldError.checkNotNull(createdAt, r'InvoiceEntity', 'createdAt'), @@ -2615,8 +2590,6 @@ class InvoiceEntityBuilder _$failedField = 'taxData'; taxData.build(); - _$failedField = 'eInvoice'; - eInvoice.build(); } catch (e) { throw new BuiltValueNestedFieldError( r'InvoiceEntity', _$failedField, e.toString()); diff --git a/lib/data/models/serializers.g.dart b/lib/data/models/serializers.g.dart index f4645122f6..71358b2587 100644 --- a/lib/data/models/serializers.g.dart +++ b/lib/data/models/serializers.g.dart @@ -504,10 +504,6 @@ Serializers _$serializers = (new Serializers().toBuilder() const FullType( BuiltMap, const [const FullType(String), const FullType(String)]), () => new MapBuilder()) - ..addBuilderFactory( - const FullType(BuiltMap, - const [const FullType(String), const FullType(dynamic)]), - () => new MapBuilder()) ..addBuilderFactory( const FullType(BuiltList, const [const FullType(HistoryRecord)]), () => new ListBuilder()) @@ -536,10 +532,6 @@ Serializers _$serializers = (new Serializers().toBuilder() ..addBuilderFactory( const FullType(BuiltList, const [const FullType(ActivityEntity)]), () => new ListBuilder()) - ..addBuilderFactory( - const FullType(BuiltMap, - const [const FullType(String), const FullType(dynamic)]), - () => new MapBuilder()) ..addBuilderFactory( const FullType(BuiltList, const [const FullType(LanguageEntity)]), () => new ListBuilder()) From 85d39b54a5069d30c24dba1c148d687fbe6b66e1 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 8 Jul 2024 15:38:18 +0300 Subject: [PATCH 3/3] =?UTF-8?q?Don=E2=80=99t=20clear=20filter=20when=20add?= =?UTF-8?q?ing=20item=20when=20clicking=20+=20to=20add=20products?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ui/invoice/edit/invoice_item_selector.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/ui/invoice/edit/invoice_item_selector.dart b/lib/ui/invoice/edit/invoice_item_selector.dart index fa0d36ba30..6ac9d9e352 100644 --- a/lib/ui/invoice/edit/invoice_item_selector.dart +++ b/lib/ui/invoice/edit/invoice_item_selector.dart @@ -108,8 +108,6 @@ class _InvoiceItemSelectorState extends State void _toggleEntity(BaseEntity entity) { setState(() { - _filter = ''; - _textController.text = ''; if (_selected.contains(entity)) { _selected.remove(entity); } else {