Forward port of branch saas-5 up to 9a7f48a

This commit is contained in:
Martin Trigaux 2014-09-02 14:50:51 +02:00
commit e95aeb659c
3 changed files with 17 additions and 9 deletions

View File

@ -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

View File

@ -738,7 +738,7 @@
<!-- account chart -->
<record id="l10n_kzc_temp_chart" model="account.chart.template">
<field name="name">compta Kazacube</field>
<field name="name">Plan comptable marocain</field>
<field name="account_root_id" ref="pcg_0"/>
<field name="tax_code_root_id" ref="vat_ma_tax_root"/>
<field name="bank_account_view_id" ref="pcg_514"/>

View File

@ -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();