Skip to content

Commit e1a9f79

Browse files
paan-odoovlst-odoo
authored andcommitted
[IMP] pos_loyalty: rename methods to camelCase
In this commit: - We are renaming methods `_get_reward_lines` with `_getRewardLines` and `_get_regular_order_lines` with `_getRegularOrderLines`. task-4766756
1 parent 24921d6 commit e1a9f79

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

addons/pos_loyalty/static/src/app/models/pos_order.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ patch(PosOrder.prototype, {
142142
waitForPushOrder() {
143143
return (
144144
Object.keys(this.uiState.couponPointChanges || {}).length > 0 ||
145-
this._get_reward_lines().length ||
145+
this._getRewardLines().length ||
146146
super.waitForPushOrder(...arguments)
147147
);
148148
},
@@ -175,13 +175,13 @@ patch(PosOrder.prototype, {
175175

176176
return [...nonRewardLines, ...rewardLines];
177177
},
178-
_get_reward_lines() {
178+
_getRewardLines() {
179179
if (this.lines) {
180180
return this.lines.filter((line) => line.is_reward_line);
181181
}
182182
return this.lines;
183183
},
184-
_get_regular_order_lines() {
184+
_getRegularOrderLines() {
185185
if (this.lines) {
186186
return this.lines.filter((line) => !line.is_reward_line && !line.refunded_orderline_id);
187187
}
@@ -230,7 +230,7 @@ patch(PosOrder.prototype, {
230230
if (!this.lines.length) {
231231
return;
232232
}
233-
const rewardLines = this._get_reward_lines();
233+
const rewardLines = this._getRewardLines();
234234
if (!rewardLines.length) {
235235
return;
236236
}
@@ -334,7 +334,7 @@ patch(PosOrder.prototype, {
334334
const balance = loyaltyCard.points;
335335
won += points - this._getPointsCorrection(program);
336336
if (coupon_id !== 0) {
337-
for (const line of this._get_reward_lines()) {
337+
for (const line of this._getRewardLines()) {
338338
if (line.coupon_id.id === coupon_id) {
339339
spent += line.points_cost;
340340
}
@@ -680,7 +680,7 @@ patch(PosOrder.prototype, {
680680
* @param {*} rule
681681
*/
682682
_computeNItems(rule) {
683-
return this._get_regular_order_lines().reduce((nItems, line) => {
683+
return this._getRegularOrderLines().reduce((nItems, line) => {
684684
let increment = 0;
685685
if (rule.any_product || rule.validProductIds.has(line.product_id.id)) {
686686
increment = line.getQuantity();
@@ -1223,7 +1223,7 @@ patch(PosOrder.prototype, {
12231223
reward.reward_product_ids.map((reward) => reward.id).includes(product.id) &&
12241224
reward.reward_product_ids.map((reward) => reward.id).includes(line.getProduct().id)
12251225
) {
1226-
if (this._get_reward_lines() == 0) {
1226+
if (this._getRewardLines() == 0) {
12271227
if (line.getProduct() === product) {
12281228
available += line.getQuantity();
12291229
}
@@ -1385,7 +1385,7 @@ patch(PosOrder.prototype, {
13851385
this.uiState.disabledRewards,
13861386
this.uiState.codeActivatedProgramRules,
13871387
Object.keys(this.uiState.couponPointChanges),
1388-
this._get_reward_lines(),
1388+
this._getRewardLines(),
13891389
];
13901390
return array.some((elem) => elem.length > 0);
13911391
},

addons/pos_loyalty/static/src/app/screens/payment_screen/payment_screen.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ patch(PaymentScreen.prototype, {
3030
newCodes.push(pe.barcode);
3131
}
3232
}
33-
for (const line of this.currentOrder._get_reward_lines()) {
33+
for (const line of this.currentOrder._getRewardLines()) {
3434
let couponId = line.coupon_id.id;
3535
if (isNaN(Number(line.coupon_id.id))) {
3636
couponId = this.pos.data.mapUuidToId(line.coupon_id.id);
@@ -96,7 +96,7 @@ patch(PaymentScreen.prototype, {
9696
async _postProcessLoyalty(order) {
9797
// Compile data for our function
9898
const ProgramModel = this.pos.models["loyalty.program"];
99-
const rewardLines = order._get_reward_lines();
99+
const rewardLines = order._getRewardLines();
100100
const partner = order.getPartner();
101101

102102
let couponData = Object.values(order.uiState.couponPointChanges).reduce((agg, pe) => {

0 commit comments

Comments
 (0)