From 8044a37b3a8d5de1f31ebe45ec78867f5ce34af9 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 29 Aug 2014 15:46:36 +0200 Subject: [PATCH 1/6] [FIX] l10n_ma: proper chart of account name --- addons/l10n_ma/l10n_ma_tax.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/l10n_ma/l10n_ma_tax.xml b/addons/l10n_ma/l10n_ma_tax.xml index 48d06e31bc5..17aba7ed07a 100644 --- a/addons/l10n_ma/l10n_ma_tax.xml +++ b/addons/l10n_ma/l10n_ma_tax.xml @@ -738,7 +738,7 @@ - compta Kazacube + Plan comptable marocain @@ -746,7 +746,7 @@ - compta Kazacube + Plan comptable marocain account.chart.template default From 6b11e929a495727868b8d326538ab6d5980b1748 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 29 Aug 2014 16:29:17 +0200 Subject: [PATCH 2/6] [FIX] stock: display product variant name in the slip --- addons/stock/report/picking.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/addons/stock/report/picking.py b/addons/stock/report/picking.py index 603e815fc10..f87c7ed6b48 100644 --- a/addons/stock/report/picking.py +++ b/addons/stock/report/picking.py @@ -30,10 +30,7 @@ class picking(report_sxw.rml_parse): 'get_product_desc': self.get_product_desc, }) def get_product_desc(self, move_line): - desc = move_line.product_id.name - if move_line.product_id.default_code: - desc = '[' + move_line.product_id.default_code + ']' + ' ' + desc - return desc + return move_line.product_id.name_get()[0][1] for suffix in ['', '.in', '.out']: report_sxw.report_sxw('report.stock.picking.list' + suffix, From 18d365ce05494f0d7c5b353dcad19ee6dec5b4a9 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Fri, 29 Aug 2014 20:40:31 +0200 Subject: [PATCH 3/6] "[REVERT][FIX] point_of_sale: field date of report.pos.order should be a datetime" This reverts commit 97d097a2af8c3992d5108bd75b82fa8479d196cc. As explained in the commit comments (on Github), this patch leads to an infinite loop in 7.0, the filter of the pos orders report using the '=' operator in its domain, which is not available for datetime fields, but is for date fields. This should not be forward ported to newer release (saas-3) --- addons/point_of_sale/report/pos_order_report.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/point_of_sale/report/pos_order_report.py b/addons/point_of_sale/report/pos_order_report.py index 9728660fa79..f0b9c1e56c6 100644 --- a/addons/point_of_sale/report/pos_order_report.py +++ b/addons/point_of_sale/report/pos_order_report.py @@ -27,7 +27,7 @@ class pos_order_report(osv.osv): _description = "Point of Sale Orders Statistics" _auto = False _columns = { - 'date': fields.datetime('Date Order', readonly=True), + 'date': fields.date('Date Order', readonly=True), 'year': fields.char('Year', size=4, readonly=True), 'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'), ('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'), From c3f52899dd0ba85615be8cf08a541c8a76ca430e Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 1 Sep 2014 16:10:40 +0200 Subject: [PATCH 4/6] [FIX] web: no_create, if loose focus do not open quick_create --- addons/web/static/src/js/view_form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index 8446a4c79fb..e1b77c71b52 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3376,7 +3376,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc } self.floating = false; } - if (used && self.get("value") === false && ! self.no_ed) { + if (used && self.get("value") === false && ! self.no_ed && ! (self.options && (self.options.no_create || self.options.no_quick_create))) { self.ed_def.reject(); self.uned_def.reject(); self.ed_def = $.Deferred(); From 40e843761f56e1d374937152bc0e2d89eb6f2672 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Mon, 1 Sep 2014 17:40:47 +0200 Subject: [PATCH 5/6] [FIX] gamification: performance improvement On a large database, thousands of badges may have been granted. This code used to prefetch all fields of the users and badge users. This was highly inefficient. Replace this code by SQL query. --- addons/gamification/models/badge.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/addons/gamification/models/badge.py b/addons/gamification/models/badge.py index 74a85c1cf02..326e48f77d3 100644 --- a/addons/gamification/models/badge.py +++ b/addons/gamification/models/badge.py @@ -96,12 +96,17 @@ class gamification_badge(osv.Model): the total number of users this badge was granted to """ result = dict.fromkeys(ids, False) - for obj in self.browse(cr, uid, ids, context=context): - res = list(set(owner.user_id.id for owner in obj.owner_ids)) - result[obj.id] = { - 'unique_owner_ids': res, - 'stat_count': len(obj.owner_ids), - 'stat_count_distinct': len(res) + for badge_id in ids: + cr.execute(""" + SELECT user_id + FROM gamification_badge_user + WHERE badge_id = %s + """, (badge_id,)) + res = [user_id[0] for user_id in cr.fetchall()] + result[badge_id] = { + 'unique_owner_ids': list(set(res)), + 'stat_count': len(res), + 'stat_count_distinct': len(list(set(res))) } return result From b7077198911ea318fedae6fb8c1c664c5ba95a99 Mon Sep 17 00:00:00 2001 From: Martin Trigaux Date: Tue, 2 Sep 2014 11:25:02 +0200 Subject: [PATCH 6/6] [IMP] gamification: improve 40e8437 to make only one global request --- addons/gamification/models/badge.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/addons/gamification/models/badge.py b/addons/gamification/models/badge.py index 326e48f77d3..7d87ef44afc 100644 --- a/addons/gamification/models/badge.py +++ b/addons/gamification/models/badge.py @@ -95,18 +95,21 @@ class gamification_badge(osv.Model): the total number of time this badge was granted the total number of users this badge was granted to """ - result = dict.fromkeys(ids, False) - for badge_id in ids: - cr.execute(""" - SELECT user_id - FROM gamification_badge_user - WHERE badge_id = %s - """, (badge_id,)) - res = [user_id[0] for user_id in cr.fetchall()] + result = dict.fromkeys(ids, {'stat_count':0, 'stat_count_distinct':0, 'unique_owner_ids':[]}) + + cr.execute(""" + SELECT badge_id, count(user_id) as stat_count, + count(distinct(user_id)) as stat_count_distinct, + array_agg(distinct(user_id)) as unique_owner_ids + FROM gamification_badge_user + WHERE badge_id in %s + GROUP BY badge_id + """, (tuple(ids),)) + for (badge_id, stat_count, stat_count_distinct, unique_owner_ids) in cr.fetchall(): result[badge_id] = { - 'unique_owner_ids': list(set(res)), - 'stat_count': len(res), - 'stat_count_distinct': len(list(set(res))) + 'stat_count': stat_count, + 'stat_count_distinct': stat_count_distinct, + 'unique_owner_ids': unique_owner_ids, } return result