summaryrefslogtreecommitdiff
path: root/addons/gamification/models/challenge.py
diff options
context:
space:
mode:
authorXavier Morel <xmo@odoo.com>2018-06-19 12:11:59 +0200
committerXavier Morel <xmo@odoo.com>2018-07-16 11:44:32 +0200
commit93c0d7e811da0e64d03bfea0f131c6ace1fbde05 (patch)
tree9f2816352b39523e1828281fde3f208d613dcdd7 /addons/gamification/models/challenge.py
parent233874d5efa00529a6d23a33a8b0b75d535e1950 (diff)
[IMP] de-commit-ify db/module install
Try to remove cr.commit (and rollback) from module and db install: * put a savepoint around test data loading * remove a bunch of commits sprinkled throughout * remove rollback on data loading failure (assuming it bubbles up, the entire module's installation should be rolled back) * add commit right before the tests are run, so they can run isolated and still see whatever was done when installing their module * convert a few explicit closing to context managers
Diffstat (limited to 'addons/gamification/models/challenge.py')
-rw-r--r--addons/gamification/models/challenge.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/gamification/models/challenge.py b/addons/gamification/models/challenge.py
index ac5286813c3..5c1d03dcee7 100644
--- a/addons/gamification/models/challenge.py
+++ b/addons/gamification/models/challenge.py
@@ -201,7 +201,7 @@ class Challenge(models.Model):
##### Update #####
@api.model # FIXME: check how cron functions are called to see if decorator necessary
- def _cron_update(self, ids=False):
+ def _cron_update(self, ids=False, commit=True):
"""Daily cron check.
- Start planned challenges (in draft and with start_date = today)
@@ -228,7 +228,7 @@ class Challenge(models.Model):
# in cron mode, will do intermediate commits
# FIXME: replace by parameter
- return records.with_context(commit_gamification=True)._update_all()
+ return records.with_context(commit_gamification=commit)._update_all()
def _update_all(self):
"""Update the challenges and related goals