[IMP] small changes

bzr revid: mat@openerp.com-20130314142439-04espxwt7049xzz5
This commit is contained in:
Martin Trigaux
2013-03-14 15:24:39 +01:00
parent 9f05370cfc
commit c39be93667
3 changed files with 5 additions and 2 deletions
+2
View File
@@ -60,6 +60,7 @@ class gamification_badge(osv.Model):
for obj in self.browse(cr, uid, ids, context=context):
result[obj.id] = len(self.pool.get('gamification.badge.user').search(
cr, uid, [('badge_id', '=', obj.id)], context=context))
result[obj.id] = len(obj.owner_ids)
return result
def _get_unique_global_count(self, cr, uid, ids, name, args, context=None):
@@ -154,6 +155,7 @@ class gamification_badge(osv.Model):
'stat_count_distinct': fields.function(_get_unique_global_count,
string='Unique Count',
help="The number of time this badge has been received by individual users."),
# TODO store result for working domain stat_this_month >= rule_max_number
'stat_this_month': fields.function(_get_month_count,
string='Monthly Count',
help="The number of time this badge has been received this month."),
+2 -1
View File
@@ -70,7 +70,7 @@
('rule_auth', '=', 'nobody'),
'&',
('rule_max', '=', True),
('stat_this_month', '>', 'rule_max_number')
('stat_this_month', '>=', 'rule_max_number')
]}" />
<button string="Check Badge" type="object" name="check_automatic" groups="base.group_no_one" />
</div>
@@ -103,6 +103,7 @@
<field name="stat_this_month"/>
<field name="stat_my"/>
<field name="stat_my_this_month"/>
<field name="owner_ids"/>
</group>
</sheet>
</form>
@@ -18,7 +18,7 @@
</record>
</data>
<data noupdate="0">
<data noupdate="1">
<record id="goal_user_visibility" model="ir.rule">
<field name="name">User can only see his/her goals</field>
<field name="model_id" ref="model_gamification_goal"/>