[IMP] gamification: avoid sending twice emails in cron
authorMartin Trigaux <mat@openerp.com>
Tue, 7 Oct 2014 16:14:32 +0000 (18:14 +0200)
committerMartin Trigaux <mat@openerp.com>
Tue, 7 Oct 2014 16:14:57 +0000 (18:14 +0200)
commitea68690407203d1c4b6119980fff0530dc232b99
treecd65beb50f6fc2421e0bd5f1ab1138e932a08fec
parentc741d45ac1d4e955c267d82c9c0159b936cd382f
[IMP] gamification: avoid sending twice emails in cron

When the cron is running on a database with a large number of goals (e.g. website_forum with thousands of users), it's possible the CPU time is exceeded and we may have a rollback after sending some emails (for granted badges).
To avoid sending twice emails, commit in cron mode after each reward.
addons/gamification/models/challenge.py