Browse Source

[FIX] linting

pull/414/head
Pierrick Brun 6 years ago
committed by Wolfgang Pichler
parent
commit
32df971e2c
  1. 50
      pos_loyalty/static/src/js/pos.js
  2. 13
      pos_loyalty/static/src/js/tests.js

50
pos_loyalty/static/src/js/pos.js

@ -17,20 +17,31 @@ odoo.define('pos_loyalty.loyalty_program', function (require){
models.load_fields('res.partner', 'loyalty_points');
models.load_models([
{
models.load_models([{
model: 'loyalty.program',
condition: function(self){ return !!self.config.loyalty_id[0]; },
condition: function(self) {
return !!self.config.loyalty_id[0];
},
fields: ['name', 'pp_currency', 'pp_product', 'pp_order', 'rounding'],
domain: function(self){ return [['id','=',self.config.loyalty_id[0]]]; },
domain: function(self) {
return [
['id', '=', self.config.loyalty_id[0]]
];
},
loaded: function(self, loyalties) {
self.loyalty = loyalties[0];
},
}, {
model: 'loyalty.rule',
condition: function(self){ return !!self.loyalty; },
condition: function(self) {
return !!self.loyalty;
},
fields: ['name', 'type', 'product_id', 'category_id', 'cumulative', 'pp_product', 'pp_currency'],
domain: function(self){ return [['loyalty_program_id','=',self.loyalty.id]]; },
domain: function(self) {
return [
['loyalty_program_id', '=', self.loyalty.id]
];
},
loaded: function(self, rules) {
self.loyalty.rules = rules;
@ -56,9 +67,15 @@ odoo.define('pos_loyalty.loyalty_program', function (require){
},
}, {
model: 'loyalty.reward',
condition: function(self){ return !!self.loyalty; },
condition: function(self) {
return !!self.loyalty;
},
fields: ['name', 'type', 'minimum_points', 'gift_product_id', 'point_cost', 'discount_product_id', 'discount', 'discount_max', 'point_product_id'],
domain: function(self){ return [['loyalty_program_id','=',self.loyalty.id]]; },
domain: function(self) {
return [
['loyalty_program_id', '=', self.loyalty.id]
];
},
loaded: function(self, rewards) {
self.loyalty.rewards = rewards;
self.loyalty.rewards_by_id = {};
@ -66,8 +83,9 @@ odoo.define('pos_loyalty.loyalty_program', function (require){
self.loyalty.rewards_by_id[rewards[i].id] = rewards[i];
}
},
},
],{'after': 'product.product'});
}, ], {
'after': 'product.product'
});
var _orderline_super = models.Orderline.prototype;
models.Orderline = models.Orderline.extend({
@ -275,7 +293,9 @@ odoo.define('pos_loyalty.loyalty_program', function (require){
price: 0,
quantity: 1,
merge: false,
extras: { reward_id: reward.id },
extras: {
reward_id: reward.id
},
});
} else if (reward.type === 'discount') {
@ -299,7 +319,9 @@ odoo.define('pos_loyalty.loyalty_program', function (require){
price: -discount,
quantity: 1,
merge: false,
extras: { reward_id: reward.id },
extras: {
reward_id: reward.id
},
});
} else if (reward.type === 'resale') {
@ -326,7 +348,9 @@ odoo.define('pos_loyalty.loyalty_program', function (require){
this.add_product(product, {
quantity: -spendable,
merge: false,
extras: { reward_id: reward.id },
extras: {
reward_id: reward.id
},
});
}
},

13
pos_loyalty/static/src/js/tests.js

@ -57,7 +57,8 @@ odoo.define('pos_loyalty.tour.test_pos_loyalty', function (require) {
}
function generate_keypad_steps(amount_str, keypad_selector) {
var i, steps = [], current_char;
var i, steps = [],
current_char;
for (i = 0; i < amount_str.length; ++i) {
current_char = amount_str[i];
steps.push({
@ -140,7 +141,10 @@ odoo.define('pos_loyalty.tour.test_pos_loyalty', function (require) {
steps = steps.concat(finish_order());
Tour.register('test_pos_loyalty_acquire_points', { test: true, url: '/pos/web' }, steps);
Tour.register('test_pos_loyalty_acquire_points', {
test: true,
url: '/pos/web'
}, steps);
steps = [{
content: 'waiting for loading to finish',
@ -159,5 +163,8 @@ odoo.define('pos_loyalty.tour.test_pos_loyalty', function (require) {
}]);
steps = steps.concat(finish_order());
Tour.register('test_pos_loyalty_spend_points', { test: true, url: '/pos/web' }, steps);
Tour.register('test_pos_loyalty_spend_points', {
test: true,
url: '/pos/web'
}, steps);
})
Loading…
Cancel
Save