Fix some UOM bugs for new customer order

This commit is contained in:
Lance Edgar 2021-01-27 08:50:20 -06:00
parent 480d878db8
commit d1d64ec96c
2 changed files with 24 additions and 14 deletions

View file

@ -698,6 +698,21 @@
}
},
setProductUnitChoices(choices) {
this.productUnitChoices = choices
let found = false
for (let uom of choices) {
if (this.productUOM == uom.key) {
found = true
break
}
}
if (!found) {
this.productUOM = choices[0].key
}
},
fetchProductByUPC() {
let params = {
action: 'find_product_by_upc',
@ -714,6 +729,7 @@
this.productUUID = response.data.uuid
this.productUPC = response.data.upc_pretty
this.productDisplay = response.data.full_description
this.setProductUnitChoices(response.data.uom_choices)
}
})
},
@ -728,18 +744,7 @@
this.submitBatchData(params, response => {
this.productUPC = response.data.upc_pretty
this.productDisplay = response.data.full_description
this.productUnitChoices = response.data.uom_choices
let found = false
for (let uom of this.productUnitChoices) {
if (this.productUOM == uom.key) {
found = true
break
}
}
if (!found) {
this.productUOM = this.productUnitChoices[0].key
}
this.setProductUnitChoices(response.data.uom_choices)
})
} else {
this.clearProduct()