fix: discount and adjustment fields across financial forms

This commit is contained in:
Ahmed Bouhuolia
2024-12-03 13:54:26 +02:00
parent d5dacaa988
commit 1010d97a92
9 changed files with 39 additions and 26 deletions

View File

@@ -23,6 +23,14 @@ export default class SaleEstimate extends mixin(TenantModel, [
public adjustment: number;
public expirationDate!: string;
public deliveredAt!: string | null;
public approvedAt!: string | null;
public rejectedAt!: string | null;
public convertedToInvoiceId!: number | null;
public convertedToInvoiceAt!: string | null;
/**
* Table name
*/
@@ -45,6 +53,10 @@ export default class SaleEstimate extends mixin(TenantModel, [
'localAmount',
'discountAmount',
'discountPercentage',
'total',
'totalLocal',
'subtotal',
'subtotalLocal',
'isDelivered',
'isExpired',
'isConvertedToInvoice',

View File

@@ -26,7 +26,7 @@ export default class SaleInvoice extends mixin(TenantModel, [
public deliveredAt: Date;
public discount: number;
public discountType: DiscountType;
public adjustments: number;
public adjustment: number | null;
/**
* Table name
@@ -157,7 +157,7 @@ export default class SaleInvoice extends mixin(TenantModel, [
* @returns {number}
*/
get total() {
const adjustmentAmount = defaultTo(this.adjustments, 0);
const adjustmentAmount = defaultTo(this.adjustment, 0);
const differencies = this.discountAmount + adjustmentAmount;
return this.isInclusiveTax