-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Show 3 decimals tax rates in tax summary section of order in admin UI #3051
Comments
Hi, thanks for the report and analysis. |
In attempting to reproduce this, I noticed that I was unable to even set a TaxRate to On investigation this is because the Have you modified this column (eg via an EntityMetadataModifier) in order to increase the precision? |
Yes sorry I forgot to mention this. Below is my code to modify the precision of the value column to 3. import { EntityMetadataModifier } from "@vendure/core";
import { TaxRate } from "@vendure/core";
import { DecimalTransformer } from "@vendure/core/dist/entity/value-transformers";
import { Column } from "typeorm";
export const taxRateNumericModifier: EntityMetadataModifier = (metadata) => {
const taxRateIndex = metadata.columns.findIndex(
(col) => col.propertyName === "value" && col.target === TaxRate
);
if (-1 < taxRateIndex) {
// Remove the existing column definition from the metadata
metadata.columns.splice(taxRateIndex, 1);
// Add a new column definition with the updated scale
// Any database migration might
// require manual adjustment to avoid data loss or issues.
const instance = new TaxRate();
Column({
type: "decimal",
precision: 5,
scale: 3,
transformer: new DecimalTransformer(),
})(instance, "value");
}
}; |
Alright thanks, that now makes total sense. OK the fix was just published in v3.0.3, enjoy! |
Thank you so much ! |
Describe the bug
It is not a bug but a simple fix can help me greatly. I have a store in the province of Quebec, Canada and in Quebec we have two tax rates, 9.975% and 5%.
I already implemented a plugin to handle all of this on my orders and showing the three decimals in the admin UI in the tax-rates page.
This is how it looks in the admin UI tax rate page.
The problem is in the order detail page, specifically in the tax summary section. See below
I think I already know how to fix this. The tax summary table uses the percentPipe from Angular. The percentPipe supports adding up to three decimals if value provided has three decimals.
The code that needs to be changed is here.
Here is the path for the monorepo if you don't want to click the link : packages/admin-ui/src/lib/order/src/components/order-detail/order-detail.component.html at line 176.
The fix would simply be to replace
percent : '0.0-2'
topercent : '0.0-3'
and Angular percentPipe will handle the rest :)Should I create a pull request for this ?
Thanks
The text was updated successfully, but these errors were encountered: