fix: add optional chaining to reward.program_id access to prevent errors in loyalty logic
This commit is contained in:
parent
adb7b5e1d3
commit
f17f353cbd
@ -24,7 +24,7 @@ patch(PosOrder.prototype, {
|
||||
continue;
|
||||
}
|
||||
|
||||
const taxKey = ['ewallet', 'gift_card'].includes(reward.program_id.program_type)
|
||||
const taxKey = ['ewallet', 'gift_card'].includes(reward.program_id?.program_type)
|
||||
? line.tax_ids.map((t) => t.id)
|
||||
: line.tax_ids.filter((t) => t.amount_type !== 'fixed').map((t) => t.id);
|
||||
|
||||
@ -181,7 +181,7 @@ patch(PosOrder.prototype, {
|
||||
let maxDiscount = reward.discount_max_amount || Infinity;
|
||||
if (reward.discount_mode === "per_point") {
|
||||
// Rewards cannot be partially offered to customers
|
||||
const points = ["ewallet", "gift_card"].includes(reward.program_id.program_type)
|
||||
const points = ["ewallet", "gift_card"].includes(reward.program_id?.program_type)
|
||||
? this._getRealCouponPoints(coupon_id)
|
||||
: Math.floor(this._getRealCouponPoints(coupon_id) / reward.required_points) *
|
||||
reward.required_points;
|
||||
@ -203,7 +203,7 @@ patch(PosOrder.prototype, {
|
||||
|
||||
// These are considered payments and do not require to be either taxed or split by tax
|
||||
const discountProduct = reward.discount_line_product_id;
|
||||
if (["ewallet", "gift_card"].includes(reward.program_id.program_type)) {
|
||||
if (["ewallet", "gift_card"].includes(reward.program_id?.program_type)) {
|
||||
const price = discountProduct.getTaxDetails({
|
||||
overridedValues: {
|
||||
tax_ids: discountProduct.taxes_id,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user