Skip to content

Commit

Permalink
fix(Price add): fix price per kg strange values. ref #1137
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Dec 26, 2024
1 parent a164702 commit cc8d633
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/PriceInputRow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,14 @@ export default {
getPricePerUnit(price) {
if (price) {
price = parseFloat(price)
if (this.priceForm.category_tag) {
if (this.priceForm.type === 'CATEGORY' && this.priceForm.category_tag) {
if (this.priceForm.price_per === 'UNIT') {
return this.$t('PriceCard.PriceValueDisplayUnit', [this.getPriceValue(price, this.priceForm.currency)])
}
// default to 'KILOGRAM'
return this.$t('PriceCard.PriceValueDisplayKilogram', [this.getPriceValue(price, this.priceForm.currency)])
}
if (this.product && this.product.product_quantity) {
else if (this.priceForm.type === 'PRODUCT' && this.product && this.product.product_quantity) {
const pricePerUnit = (price / this.product.product_quantity) * 1000
if (this.product.product_quantity_unit === constants.PRODUCT_QUANTITY_UNIT_ML) {
return this.$t('PriceCard.PriceValueDisplayLitre', [this.getPriceValue(pricePerUnit, this.priceForm.currency)])
Expand Down

0 comments on commit cc8d633

Please sign in to comment.