Skip to content

Commit

Permalink
Fix: Apply Discount To All Lines (adempiere#1792)
Browse files Browse the repository at this point in the history
  • Loading branch information
elsiosanchez authored Dec 19, 2023
1 parent bd9da24 commit 16c0187
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ export default defineComponent({
})
} else {
const isProduct = store.getters.getListOrderLines.find(list => list.product.id === search.product.id)
if (isEmptyValue(isProduct)) {
store.dispatch('newLine', {
productId: search.product.id,
quantity: 1
})
.finally(() => {
searchProduct.value = ''
autocompleteSearchProduct.value.close()
autocompleteSearchProduct.value.suggestions = []
})
return
}
store.dispatch('updateCurrentLine', {
lineId: isProduct.id,
quantity: Number(isProduct.quantity_ordered) + 1
Expand Down
21 changes: 17 additions & 4 deletions src/components/ADempiere/Form/VPOS2/Options/salesOrder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ along with this program. If not, see <https:www.gnu.org/licenses/>.
<template>
<el-row :gutter="10">
<el-col :span="8">
<!-- newOrder -->
<div @click="newOrder">
<el-card
shadow="never"
Expand All @@ -33,6 +34,7 @@ along with this program. If not, see <https:www.gnu.org/licenses/>.
</el-card>
</div>
</el-col>
<!-- ordersHistory -->
<el-col :span="8">
<div>
<el-card
Expand Down Expand Up @@ -61,6 +63,7 @@ along with this program. If not, see <https:www.gnu.org/licenses/>.
</el-dialog>
</div>
</el-col>
<!-- addResource -->
<el-col :span="8">
<div @click="addResource">
<el-card
Expand Down Expand Up @@ -327,7 +330,7 @@ along with this program. If not, see <https:www.gnu.org/licenses/>.
<!-- applyDiscountOnOrder -->
<el-col v-if="isAllowsApplyDiscount" :span="8">
<el-popover
v-model="isShowApplyDiscount"
ref="showApplyDiscountOnOrder"
placement="bottom"
width="350"
:title="$t('form.pos.applyDiscountOnOrder')"
Expand Down Expand Up @@ -380,7 +383,9 @@ along with this program. If not, see <https:www.gnu.org/licenses/>.
element-loading-background="rgba(255, 255, 255, 0.8)"
class="view-loading"
/>
<div slot="reference">
<div
slot="reference"
>
<el-card
shadow="never"
class="custom-card-options"
Expand All @@ -400,7 +405,7 @@ along with this program. If not, see <https:www.gnu.org/licenses/>.
<!-- applyDiscountToAllLines -->
<el-col v-if="isAllowsApplyDiscount" :span="8">
<el-popover
v-model="isShowApplyDiscount"
ref="showApplyDiscountToAllLines"
placement="bottom"
width="350"
:title="$t('form.pos.applyDiscountOnOrder')"
Expand Down Expand Up @@ -453,7 +458,9 @@ along with this program. If not, see <https:www.gnu.org/licenses/>.
element-loading-background="rgba(255, 255, 255, 0.8)"
class="view-loading"
/>
<div slot="reference">
<div
slot="reference"
>
<el-card
shadow="never"
class="custom-card-options"
Expand Down Expand Up @@ -551,6 +558,8 @@ export default defineComponent({
const isLoadingCopyOrder = ref(false)
const isLoadingCancelOrder = ref(false)
const isLoadingRMA = ref((false))
const showApplyDiscountOnOrder = ref(null)
const showApplyDiscountToAllLines = ref(null)
const isLoadingApplyDiscountOnOrder = ref(false)
const messageReverseSales = ref('')
const applyDiscountAmount = ref(0)
Expand Down Expand Up @@ -708,6 +717,8 @@ export default defineComponent({
}

function closeApplyDiscount() {
showApplyDiscountOnOrder.value.showPopper = false
showApplyDiscountToAllLines.value.showPopper = false
applyDiscountAmount.value = 0
isShowApplyDiscount.value = false
}
Expand Down Expand Up @@ -882,7 +893,9 @@ export default defineComponent({
isShowApplyDiscount,
isLoadingPrintTicket,
isLoadingCancelOrder,
showApplyDiscountOnOrder,
isLoadingPreviewDocument,
showApplyDiscountToAllLines,
isShowCancelSaleTransaction,
isLoadingApplyDiscountOnOrder,
isLoadingCancelSaleTransaction,
Expand Down

0 comments on commit 16c0187

Please sign in to comment.