Add tax classification

This commit is contained in:
Hillel Coren 2023-09-11 22:51:12 +03:00
parent 3613efa854
commit 33b2f64b53
7 changed files with 96 additions and 6 deletions

View File

@ -214,6 +214,14 @@ const kTaxCategories = {
kTaxCategoryReverseTax: 'reverse_tax', kTaxCategoryReverseTax: 'reverse_tax',
}; };
const String kTaxClassificationIndividual = 'individual';
const String kTaxClassificationCompany = 'company';
const String kTaxClassificationPartnership = 'partnership';
const String kTaxClassificationTrust = 'trust';
const String kTaxClassificationCharity = 'charity';
const String kTaxClassificationGovernment = 'government';
const String kTaxClassificationOther = 'other';
const String kEInvoiceTypeEN16931 = 'EN16931'; const String kEInvoiceTypeEN16931 = 'EN16931';
const String kEInvoiceTypeXInvoice_2_2 = 'XInvoice_2_2'; const String kEInvoiceTypeXInvoice_2_2 = 'XInvoice_2_2';
const String kEInvoiceTypeXInvoice_2_1 = 'XInvoice_2_1'; const String kEInvoiceTypeXInvoice_2_1 = 'XInvoice_2_1';

View File

@ -107,6 +107,7 @@ class ClientFields {
static const String group = 'group'; static const String group = 'group';
static const String routingId = 'routing_id'; static const String routingId = 'routing_id';
static const String isTaxExempt = 'tax_exempt'; static const String isTaxExempt = 'tax_exempt';
static const String classification = 'classification';
} }
abstract class ClientEntity extends Object abstract class ClientEntity extends Object
@ -157,6 +158,7 @@ abstract class ClientEntity extends Object
customValue4: '', customValue4: '',
routingId: '', routingId: '',
isTaxExempt: false, isTaxExempt: false,
classification: '',
taxData: TaxDataEntity(), taxData: TaxDataEntity(),
contacts: BuiltList<ClientContactEntity>( contacts: BuiltList<ClientContactEntity>(
<ClientContactEntity>[ <ClientContactEntity>[
@ -318,6 +320,8 @@ abstract class ClientEntity extends Object
@BuiltValueField(wireName: 'tax_info') @BuiltValueField(wireName: 'tax_info')
TaxDataEntity get taxData; TaxDataEntity get taxData;
String get classification;
BuiltList<ClientContactEntity> get contacts; BuiltList<ClientContactEntity> get contacts;
@override @override
@ -781,7 +785,8 @@ abstract class ClientEntity extends Object
..routingId = '' ..routingId = ''
..isTaxExempt = false ..isTaxExempt = false
..taxData.replace(TaxDataEntity()) ..taxData.replace(TaxDataEntity())
..paymentBalance = 0; ..paymentBalance = 0
..classification = kTaxClassificationCompany;
static Serializer<ClientEntity> get serializer => _$clientEntitySerializer; static Serializer<ClientEntity> get serializer => _$clientEntitySerializer;
} }

View File

@ -224,6 +224,9 @@ class _$ClientEntitySerializer implements StructuredSerializer<ClientEntity> {
'tax_info', 'tax_info',
serializers.serialize(object.taxData, serializers.serialize(object.taxData,
specifiedType: const FullType(TaxDataEntity)), specifiedType: const FullType(TaxDataEntity)),
'classification',
serializers.serialize(object.classification,
specifiedType: const FullType(String)),
'contacts', 'contacts',
serializers.serialize(object.contacts, serializers.serialize(object.contacts,
specifiedType: const FullType( specifiedType: const FullType(
@ -465,6 +468,10 @@ class _$ClientEntitySerializer implements StructuredSerializer<ClientEntity> {
result.taxData.replace(serializers.deserialize(value, result.taxData.replace(serializers.deserialize(value,
specifiedType: const FullType(TaxDataEntity)) as TaxDataEntity); specifiedType: const FullType(TaxDataEntity)) as TaxDataEntity);
break; break;
case 'classification':
result.classification = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'contacts': case 'contacts':
result.contacts.replace(serializers.deserialize(value, result.contacts.replace(serializers.deserialize(value,
specifiedType: const FullType( specifiedType: const FullType(
@ -1024,6 +1031,8 @@ class _$ClientEntity extends ClientEntity {
@override @override
final TaxDataEntity taxData; final TaxDataEntity taxData;
@override @override
final String classification;
@override
final BuiltList<ClientContactEntity> contacts; final BuiltList<ClientContactEntity> contacts;
@override @override
final BuiltList<ActivityEntity> activities; final BuiltList<ActivityEntity> activities;
@ -1095,6 +1104,7 @@ class _$ClientEntity extends ClientEntity {
this.routingId, this.routingId,
this.isTaxExempt, this.isTaxExempt,
this.taxData, this.taxData,
this.classification,
this.contacts, this.contacts,
this.activities, this.activities,
this.ledger, this.ledger,
@ -1176,6 +1186,8 @@ class _$ClientEntity extends ClientEntity {
BuiltValueNullFieldError.checkNotNull( BuiltValueNullFieldError.checkNotNull(
isTaxExempt, r'ClientEntity', 'isTaxExempt'); isTaxExempt, r'ClientEntity', 'isTaxExempt');
BuiltValueNullFieldError.checkNotNull(taxData, r'ClientEntity', 'taxData'); BuiltValueNullFieldError.checkNotNull(taxData, r'ClientEntity', 'taxData');
BuiltValueNullFieldError.checkNotNull(
classification, r'ClientEntity', 'classification');
BuiltValueNullFieldError.checkNotNull( BuiltValueNullFieldError.checkNotNull(
contacts, r'ClientEntity', 'contacts'); contacts, r'ClientEntity', 'contacts');
BuiltValueNullFieldError.checkNotNull( BuiltValueNullFieldError.checkNotNull(
@ -1245,6 +1257,7 @@ class _$ClientEntity extends ClientEntity {
routingId == other.routingId && routingId == other.routingId &&
isTaxExempt == other.isTaxExempt && isTaxExempt == other.isTaxExempt &&
taxData == other.taxData && taxData == other.taxData &&
classification == other.classification &&
contacts == other.contacts && contacts == other.contacts &&
activities == other.activities && activities == other.activities &&
ledger == other.ledger && ledger == other.ledger &&
@ -1304,6 +1317,7 @@ class _$ClientEntity extends ClientEntity {
_$hash = $jc(_$hash, routingId.hashCode); _$hash = $jc(_$hash, routingId.hashCode);
_$hash = $jc(_$hash, isTaxExempt.hashCode); _$hash = $jc(_$hash, isTaxExempt.hashCode);
_$hash = $jc(_$hash, taxData.hashCode); _$hash = $jc(_$hash, taxData.hashCode);
_$hash = $jc(_$hash, classification.hashCode);
_$hash = $jc(_$hash, contacts.hashCode); _$hash = $jc(_$hash, contacts.hashCode);
_$hash = $jc(_$hash, activities.hashCode); _$hash = $jc(_$hash, activities.hashCode);
_$hash = $jc(_$hash, ledger.hashCode); _$hash = $jc(_$hash, ledger.hashCode);
@ -1364,6 +1378,7 @@ class _$ClientEntity extends ClientEntity {
..add('routingId', routingId) ..add('routingId', routingId)
..add('isTaxExempt', isTaxExempt) ..add('isTaxExempt', isTaxExempt)
..add('taxData', taxData) ..add('taxData', taxData)
..add('classification', classification)
..add('contacts', contacts) ..add('contacts', contacts)
..add('activities', activities) ..add('activities', activities)
..add('ledger', ledger) ..add('ledger', ledger)
@ -1551,6 +1566,11 @@ class ClientEntityBuilder
_$this._taxData ??= new TaxDataEntityBuilder(); _$this._taxData ??= new TaxDataEntityBuilder();
set taxData(TaxDataEntityBuilder taxData) => _$this._taxData = taxData; set taxData(TaxDataEntityBuilder taxData) => _$this._taxData = taxData;
String _classification;
String get classification => _$this._classification;
set classification(String classification) =>
_$this._classification = classification;
ListBuilder<ClientContactEntity> _contacts; ListBuilder<ClientContactEntity> _contacts;
ListBuilder<ClientContactEntity> get contacts => ListBuilder<ClientContactEntity> get contacts =>
_$this._contacts ??= new ListBuilder<ClientContactEntity>(); _$this._contacts ??= new ListBuilder<ClientContactEntity>();
@ -1666,6 +1686,7 @@ class ClientEntityBuilder
_routingId = $v.routingId; _routingId = $v.routingId;
_isTaxExempt = $v.isTaxExempt; _isTaxExempt = $v.isTaxExempt;
_taxData = $v.taxData.toBuilder(); _taxData = $v.taxData.toBuilder();
_classification = $v.classification;
_contacts = $v.contacts.toBuilder(); _contacts = $v.contacts.toBuilder();
_activities = $v.activities.toBuilder(); _activities = $v.activities.toBuilder();
_ledger = $v.ledger.toBuilder(); _ledger = $v.ledger.toBuilder();
@ -1751,6 +1772,7 @@ class ClientEntityBuilder
routingId: BuiltValueNullFieldError.checkNotNull(routingId, r'ClientEntity', 'routingId'), routingId: BuiltValueNullFieldError.checkNotNull(routingId, r'ClientEntity', 'routingId'),
isTaxExempt: BuiltValueNullFieldError.checkNotNull(isTaxExempt, r'ClientEntity', 'isTaxExempt'), isTaxExempt: BuiltValueNullFieldError.checkNotNull(isTaxExempt, r'ClientEntity', 'isTaxExempt'),
taxData: taxData.build(), taxData: taxData.build(),
classification: BuiltValueNullFieldError.checkNotNull(classification, r'ClientEntity', 'classification'),
contacts: contacts.build(), contacts: contacts.build(),
activities: activities.build(), activities: activities.build(),
ledger: ledger.build(), ledger: ledger.build(),
@ -1773,6 +1795,7 @@ class ClientEntityBuilder
_$failedField = 'taxData'; _$failedField = 'taxData';
taxData.build(); taxData.build();
_$failedField = 'contacts'; _$failedField = 'contacts';
contacts.build(); contacts.build();
_$failedField = 'activities'; _$failedField = 'activities';

View File

@ -1000,6 +1000,9 @@ abstract class SettingsEntity
@BuiltValueField(wireName: 'default_expense_payment_type_id') @BuiltValueField(wireName: 'default_expense_payment_type_id')
String get defaultExpensePaymentTypeId; String get defaultExpensePaymentTypeId;
@nullable
String get classification;
bool get hasAddress => address1 != null && address1.isNotEmpty; bool get hasAddress => address1 != null && address1.isNotEmpty;
bool get hasLogo => companyLogo != null && companyLogo.isNotEmpty; bool get hasLogo => companyLogo != null && companyLogo.isNotEmpty;

View File

@ -1534,6 +1534,13 @@ class _$SettingsEntitySerializer
..add(serializers.serialize(value, ..add(serializers.serialize(value,
specifiedType: const FullType(String))); specifiedType: const FullType(String)));
} }
value = object.classification;
if (value != null) {
result
..add('classification')
..add(serializers.serialize(value,
specifiedType: const FullType(String)));
}
return result; return result;
} }
@ -2426,6 +2433,10 @@ class _$SettingsEntitySerializer
result.defaultExpensePaymentTypeId = serializers.deserialize(value, result.defaultExpensePaymentTypeId = serializers.deserialize(value,
specifiedType: const FullType(String)) as String; specifiedType: const FullType(String)) as String;
break; break;
case 'classification':
result.classification = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
} }
} }
@ -2940,6 +2951,8 @@ class _$SettingsEntity extends SettingsEntity {
final String eInvoiceType; final String eInvoiceType;
@override @override
final String defaultExpensePaymentTypeId; final String defaultExpensePaymentTypeId;
@override
final String classification;
factory _$SettingsEntity([void Function(SettingsEntityBuilder) updates]) => factory _$SettingsEntity([void Function(SettingsEntityBuilder) updates]) =>
(new SettingsEntityBuilder()..update(updates))._build(); (new SettingsEntityBuilder()..update(updates))._build();
@ -3162,7 +3175,8 @@ class _$SettingsEntity extends SettingsEntity {
this.showTaskItemDescription, this.showTaskItemDescription,
this.enableEInvoice, this.enableEInvoice,
this.eInvoiceType, this.eInvoiceType,
this.defaultExpensePaymentTypeId}) this.defaultExpensePaymentTypeId,
this.classification})
: super._(); : super._();
@override @override
@ -3399,7 +3413,8 @@ class _$SettingsEntity extends SettingsEntity {
showTaskItemDescription == other.showTaskItemDescription && showTaskItemDescription == other.showTaskItemDescription &&
enableEInvoice == other.enableEInvoice && enableEInvoice == other.enableEInvoice &&
eInvoiceType == other.eInvoiceType && eInvoiceType == other.eInvoiceType &&
defaultExpensePaymentTypeId == other.defaultExpensePaymentTypeId; defaultExpensePaymentTypeId == other.defaultExpensePaymentTypeId &&
classification == other.classification;
} }
int __hashCode; int __hashCode;
@ -3625,6 +3640,7 @@ class _$SettingsEntity extends SettingsEntity {
_$hash = $jc(_$hash, enableEInvoice.hashCode); _$hash = $jc(_$hash, enableEInvoice.hashCode);
_$hash = $jc(_$hash, eInvoiceType.hashCode); _$hash = $jc(_$hash, eInvoiceType.hashCode);
_$hash = $jc(_$hash, defaultExpensePaymentTypeId.hashCode); _$hash = $jc(_$hash, defaultExpensePaymentTypeId.hashCode);
_$hash = $jc(_$hash, classification.hashCode);
_$hash = $jf(_$hash); _$hash = $jf(_$hash);
return __hashCode ??= _$hash; return __hashCode ??= _$hash;
} }
@ -3854,7 +3870,8 @@ class _$SettingsEntity extends SettingsEntity {
..add('showTaskItemDescription', showTaskItemDescription) ..add('showTaskItemDescription', showTaskItemDescription)
..add('enableEInvoice', enableEInvoice) ..add('enableEInvoice', enableEInvoice)
..add('eInvoiceType', eInvoiceType) ..add('eInvoiceType', eInvoiceType)
..add('defaultExpensePaymentTypeId', defaultExpensePaymentTypeId)) ..add('defaultExpensePaymentTypeId', defaultExpensePaymentTypeId)
..add('classification', classification))
.toString(); .toString();
} }
} }
@ -4933,6 +4950,11 @@ class SettingsEntityBuilder
set defaultExpensePaymentTypeId(String defaultExpensePaymentTypeId) => set defaultExpensePaymentTypeId(String defaultExpensePaymentTypeId) =>
_$this._defaultExpensePaymentTypeId = defaultExpensePaymentTypeId; _$this._defaultExpensePaymentTypeId = defaultExpensePaymentTypeId;
String _classification;
String get classification => _$this._classification;
set classification(String classification) =>
_$this._classification = classification;
SettingsEntityBuilder(); SettingsEntityBuilder();
SettingsEntityBuilder get _$this { SettingsEntityBuilder get _$this {
@ -5156,6 +5178,7 @@ class SettingsEntityBuilder
_enableEInvoice = $v.enableEInvoice; _enableEInvoice = $v.enableEInvoice;
_eInvoiceType = $v.eInvoiceType; _eInvoiceType = $v.eInvoiceType;
_defaultExpensePaymentTypeId = $v.defaultExpensePaymentTypeId; _defaultExpensePaymentTypeId = $v.defaultExpensePaymentTypeId;
_classification = $v.classification;
_$v = null; _$v = null;
} }
return this; return this;
@ -5398,7 +5421,8 @@ class SettingsEntityBuilder
showTaskItemDescription: showTaskItemDescription, showTaskItemDescription: showTaskItemDescription,
enableEInvoice: enableEInvoice, enableEInvoice: enableEInvoice,
eInvoiceType: eInvoiceType, eInvoiceType: eInvoiceType,
defaultExpensePaymentTypeId: defaultExpensePaymentTypeId); defaultExpensePaymentTypeId: defaultExpensePaymentTypeId,
classification: classification);
} catch (_) { } catch (_) {
String _$failedField; String _$failedField;
try { try {

View File

@ -82,6 +82,7 @@ class VendorFields {
static const String postalCity = 'postal_city'; static const String postalCity = 'postal_city';
static const String lastLoginAt = 'last_login_at'; static const String lastLoginAt = 'last_login_at';
static const String contactEmail = 'contact_email'; static const String contactEmail = 'contact_email';
static const String classification = 'classification';
} }
abstract class VendorEntity extends Object abstract class VendorEntity extends Object
@ -124,6 +125,7 @@ abstract class VendorEntity extends Object
createdUserId: '', createdUserId: '',
createdAt: 0, createdAt: 0,
lastLogin: 0, lastLogin: 0,
classification: '',
documents: BuiltList<DocumentEntity>(), documents: BuiltList<DocumentEntity>(),
); );
} }
@ -217,6 +219,8 @@ abstract class VendorEntity extends Object
@BuiltValueField(wireName: 'last_login') @BuiltValueField(wireName: 'last_login')
int get lastLogin; int get lastLogin;
String get classification;
BuiltList<VendorContactEntity> get contacts; BuiltList<VendorContactEntity> get contacts;
@override @override
@ -512,7 +516,8 @@ abstract class VendorEntity extends Object
static void _initializeBuilder(VendorEntityBuilder builder) => builder static void _initializeBuilder(VendorEntityBuilder builder) => builder
..activities.replace(BuiltList<ActivityEntity>()) ..activities.replace(BuiltList<ActivityEntity>())
..lastLogin = 0 ..lastLogin = 0
..languageId = ''; ..languageId = ''
..classification = kTaxClassificationCompany;
static Serializer<VendorEntity> get serializer => _$vendorEntitySerializer; static Serializer<VendorEntity> get serializer => _$vendorEntitySerializer;
} }

View File

@ -173,6 +173,9 @@ class _$VendorEntitySerializer implements StructuredSerializer<VendorEntity> {
'last_login', 'last_login',
serializers.serialize(object.lastLogin, serializers.serialize(object.lastLogin,
specifiedType: const FullType(int)), specifiedType: const FullType(int)),
'classification',
serializers.serialize(object.classification,
specifiedType: const FullType(String)),
'contacts', 'contacts',
serializers.serialize(object.contacts, serializers.serialize(object.contacts,
specifiedType: const FullType( specifiedType: const FullType(
@ -334,6 +337,10 @@ class _$VendorEntitySerializer implements StructuredSerializer<VendorEntity> {
result.lastLogin = serializers.deserialize(value, result.lastLogin = serializers.deserialize(value,
specifiedType: const FullType(int)) as int; specifiedType: const FullType(int)) as int;
break; break;
case 'classification':
result.classification = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'contacts': case 'contacts':
result.contacts.replace(serializers.deserialize(value, result.contacts.replace(serializers.deserialize(value,
specifiedType: const FullType( specifiedType: const FullType(
@ -820,6 +827,8 @@ class _$VendorEntity extends VendorEntity {
@override @override
final int lastLogin; final int lastLogin;
@override @override
final String classification;
@override
final BuiltList<VendorContactEntity> contacts; final BuiltList<VendorContactEntity> contacts;
@override @override
final BuiltList<ActivityEntity> activities; final BuiltList<ActivityEntity> activities;
@ -868,6 +877,7 @@ class _$VendorEntity extends VendorEntity {
this.customValue3, this.customValue3,
this.customValue4, this.customValue4,
this.lastLogin, this.lastLogin,
this.classification,
this.contacts, this.contacts,
this.activities, this.activities,
this.documents, this.documents,
@ -916,6 +926,8 @@ class _$VendorEntity extends VendorEntity {
customValue4, r'VendorEntity', 'customValue4'); customValue4, r'VendorEntity', 'customValue4');
BuiltValueNullFieldError.checkNotNull( BuiltValueNullFieldError.checkNotNull(
lastLogin, r'VendorEntity', 'lastLogin'); lastLogin, r'VendorEntity', 'lastLogin');
BuiltValueNullFieldError.checkNotNull(
classification, r'VendorEntity', 'classification');
BuiltValueNullFieldError.checkNotNull( BuiltValueNullFieldError.checkNotNull(
contacts, r'VendorEntity', 'contacts'); contacts, r'VendorEntity', 'contacts');
BuiltValueNullFieldError.checkNotNull( BuiltValueNullFieldError.checkNotNull(
@ -963,6 +975,7 @@ class _$VendorEntity extends VendorEntity {
customValue3 == other.customValue3 && customValue3 == other.customValue3 &&
customValue4 == other.customValue4 && customValue4 == other.customValue4 &&
lastLogin == other.lastLogin && lastLogin == other.lastLogin &&
classification == other.classification &&
contacts == other.contacts && contacts == other.contacts &&
activities == other.activities && activities == other.activities &&
documents == other.documents && documents == other.documents &&
@ -1002,6 +1015,7 @@ class _$VendorEntity extends VendorEntity {
_$hash = $jc(_$hash, customValue3.hashCode); _$hash = $jc(_$hash, customValue3.hashCode);
_$hash = $jc(_$hash, customValue4.hashCode); _$hash = $jc(_$hash, customValue4.hashCode);
_$hash = $jc(_$hash, lastLogin.hashCode); _$hash = $jc(_$hash, lastLogin.hashCode);
_$hash = $jc(_$hash, classification.hashCode);
_$hash = $jc(_$hash, contacts.hashCode); _$hash = $jc(_$hash, contacts.hashCode);
_$hash = $jc(_$hash, activities.hashCode); _$hash = $jc(_$hash, activities.hashCode);
_$hash = $jc(_$hash, documents.hashCode); _$hash = $jc(_$hash, documents.hashCode);
@ -1042,6 +1056,7 @@ class _$VendorEntity extends VendorEntity {
..add('customValue3', customValue3) ..add('customValue3', customValue3)
..add('customValue4', customValue4) ..add('customValue4', customValue4)
..add('lastLogin', lastLogin) ..add('lastLogin', lastLogin)
..add('classification', classification)
..add('contacts', contacts) ..add('contacts', contacts)
..add('activities', activities) ..add('activities', activities)
..add('documents', documents) ..add('documents', documents)
@ -1149,6 +1164,11 @@ class VendorEntityBuilder
int get lastLogin => _$this._lastLogin; int get lastLogin => _$this._lastLogin;
set lastLogin(int lastLogin) => _$this._lastLogin = lastLogin; set lastLogin(int lastLogin) => _$this._lastLogin = lastLogin;
String _classification;
String get classification => _$this._classification;
set classification(String classification) =>
_$this._classification = classification;
ListBuilder<VendorContactEntity> _contacts; ListBuilder<VendorContactEntity> _contacts;
ListBuilder<VendorContactEntity> get contacts => ListBuilder<VendorContactEntity> get contacts =>
_$this._contacts ??= new ListBuilder<VendorContactEntity>(); _$this._contacts ??= new ListBuilder<VendorContactEntity>();
@ -1230,6 +1250,7 @@ class VendorEntityBuilder
_customValue3 = $v.customValue3; _customValue3 = $v.customValue3;
_customValue4 = $v.customValue4; _customValue4 = $v.customValue4;
_lastLogin = $v.lastLogin; _lastLogin = $v.lastLogin;
_classification = $v.classification;
_contacts = $v.contacts.toBuilder(); _contacts = $v.contacts.toBuilder();
_activities = $v.activities.toBuilder(); _activities = $v.activities.toBuilder();
_documents = $v.documents.toBuilder(); _documents = $v.documents.toBuilder();
@ -1297,6 +1318,7 @@ class VendorEntityBuilder
customValue3: BuiltValueNullFieldError.checkNotNull(customValue3, r'VendorEntity', 'customValue3'), customValue3: BuiltValueNullFieldError.checkNotNull(customValue3, r'VendorEntity', 'customValue3'),
customValue4: BuiltValueNullFieldError.checkNotNull(customValue4, r'VendorEntity', 'customValue4'), customValue4: BuiltValueNullFieldError.checkNotNull(customValue4, r'VendorEntity', 'customValue4'),
lastLogin: BuiltValueNullFieldError.checkNotNull(lastLogin, r'VendorEntity', 'lastLogin'), lastLogin: BuiltValueNullFieldError.checkNotNull(lastLogin, r'VendorEntity', 'lastLogin'),
classification: BuiltValueNullFieldError.checkNotNull(classification, r'VendorEntity', 'classification'),
contacts: contacts.build(), contacts: contacts.build(),
activities: activities.build(), activities: activities.build(),
documents: documents.build(), documents: documents.build(),