From 3149c1e03f7e504b38d0acb80af6b073dfdf0618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20van=20der=20Essen?= Date: Thu, 23 Apr 2015 18:38:05 +0200 Subject: [PATCH] [FIX] pos_loyalty: show loyalty points updates in the customer list screen --- addons/point_of_sale/static/src/js/screens.js | 8 ++++++++ addons/pos_loyalty/static/src/js/loyalty.js | 10 +++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/addons/point_of_sale/static/src/js/screens.js b/addons/point_of_sale/static/src/js/screens.js index f2ffc611dab..5a910aa48aa 100644 --- a/addons/point_of_sale/static/src/js/screens.js +++ b/addons/point_of_sale/static/src/js/screens.js @@ -209,6 +209,14 @@ var DomCache = core.Class.extend({ } return node; }, + clear_node: function(key) { + var cached = this.cache[key]; + if (cached) { + delete this.cache[key]; + delete this.access_time[key]; + this.size --; + } + }, get_node: function(key){ var cached = this.cache[key]; if(cached){ diff --git a/addons/pos_loyalty/static/src/js/loyalty.js b/addons/pos_loyalty/static/src/js/loyalty.js index 8989b659c15..5134df011cc 100644 --- a/addons/pos_loyalty/static/src/js/loyalty.js +++ b/addons/pos_loyalty/static/src/js/loyalty.js @@ -315,13 +315,17 @@ models.Order = models.Order.extend({ }); } }, - - validate: function(){ + + finalize: function(){ var client = this.get_client(); if ( client ) { client.loyalty_points = this.get_new_total_points(); + // The client list screen has a cache to avoid re-rendering + // the client lines, and so the point updates may not be visible ... + // We need a better GUI framework ! + this.pos.gui.screen_instances.clientlist.partner_cache.clear_node(client.id); } - _super.prototype.validate.apply(this,arguments); + _super.prototype.finalize.apply(this,arguments); }, export_for_printing: function(){