fixed invoice discount

This commit is contained in:
Peter Papp
2021-05-20 10:42:58 +02:00
parent ed9c80eb74
commit 8389f7a4d6
3 changed files with 119 additions and 107 deletions
@@ -511,12 +511,6 @@
}
},
watch: {
isDiscount(val) {
if (!val) {
this.invoice.discount_rate = 10
this.invoice.discount_type = 'percent'
}
},
'invoice.invoice_number': function (val) {
this.invoice.variable_number = val
},
@@ -416,14 +416,6 @@
return total
}
},
watch: {
isDiscount(val) {
if (!val) {
this.invoice.discount_rate = null
this.invoice.discount_type = null
}
},
},
data() {
return {
fullDetails: undefined,
@@ -543,13 +535,14 @@
})
},
addRow() {
let lastTaxRate = this.invoice.items.slice(-1).pop()
let lastItem = this.invoice.items.slice(-1).pop()
this.invoice.items.push({
id: Math.floor(Math.random() * 10000000),
description: '',
amount: 1,
tax_rate: lastTaxRate?.tax_rate || 21,
unit: lastItem?.unit || this.$t('in_editor.default_unit'),
tax_rate: lastItem?.tax_rate || 21,
price: 1,
})