Skip to content
Snippets Groups Projects
Commit 3691ee0c authored by Martin Trigaux's avatar Martin Trigaux
Browse files

[FIX] gamification: avoid challenge to be initialised at the target limit...

[FIX] gamification: avoid challenge to be initialised at the target limit (e.g. set your company data goal has a target of 0) and make sure we will compute the goal at least once

bzr revid: mat@openerp.com-20140509131839-lm5zt696sif1krvx
parent 13d18d2b
Branches
Tags
No related merge requests found
......@@ -110,7 +110,7 @@
<field name="computation_mode">count</field>
<field name="display_mode">boolean</field>
<field name="model_id" eval="ref('base.model_res_company')" />
<field name="domain">[('user_ids', 'in', [user.id]), ('name', '=', 'Your Company')]</field>
<field name="domain">[('user_ids', 'in', [user.id]), ('name', '=', 'YourCompany')]</field>
<field name="condition">lower</field>
<field name="action_id" eval="ref('base.action_res_company_form')" />
<field name="res_id_field">user.company_id.id</field>
......
......@@ -422,6 +422,12 @@ class gamification_challenge(osv.Model):
if end_date:
values['end_date'] = end_date
# the goal is initialised over the limit to make sure we will compute it at least once
if line.condition == 'higher':
values['current'] = line.target_goal - 1
else:
values['current'] = line.target_goal + 1
if challenge.remind_update_delay:
values['remind_update_delay'] = challenge.remind_update_delay
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment