Tax model

This commit is contained in:
Hillel Coren 2023-04-18 22:19:03 +03:00
parent 7a6b9a717f
commit 5a17c60302
4 changed files with 51 additions and 2 deletions

View File

@ -247,6 +247,7 @@ abstract class InvoiceEntity extends Object
dueDateDays: 'terms',
saveDefaultTerms: false,
saveDefaultFooter: false,
taxData: '',
);
}
@ -594,6 +595,9 @@ abstract class InvoiceEntity extends Object
@BuiltValueField(wireName: 'auto_bill_enabled')
bool get autoBillEnabled;
@BuiltValueField(wireName: 'tax_data')
String get taxData;
@nullable
String get filename;
@ -1516,7 +1520,8 @@ abstract class InvoiceEntity extends Object
..saveDefaultTerms = false
..saveDefaultFooter = false
..autoBillEnabled = false
..subscriptionId = '';
..subscriptionId = ''
..taxData = '';
static Serializer<InvoiceEntity> get serializer => _$invoiceEntitySerializer;
}

View File

@ -263,6 +263,9 @@ class _$InvoiceEntitySerializer implements StructuredSerializer<InvoiceEntity> {
'auto_bill_enabled',
serializers.serialize(object.autoBillEnabled,
specifiedType: const FullType(bool)),
'tax_data',
serializers.serialize(object.taxData,
specifiedType: const FullType(String)),
'line_items',
serializers.serialize(object.lineItems,
specifiedType: const FullType(
@ -667,6 +670,10 @@ class _$InvoiceEntitySerializer implements StructuredSerializer<InvoiceEntity> {
result.autoBillEnabled = serializers.deserialize(value,
specifiedType: const FullType(bool)) as bool;
break;
case 'tax_data':
result.taxData = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
break;
case 'filename':
result.filename = serializers.deserialize(value,
specifiedType: const FullType(String)) as String;
@ -1544,6 +1551,8 @@ class _$InvoiceEntity extends InvoiceEntity {
@override
final bool autoBillEnabled;
@override
final String taxData;
@override
final String filename;
@override
final BuiltList<InvoiceScheduleEntity> recurringDates;
@ -1641,6 +1650,7 @@ class _$InvoiceEntity extends InvoiceEntity {
this.invoiceId,
this.recurringId,
this.autoBillEnabled,
this.taxData,
this.filename,
this.recurringDates,
this.lineItems,
@ -1744,6 +1754,7 @@ class _$InvoiceEntity extends InvoiceEntity {
nextSendDate, r'InvoiceEntity', 'nextSendDate');
BuiltValueNullFieldError.checkNotNull(
autoBillEnabled, r'InvoiceEntity', 'autoBillEnabled');
BuiltValueNullFieldError.checkNotNull(taxData, r'InvoiceEntity', 'taxData');
BuiltValueNullFieldError.checkNotNull(
lineItems, r'InvoiceEntity', 'lineItems');
BuiltValueNullFieldError.checkNotNull(
@ -1833,6 +1844,7 @@ class _$InvoiceEntity extends InvoiceEntity {
invoiceId == other.invoiceId &&
recurringId == other.recurringId &&
autoBillEnabled == other.autoBillEnabled &&
taxData == other.taxData &&
filename == other.filename &&
recurringDates == other.recurringDates &&
lineItems == other.lineItems &&
@ -1913,6 +1925,7 @@ class _$InvoiceEntity extends InvoiceEntity {
_$hash = $jc(_$hash, invoiceId.hashCode);
_$hash = $jc(_$hash, recurringId.hashCode);
_$hash = $jc(_$hash, autoBillEnabled.hashCode);
_$hash = $jc(_$hash, taxData.hashCode);
_$hash = $jc(_$hash, filename.hashCode);
_$hash = $jc(_$hash, recurringDates.hashCode);
_$hash = $jc(_$hash, lineItems.hashCode);
@ -1993,6 +2006,7 @@ class _$InvoiceEntity extends InvoiceEntity {
..add('invoiceId', invoiceId)
..add('recurringId', recurringId)
..add('autoBillEnabled', autoBillEnabled)
..add('taxData', taxData)
..add('filename', filename)
..add('recurringDates', recurringDates)
..add('lineItems', lineItems)
@ -2262,6 +2276,10 @@ class InvoiceEntityBuilder
set autoBillEnabled(bool autoBillEnabled) =>
_$this._autoBillEnabled = autoBillEnabled;
String _taxData;
String get taxData => _$this._taxData;
set taxData(String taxData) => _$this._taxData = taxData;
String _filename;
String get filename => _$this._filename;
set filename(String filename) => _$this._filename = filename;
@ -2412,6 +2430,7 @@ class InvoiceEntityBuilder
_invoiceId = $v.invoiceId;
_recurringId = $v.recurringId;
_autoBillEnabled = $v.autoBillEnabled;
_taxData = $v.taxData;
_filename = $v.filename;
_recurringDates = $v.recurringDates?.toBuilder();
_lineItems = $v.lineItems.toBuilder();
@ -2519,6 +2538,7 @@ class InvoiceEntityBuilder
invoiceId: invoiceId,
recurringId: recurringId,
autoBillEnabled: BuiltValueNullFieldError.checkNotNull(autoBillEnabled, r'InvoiceEntity', 'autoBillEnabled'),
taxData: BuiltValueNullFieldError.checkNotNull(taxData, r'InvoiceEntity', 'taxData'),
filename: filename,
recurringDates: _recurringDates?.build(),
lineItems: lineItems.build(),

View File

@ -102,6 +102,7 @@ abstract class ProductEntity extends Object
stockNotification: true,
imageUrl: '',
maxQuantity: 0,
taxId: 0,
documents: BuiltList<DocumentEntity>(),
);
}
@ -179,6 +180,9 @@ abstract class ProductEntity extends Object
@BuiltValueField(wireName: 'max_quantity')
int get maxQuantity;
@BuiltValueField(wireName: 'tax_id')
int get taxId;
BuiltList<DocumentEntity> get documents;
@override
@ -362,7 +366,8 @@ abstract class ProductEntity extends Object
..stockNotification = true
..stockNotificationThreshold = 0
..imageUrl = ''
..maxQuantity = 0;
..maxQuantity = 0
..taxId = 0;
static Serializer<ProductEntity> get serializer => _$productEntitySerializer;
}

View File

@ -177,6 +177,8 @@ class _$ProductEntitySerializer implements StructuredSerializer<ProductEntity> {
'max_quantity',
serializers.serialize(object.maxQuantity,
specifiedType: const FullType(int)),
'tax_id',
serializers.serialize(object.taxId, specifiedType: const FullType(int)),
'documents',
serializers.serialize(object.documents,
specifiedType: const FullType(
@ -317,6 +319,10 @@ class _$ProductEntitySerializer implements StructuredSerializer<ProductEntity> {
result.maxQuantity = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
case 'tax_id':
result.taxId = serializers.deserialize(value,
specifiedType: const FullType(int)) as int;
break;
case 'documents':
result.documents.replace(serializers.deserialize(value,
specifiedType: const FullType(
@ -601,6 +607,8 @@ class _$ProductEntity extends ProductEntity {
@override
final int maxQuantity;
@override
final int taxId;
@override
final BuiltList<DocumentEntity> documents;
@override
final bool isChanged;
@ -643,6 +651,7 @@ class _$ProductEntity extends ProductEntity {
this.stockNotification,
this.imageUrl,
this.maxQuantity,
this.taxId,
this.documents,
this.isChanged,
this.createdAt,
@ -690,6 +699,7 @@ class _$ProductEntity extends ProductEntity {
imageUrl, r'ProductEntity', 'imageUrl');
BuiltValueNullFieldError.checkNotNull(
maxQuantity, r'ProductEntity', 'maxQuantity');
BuiltValueNullFieldError.checkNotNull(taxId, r'ProductEntity', 'taxId');
BuiltValueNullFieldError.checkNotNull(
documents, r'ProductEntity', 'documents');
BuiltValueNullFieldError.checkNotNull(
@ -732,6 +742,7 @@ class _$ProductEntity extends ProductEntity {
stockNotification == other.stockNotification &&
imageUrl == other.imageUrl &&
maxQuantity == other.maxQuantity &&
taxId == other.taxId &&
documents == other.documents &&
isChanged == other.isChanged &&
createdAt == other.createdAt &&
@ -768,6 +779,7 @@ class _$ProductEntity extends ProductEntity {
_$hash = $jc(_$hash, stockNotification.hashCode);
_$hash = $jc(_$hash, imageUrl.hashCode);
_$hash = $jc(_$hash, maxQuantity.hashCode);
_$hash = $jc(_$hash, taxId.hashCode);
_$hash = $jc(_$hash, documents.hashCode);
_$hash = $jc(_$hash, isChanged.hashCode);
_$hash = $jc(_$hash, createdAt.hashCode);
@ -804,6 +816,7 @@ class _$ProductEntity extends ProductEntity {
..add('stockNotification', stockNotification)
..add('imageUrl', imageUrl)
..add('maxQuantity', maxQuantity)
..add('taxId', taxId)
..add('documents', documents)
..add('isChanged', isChanged)
..add('createdAt', createdAt)
@ -903,6 +916,10 @@ class ProductEntityBuilder
int get maxQuantity => _$this._maxQuantity;
set maxQuantity(int maxQuantity) => _$this._maxQuantity = maxQuantity;
int _taxId;
int get taxId => _$this._taxId;
set taxId(int taxId) => _$this._taxId = taxId;
ListBuilder<DocumentEntity> _documents;
ListBuilder<DocumentEntity> get documents =>
_$this._documents ??= new ListBuilder<DocumentEntity>();
@ -970,6 +987,7 @@ class ProductEntityBuilder
_stockNotification = $v.stockNotification;
_imageUrl = $v.imageUrl;
_maxQuantity = $v.maxQuantity;
_taxId = $v.taxId;
_documents = $v.documents.toBuilder();
_isChanged = $v.isChanged;
_createdAt = $v.createdAt;
@ -1032,6 +1050,7 @@ class ProductEntityBuilder
stockNotification: BuiltValueNullFieldError.checkNotNull(stockNotification, r'ProductEntity', 'stockNotification'),
imageUrl: BuiltValueNullFieldError.checkNotNull(imageUrl, r'ProductEntity', 'imageUrl'),
maxQuantity: BuiltValueNullFieldError.checkNotNull(maxQuantity, r'ProductEntity', 'maxQuantity'),
taxId: BuiltValueNullFieldError.checkNotNull(taxId, r'ProductEntity', 'taxId'),
documents: documents.build(),
isChanged: isChanged,
createdAt: BuiltValueNullFieldError.checkNotNull(createdAt, r'ProductEntity', 'createdAt'),