[FIX] gamification: don't check the date if no datefield
bzr revid: mat@openerp.com-20130313164325-wfswwojyrnzygaul
This commit is contained in:
parent
b58df69ed6
commit
b9f2d689b0
|
@ -6,7 +6,7 @@
|
|||
<record id="badge_list_action" model="ir.actions.act_window">
|
||||
<field name="name">Badges</field>
|
||||
<field name="res_model">gamification.badge</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_mode">tree,form,kanban</field>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a badge.
|
||||
|
|
|
@ -218,9 +218,9 @@ class gamification_goal(osv.Model):
|
|||
|
||||
domain = safe_eval(goal.type_id.domain,
|
||||
{'user_id': goal.user_id.id})
|
||||
if goal.start_date:
|
||||
if goal.start_date and field_date_name:
|
||||
domain.append((field_date_name, '>=', goal.start_date))
|
||||
if goal.end_date:
|
||||
if goal.end_date and field_date_name:
|
||||
domain.append((field_date_name, '<=', goal.end_date))
|
||||
|
||||
if goal.type_id.computation_mode == 'sum':
|
||||
|
@ -234,6 +234,7 @@ class gamification_goal(osv.Model):
|
|||
towrite = {'current': 0}
|
||||
|
||||
else: # computation mode = count
|
||||
print(uid, domain, type(obj))
|
||||
res = obj.search(cr, uid, domain, context=context)
|
||||
towrite = {'current': len(res)}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ def start_end_date_for_period(period):
|
|||
elif period == 'yearly':
|
||||
start_date = today.replace(month=1, day=1)
|
||||
end_date = today.replace(month=12, day=31)
|
||||
else: # period == 'once':
|
||||
else: # period == 'once':
|
||||
start_date = False # for manual goal, start each time
|
||||
end_date = False
|
||||
|
||||
|
|
Loading…
Reference in New Issue