Fix: Create item with tax (ItemModal) (#385)

The issue was found during an Item creation inside the Invoice,
Estimates or Recurring Invoice, the same fix that was applied into the
Item creation view, now is needed into ItemModal. The root cause is that
price + tax returns an amount as float making the database fail.

Relates #377
This commit is contained in:
Fabio Ribeiro
2025-08-30 11:38:04 +02:00
committed by GitHub
parent 2f8c98003d
commit e8e01a706e

View File

@@ -208,15 +208,15 @@ const v$ = useVuelidate(
const getTaxTypes = computed(() => {
return taxTypeStore.taxTypes.map((tax) => {
const amount = tax.calculation_type === 'fixed'
const amount = tax.calculation_type === 'fixed'
? new Intl.NumberFormat(undefined, {
style: 'currency',
currency: companyStore.selectedCompanyCurrency.code
}).format(tax.fixed_amount / 100)
: `${tax.percent}%`
return {
...tax,
return {
...tax,
tax_name: `${tax.name} (${amount})`
}
})
@@ -239,7 +239,7 @@ async function submitItemData() {
taxes: itemStore.currentItem.taxes.map((tax) => {
return {
tax_type_id: tax.id,
amount: tax.calculation_type === 'fixed' ? tax.fixed_amount : (price.value * tax.percent) / 100,
amount: tax.calculation_type === 'fixed' ? tax.fixed_amount : Math.round(price.value * tax.percent),
percent: tax.percent,
fixed_amount: tax.fixed_amount,
calculation_type: tax.calculation_type,