Browse Source

Jan 17: [FIX] Bug Fixed 'advanced_loyalty_management'

pull/309/head
Cybrosys Technologies 3 months ago
parent
commit
ca2066017d
  1. 2
      advanced_loyalty_management/__manifest__.py
  2. 5
      advanced_loyalty_management/doc/RELEASE_NOTES.md
  3. 1
      advanced_loyalty_management/models/pos_refund.py
  4. 8
      advanced_loyalty_management/static/src/js/pos_loyalty_card.js
  5. 1
      advanced_loyalty_management/static/src/js/pos_loyalty_deduction.js
  6. 9
      advanced_loyalty_management/static/src/js/pos_payment_screen.js
  7. 1
      advanced_loyalty_management/static/src/js/pos_reward_button.js
  8. 1
      advanced_loyalty_management/static/src/js/pos_ticketscreen.js

2
advanced_loyalty_management/__manifest__.py

@ -21,7 +21,7 @@
############################################################################# #############################################################################
{ {
'name': 'Advanced Loyalty Management', 'name': 'Advanced Loyalty Management',
'version': '17.0.1.0.1', 'version': '17.0.1.0.2',
'category': 'Point of Sale', 'category': 'Point of Sale',
'summary': 'Advanced loyalty Management', 'summary': 'Advanced loyalty Management',
'description': """When an order is refunded, any loyalty points gained from 'description': """When an order is refunded, any loyalty points gained from

5
advanced_loyalty_management/doc/RELEASE_NOTES.md

@ -9,4 +9,9 @@
#### 25.11.2024 #### 25.11.2024
#### Version 17.0.1.0.1 #### Version 17.0.1.0.1
#### ADD #### ADD
- BUG FIX
#### 08.01.2025
#### Version 17.0.1.0.2
#### ADD
- BUG FIX - BUG FIX

1
advanced_loyalty_management/models/pos_refund.py

@ -30,6 +30,7 @@ class PosOrder(models.Model):
def _compute_order_name(self): def _compute_order_name(self):
"""Compute the loyalty points when order is refunded""" """Compute the loyalty points when order is refunded"""
res = super()._compute_order_name() res = super()._compute_order_name()
partner_id = self.partner_id partner_id = self.partner_id
li = [line.mapped('price_subtotal_incl') for line li = [line.mapped('price_subtotal_incl') for line

8
advanced_loyalty_management/static/src/js/pos_loyalty_card.js

@ -1,5 +1,5 @@
/** @odoo-module **/ /** @odoo-module **/
import { _t } from "@web/core/l10n/translation";
import { patch } from "@web/core/utils/patch"; import { patch } from "@web/core/utils/patch";
import { Order } from "@point_of_sale/app/store/models"; import { Order } from "@point_of_sale/app/store/models";
import { roundPrecision as round_pr } from "@web/core/utils/numbers"; import { roundPrecision as round_pr } from "@web/core/utils/numbers";
@ -39,7 +39,11 @@ patch(Order.prototype,{
const discountProduct = reward.discount_line_product_id; const discountProduct = reward.discount_line_product_id;
const rewardCode = _newRandomRewardCode(); const rewardCode = _newRandomRewardCode();
const points = this._getRealCouponPoints(args["coupon_id"]) const points = this._getRealCouponPoints(args["coupon_id"])
const cost = reward.clear_wallet ? points :reward.pointsToRedeem const cost = reward.clear_wallet ? this._getRealCouponPoints(args["coupon_id"]) :reward.pointsToRedeem
if (!discount || discount <= 0) {
console.error("Invalid redemption discount:", { reward });
return [];
}
return[ return[
{ {
product: discountProduct, product: discountProduct,

1
advanced_loyalty_management/static/src/js/pos_loyalty_deduction.js

@ -1,7 +1,6 @@
/** @odoo-module **/ /** @odoo-module **/
import { Order } from "@point_of_sale/app/store/models"; import { Order } from "@point_of_sale/app/store/models";
import { roundPrecision } from "@web/core/utils/numbers"; import { roundPrecision } from "@web/core/utils/numbers";
import { _t } from "@web/core/l10n/translation";
import { patch } from "@web/core/utils/patch"; import { patch } from "@web/core/utils/patch";
patch(Order.prototype, { patch(Order.prototype, {

9
advanced_loyalty_management/static/src/js/pos_payment_screen.js

@ -11,10 +11,13 @@ patch(PaymentScreen.prototype, {
const order = this.pos.get_order() const order = this.pos.get_order()
const coupon = order.selectedCoupon const coupon = order.selectedCoupon
let pointsOfPartner = 0 let pointsOfPartner = 0
if(order.partner.loyalty_cards.length != undefined){ if (order.partner && Array.isArray(order.partner.loyalty_cards)) {
pointsOfPartner += order.partner.loyalty_cards[coupon].points const loyaltyCard = order.partner.loyalty_cards[coupon];
if (loyaltyCard && loyaltyCard.points !== undefined) {
pointsOfPartner += loyaltyCard.points;
} }
const pointsWon = order.couponPointChanges[coupon].points }
const pointsWon = order.couponPointChanges?.[coupon]?.points || 0;
const pointsSpent = order.pointsCost const pointsSpent = order.pointsCost
const balance = pointsOfPartner + pointsWon - pointsSpent const balance = pointsOfPartner + pointsWon - pointsSpent
const token = order.access_token const token = order.access_token

1
advanced_loyalty_management/static/src/js/pos_reward_button.js

@ -40,6 +40,7 @@ patch(RewardButton.prototype,{
rewards = claimableRewards.filter( rewards = claimableRewards.filter(
({ reward }) => reward.program_id.program_type !== "ewallet" ({ reward }) => reward.program_id.program_type !== "ewallet"
); );
} }
var pointCheck = false var pointCheck = false
for (const pointChange of Object.values(order.couponPointChanges)){ for (const pointChange of Object.values(order.couponPointChanges)){

1
advanced_loyalty_management/static/src/js/pos_ticketscreen.js

@ -13,7 +13,6 @@ patch(TicketScreen.prototype, {
triggerAtInput: (event) => this._onUpdateSelectedOrderline(event), triggerAtInput: (event) => this._onUpdateSelectedOrderline(event),
}); });
super.setup(...arguments); super.setup(...arguments);
}, },
async onDoRefund() { async onDoRefund() {
//---------to get the points cost from the reward lines //---------to get the points cost from the reward lines

Loading…
Cancel
Save