[IMP] pos_loyalty: renamed 'override' into a more understandable 'cumulative'

This commit is contained in:
Frederic van der Essen
2014-11-26 11:27:03 +01:00
committed by Frédéric van der Essen
parent ea47aa48c1
commit 6283c67e3d
3 changed files with 8 additions and 11 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ class loyalty_rule(osv.osv):
'name': fields.char('Name', size=32, select=1, required=True, help="An internal identification for this loyalty program rule"),
'loyalty_program_id': fields.many2one('loyalty.program', 'Loyalty Program', help='The Loyalty Program this exception belongs to'),
'product_id': fields.many2one('product.product','Target Product', help='The product affected by the rule'),
'override': fields.boolean('Override Base Rules', help='A product targetted by this rule will be ignored by other loyalty rules, including the default one'),
'cumulative': fields.boolean('Cumulative', help='The points won from this rule will be won in addition to other rules'),
'pp_product': fields.float('Points per product', help='How many points the product will earn per product ordered'),
'pp_currency': fields.float('Points per currency', help='How many points the product will earn per value sold'),
}
+4 -7
View File
@@ -7,10 +7,7 @@ openerp.pos_loyalty = function(instance){
var models = module.PosModel.prototype.models;
for (var i = 0; i < models.length; i++) {
var model = models[i];
if (model.model === 'product.product') {
model.fields.push('loyalty_points');
model.fields.push('loyalty_override');
} else if (model.model === 'res.partner') {
if (model.model === 'res.partner') {
model.fields.push('loyalty_points');
} else if (model.model === 'pos.config') {
// load loyalty after pos.config
@@ -23,7 +20,7 @@ openerp.pos_loyalty = function(instance){
},{
model: 'loyalty.rule',
condition: function(self){ return !!self.loyalty; },
fields: ['name','type','product_id','category_id','override','pp_product','pp_currency'],
fields: ['name','type','product_id','category_id','cumulative','pp_product','pp_currency'],
domain: function(self){ return [['loyalty_program_id','=',self.loyalty.id]]; },
loaded: function(self,rules){
@@ -34,7 +31,7 @@ openerp.pos_loyalty = function(instance){
var rule = rules[i];
if (!self.loyalty.rules_by_product_id[rule.product_id[0]]) {
self.loyalty.rules_by_product_id[rule.product_id[0]] = [rule];
} else if (rule.override) {
} else if (rule.cumulative) {
self.loyalty.rules_by_product_id[rule.product_id[0]].unshift(rule);
} else {
self.loyalty.rules_by_product_id[rule.product_id[0]].push(rule);
@@ -83,7 +80,7 @@ openerp.pos_loyalty = function(instance){
var rule = rules[j];
total_points += round_pr(line.get_quantity() * rule.pp_product, rounding);
total_points += round_pr(line.get_price_with_tax() * rule.pp_currency, rounding);
if (rule.override) {
if (!rule.cumulative) {
overriden = true;
break;
}
+3 -3
View File
@@ -49,7 +49,7 @@
<sheet>
<div class="oe_title">
<label class="oe_edit_only" for="name" string="Product Name"/>
<label class="oe_edit_only" for="name" string="Loyalty Program Name"/>
<h1><field name="name" class="oe_inline"/></h1>
</div>
@@ -68,7 +68,7 @@
<field name="product_id" />
<field name="pp_product" />
<field name="pp_currency" />
<field name="override" />
<field name="cumulative" />
</tree>
</field>
@@ -99,7 +99,7 @@
<field name="product_id" />
<field name="pp_product" />
<field name="pp_currency" />
<field name="override" />
<field name="cumulative" />
</group>
</form>
</field>