You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
1.1 KiB
25 lines
1.1 KiB
/** @odoo-module **/
|
|
|
|
import { PaymentScreen } from "@point_of_sale/app/screens/payment_screen/payment_screen";
|
|
import { patch } from "@web/core/utils/patch";
|
|
|
|
patch(PaymentScreen.prototype, {
|
|
async afterOrderValidation(suggestToSync = true) {
|
|
//---remaining points calculated after claiming the reward is shown in the redemption history
|
|
const res = super.afterOrderValidation(...arguments);
|
|
if(this.pos.get_order().pointsCost != undefined){
|
|
const order = this.pos.get_order()
|
|
const coupon = order.selectedCoupon
|
|
let pointsOfPartner = 0
|
|
if(order.partner.loyalty_cards.length != undefined){
|
|
pointsOfPartner += order.partner.loyalty_cards[coupon].points
|
|
}
|
|
const pointsWon = order.couponPointChanges[coupon].points
|
|
const pointsSpent = order.pointsCost
|
|
const balance = pointsOfPartner + pointsWon - pointsSpent
|
|
const token = order.access_token
|
|
const remaining_points = this.env.services.orm.call('pos.order.line','remaining_points',[[balance],[token]])
|
|
}
|
|
return res
|
|
},
|
|
});
|
|
|