Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(proposal): edit AR invoice update button unresponsive #492

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,11 @@
line_items: invoice.line_items.map((lineItem) => ({
quantity: lineItem.quantity,
product_id: lineItem.product.id,
vat_rate_id: lineItem.product.vat_rate.id,
vat_rate_value: lineItem.product.vat_rate.value,
...(lineItem.product.vat_rate.id !== null
? { vat_rate_id: lineItem.product.vat_rate.id,

Check failure on line 103 in packages/sdk-react/src/components/receivables/InvoiceDetails/ExistingInvoiceDetails/components/EditInvoiceDetails.tsx

View workflow job for this annotation

GitHub Actions / Linting

Insert `⏎·············`
vat_rate_value: lineItem.product.vat_rate.value,
}

Check failure on line 105 in packages/sdk-react/src/components/receivables/InvoiceDetails/ExistingInvoiceDetails/components/EditInvoiceDetails.tsx

View workflow job for this annotation

GitHub Actions / Linting

Insert `·`
: { tax_rate_value: lineItem.product.vat_rate.value / 100 }),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does the '/ 100' means? If it's the conversion from to minor units, it is a wrong way to do so.
The conversion from/to minor units depends on the currency since there is a differect decimal for some currencies.
You should use formatFromMinorUnits/formatToMinorUnits functions form our util hooks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it, I didn't know that

name: lineItem.product.name,
price: lineItem.product.price,
measure_unit_id: lineItem.product.measure_unit?.id ?? '',
Expand All @@ -118,7 +121,6 @@
});

const [actualCurrency, setActualCurrency] = useState(invoice.currency);

const {
handleSubmit,
formState: { isDirty },
Expand Down Expand Up @@ -197,7 +199,10 @@
data: values.line_items.map((lineItem) => ({
quantity: lineItem.quantity,
product_id: lineItem.product_id,
vat_rate_id: lineItem.vat_rate_id,
...(lineItem.vat_rate_id !== undefined
? { vat_rate_id: lineItem.vat_rate_id,

Check failure on line 203 in packages/sdk-react/src/components/receivables/InvoiceDetails/ExistingInvoiceDetails/components/EditInvoiceDetails.tsx

View workflow job for this annotation

GitHub Actions / Linting

Delete `,⏎···················`
}
: { tax_rate_value: lineItem.tax_rate_value * 100 }),
})),
};

Expand Down
Loading