diff --git a/addons/gamification/models/badge.py b/addons/gamification/models/badge.py index fc6dc4179c8..4eb58b86a9f 100644 --- a/addons/gamification/models/badge.py +++ b/addons/gamification/models/badge.py @@ -95,13 +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 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) + 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] = { + 'stat_count': stat_count, + 'stat_count_distinct': stat_count_distinct, + 'unique_owner_ids': unique_owner_ids, } return result diff --git a/addons/l10n_ma/l10n_ma_tax.xml b/addons/l10n_ma/l10n_ma_tax.xml index 3040cd4e78e..557cdd6a567 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 diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index f832b4b5994..9fe8dd5a7c5 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -3631,7 +3631,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc } self.floating = false; } - if (used && self.get("value") === false && ! self.no_ed && (self.options.no_create === false || self.options.no_create === undefined)) { + 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();